Changeset 4072 for trunk/LMDZ.COMMON/libf/evolution/workflow_status.F90
- Timestamp:
- Feb 16, 2026, 11:41:37 AM (12 days ago)
- File:
-
- 1 moved
-
trunk/LMDZ.COMMON/libf/evolution/workflow_status.F90 (moved) (moved from trunk/LMDZ.COMMON/libf/evolution/info.F90) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/workflow_status.F90
r4071 r4072 1 MODULE info1 MODULE workflow_status 2 2 !----------------------------------------------------------------------- 3 3 ! NAME 4 ! info4 ! workflow_status 5 5 ! 6 6 ! DESCRIPTION 7 7 ! Handles counters for PCM/PEM coupled runs and duration information 8 ! of the simulation metadata.8 ! of the simulation. 9 9 ! 10 10 ! AUTHORS & DATE … … 25 25 ! PARAMETERS 26 26 ! ---------- 27 character(14), parameter :: infofile_name = 'launchPEM.info' 28 29 ! VARIABLES 30 ! --------- 31 integer(di) :: iPCM, iPEM, nPCM, nPCM_ini ! Data about the chained simulation of PCM/PEM runs 27 character(16), parameter :: statusfile_name = 'pem_workflow.sts' 28 integer(di), protected :: i_pcm_run, i_pem_run, n_pcm_runs, n_pcm_runs_ini ! Data about the chained simulation of PCM/PEM runs 32 29 33 30 contains … … 35 32 36 33 !======================================================================= 37 SUBROUTINE read_ info()34 SUBROUTINE read_workflow_status() 38 35 !----------------------------------------------------------------------- 39 36 ! NAME 40 ! read_ info37 ! read_workflow_status 41 38 ! 42 39 ! DESCRIPTION 43 ! Read the file " launchPEM.info" to get the number of simulated40 ! Read the file "pem_workflow.sts" to get the number of simulated 44 41 ! years. 45 42 ! … … 54 51 ! ------------ 55 52 use stoppage, only: stop_clean 56 use evolution, only: n_yr_sim, n max_yr_sim, set_r_plnt2earth_yr53 use evolution, only: n_yr_sim, ntot_yr_sim, set_r_plnt2earth_yr 57 54 use display, only: print_msg 55 use utility, only: int2str 58 56 59 57 ! DECLARATION … … 69 67 ! CODE 70 68 ! ---- 71 inquire(file = infofile_name,exist = here)72 if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'// infofile_name//'"! It should be created by the launchingscript.',1)73 call print_msg('> Reading "'// infofile_name//'"')74 open(newunit = funit,file = infofile_name,status = 'old',form = 'formatted',action = 'read',iostat = ierr)75 if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'error opening file "'// infofile_name//'"!',ierr)76 read(funit,*) n_yr_sim, n max_yr_sim, tmp, iPCM, iPEM, nPCM, nPCM_ini69 inquire(file = statusfile_name,exist = here) 70 if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'//statusfile_name//'"! It should be created by the PEM workflow script.',1) 71 call print_msg('> Reading "'//statusfile_name//'"') 72 open(newunit = funit,file = statusfile_name,status = 'old',form = 'formatted',action = 'read',iostat = ierr) 73 if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'error opening file "'//statusfile_name//'"!',ierr) 74 read(funit,*) n_yr_sim, ntot_yr_sim, tmp, i_pcm_run, i_pem_run, n_pcm_runs, n_pcm_runs_ini 77 75 call set_r_plnt2earth_yr(tmp) 78 76 close(funit) 79 77 80 END SUBROUTINE read_info 78 call print_msg('Current PEM run: '//int2str(i_pem_run)) 79 call print_msg('Input PCM runs : '//int2str(i_pcm_run - 1)//' and '//int2str(i_pcm_run)) 80 81 END SUBROUTINE read_workflow_status 81 82 !======================================================================= 82 83 83 84 !======================================================================= 84 SUBROUTINE update_ info(n_yr_run,stopPEM,n_yr_sim,nmax_yr_sim)85 SUBROUTINE update_workflow_status(n_yr_run,stopPEM,n_yr_sim,ntot_yr_sim) 85 86 !----------------------------------------------------------------------- 86 87 ! NAME 87 ! update_ info88 ! update_workflow_status 88 89 ! 89 90 ! DESCRIPTION 90 ! Update the first line of " launchPEM.info" to count the number of91 ! simulated years. Write in " launchPEM.info" the reason why the PEM91 ! Update the first line of "pem_workflow.sts" to count the number of 92 ! simulated years. Write in "pem_workflow.sts" the reason why the PEM 92 93 ! stopped and the number of simulated years. 93 94 ! … … 116 117 real(dp), intent(in) :: n_yr_run ! # of years 117 118 real(dp), intent(in) :: n_yr_sim ! Current simulated year 118 real(dp), intent(in) :: n max_yr_sim ! Maximum number of years to be simulated119 real(dp), intent(in) :: ntot_yr_sim ! Maximum number of years to be simulated 119 120 120 121 ! LOCAL VARIABLES … … 126 127 ! CODE 127 128 ! ---- 128 call print_msg('> Updating "'// infofile_name//'"')129 inquire(file = infofile_name,exist = here)130 if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'// infofile_name//'"! It should be created by the launchingscript.',1)129 call print_msg('> Updating "'//statusfile_name//'"') 130 inquire(file = statusfile_name,exist = here) 131 if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'//statusfile_name//'"! It should be created by the PEM workflow script.',1) 131 132 132 133 ! Modify the header (first line) 133 134 write(fch1,'(f'//int2str(nb_digits(n_yr_sim) + 5)//'.4)') n_yr_sim 134 write(fch2,'(f'//int2str(nb_digits(n max_yr_sim) + 5)//'.4)') nmax_yr_sim135 write(fch3,'(f6.4)') r_plnt2earth_yr ! 4 digits to the right of the decimal point to respect the precision of year in " launch_pem.sh"136 call execute_command_line('sed -i "1s/.*/'//trim(fch1)//' '//trim(fch2)//' '//trim(fch3)//' '//int2str(i PCM)//' '//int2str(iPEM + 1)//' '//int2str(nPCM)//' '//int2str(nPCM_ini)//'/" launchPEM.info',cmdstat = cstat)135 write(fch2,'(f'//int2str(nb_digits(ntot_yr_sim) + 5)//'.4)') ntot_yr_sim 136 write(fch3,'(f6.4)') r_plnt2earth_yr ! 4 digits to the right of the decimal point to respect the precision of year in "pem_workflow_lib.sh" 137 call execute_command_line('sed -i "1s/.*/'//trim(fch1)//' '//trim(fch2)//' '//trim(fch3)//' '//int2str(i_pcm_run)//' '//int2str(i_pem_run + 1)//' '//int2str(n_pcm_runs)//' '//int2str(n_pcm_runs_ini)//'/" pem_workflow.sts',cmdstat = cstat) 137 138 if (cstat > 0) then 138 139 call stop_clean(__FILE__,__LINE__,'command execution failed!',1) … … 142 143 143 144 ! Add the information of current PEM run at the end of file 144 open(newunit = funit,file = infofile_name,status = "old",position = "append",action = "write",iostat = ierr)145 if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'error opening file "'// infofile_name//'"!',ierr)146 ! Date, Number of years done by the PEM run, Number of years done by the chain ded simulation, Code of the stopping criterion145 open(newunit = funit,file = statusfile_name,status = "old",position = "append",action = "write",iostat = ierr) 146 if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'error opening file "'//statusfile_name//'"!',ierr) 147 ! Date, Number of years done by the PEM run, Number of years done by the chained simulation, Code of the stopping criterion 147 148 write(funit,'(f20.4,f20.4,f20.4,i20)') pem_ini_date + n_yr_sim, n_yr_run, n_yr_sim, stopPEM 148 149 close(funit) 149 150 150 END SUBROUTINE update_ info151 END SUBROUTINE update_workflow_status 151 152 !======================================================================= 152 153 153 END MODULE info154 END MODULE workflow_status
Note: See TracChangeset
for help on using the changeset viewer.
