Ignore:
Timestamp:
Dec 4, 2024, 6:29:10 PM (3 weeks ago)
Author:
jbclement
Message:

PEM:
Fixing the writing format for "info_PEM.txt".
JBC

Location:
trunk/LMDZ.COMMON/libf/evolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r3532 r3533  
    504504== 04/12/2024 == JBC
    505505Removing unecessary module/subroutine "interpol_TI_PEM2PCM.F90" + Few small corrections/cleanings.
     506
     507== 04/12/2024 == JBC
     508Fixing the writing format for "info_PEM.txt".
  • trunk/LMDZ.COMMON/libf/evolution/info_PEM_mod.F90

    r3532 r3533  
    3131logical       :: ok
    3232integer       :: cstat
    33 character(50) :: info_frmt
    34 character(20) :: ich1, ich2, ich3, ich4, fch1, fch2, fch3
     33character(20) :: fch1, fch2, fch3
    3534
    3635!----- Code
     
    4039    write(fch2,'(f'//int2str(nb_digits(n_myear) + 5)//'.4)') n_myear
    4140    write(fch3,'(f6.4)') convert_years ! 4 digits to the right of the decimal point to respect the precision of Martian year in "launch_pem.sh"
    42     write(ich1,'(i0)') iPCM
    43     write(ich2,'(i0)') iPEM + 1
    44     write(ich3,'(i0)') nPCM
    45     write(ich4,'(i0)') nPCM_ini
    46     call execute_command_line('sed -i "1s/.*/'//trim(fch1)//' '//trim(fch2)//' '//trim(fch3)//' '//trim(ich1)//' '//trim(ich2)//' '//trim(ich3)//' '//trim(ich4)//'/" info_PEM.txt',cmdstat = cstat)
     41    call execute_command_line('sed -i "1s/.*/'//trim(fch1)//' '//trim(fch2)//' '//trim(fch3)//' '//int2str(iPCM)//' '//int2str(iPEM + 1)//' '//int2str(nPCM)//' '//int2str(nPCM_ini)//'/" info_PEM.txt',cmdstat = cstat)
    4742    if (cstat > 0) then
    4843        error stop 'info_PEM: command execution failed!'
     
    5348    ! Martian date, Number of Martians years done by the PEM run, Number of Martians years done by the chainded simulation, Code of the stopping criterion
    5449    ! The conversion ratio from Planetary years to Earth years is given in the header of the file
    55     info_frmt = '(f'//int2str(nb_digits(year_bp_ini + i_myear) + 5)//'.4,'//'f'//int2str(nb_digits(i_myear_leg) + 5)//'.4,'//'f'//int2str(nb_digits(i_myear) + 5)//'.4,'//'i0)'
    56     write(1,trim(adjustl(info_frmt))) year_bp_ini + i_myear, i_myear_leg, i_myear, stopPEM
     50    write(1,'(f20.4,f20.4,f20.4,i20)') year_bp_ini + i_myear, i_myear_leg, i_myear, stopPEM
    5751    close(1)
    5852else
     
    6761! Function to convert an integer into a string
    6862
    69 integer, intent(in) :: i
    70 character(20)       :: str
     63integer, intent(in)       :: i
     64character(20)             :: str_tmp
     65character(:), allocatable :: str
    7166
    72 if (nb_digits(real(i)) > len(str)) error stop 'int2str [info_PEM_mod]: invalid integer for conversion!'
    73 write(str,'(i0)') i
    74 str = trim(adjustl(str))
     67if (nb_digits(real(i)) > len(str_tmp)) error stop 'int2str [info_PEM_mod]: invalid integer for conversion!'
     68write(str_tmp,'(i0)') i
     69str = trim(adjustl(str_tmp))
    7570
    7671END FUNCTION int2str
Note: See TracChangeset for help on using the changeset viewer.