Changeset 3365 for trunk/LMDZ.COMMON/libf/evolution
- Timestamp:
- Jun 10, 2024, 7:23:37 PM (6 months ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r3363 r3365 353 353 - Update of "jobPEM.slurm" in the deftank to guarantee enough memory space to run the job. 354 354 - Few minor cleanings. 355 356 == 10/06/2024 == JBC 357 Correction of an error in "lib_launchPEM.sh" due to a miscalculated condition + Improvement of the relaunch which now cleans the unnecessary files. -
trunk/LMDZ.COMMON/libf/evolution/deftank/launchPEM.sh
r3363 r3365 75 75 done 76 76 read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt 77 echo $i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini78 77 while true; do 79 78 if [ $relaunch = "PCM" ]; then -
trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh
r3355 r3365 206 206 } 207 207 208 # To clean files after the starting run of the relaunch 209 cleanfiles() { 210 prefix=$1 211 extension=$2 212 if [ -z "$extension" ]; then 213 for file in ${prefix}*; do 214 num=${file#$prefix} 215 if [[ $num =~ ^[0-9]+$ ]] && [ $num -gt $3 ]; then 216 rm $file 217 fi 218 done 219 else 220 for file in ${prefix}*${extension}; do 221 num=${file#$prefix} 222 num=${num%$extension} 223 if [[ $num =~ ^[0-9]+$ ]] && [ $num -gt $3 ]; then 224 rm $file 225 fi 226 done 227 fi 228 } 229 208 230 # To relaunch from PCM run 209 231 relaunchPCM() { 210 232 iPCM=$(($irelaunch + 1)) 233 cleanfiles diags/diagfi .nc $irelaunch 234 cleanfiles "out_PCM/run" "" $irelaunch 235 cleanfiles starts/restart1D .txt $irelaunch 236 cleanfiles starts/restart .nc $irelaunch 237 cleanfiles starts/restartfi .nc $irelaunch 211 238 cp starts/restartfi${irelaunch}.nc startfi.nc 212 239 if [ -f "starts/restart${irelaunch}.nc" ]; then … … 218 245 # PCM relaunch during the initialization cycle 219 246 iPEM=1 247 cleanfiles diags/diagpem .nc $iPEM 248 cleanfiles "out_PEM/run" "" $iPEM 249 cleanfiles starts/restart1D_postPEM .txt $iPEM 250 cleanfiles starts/restart_postPEM .nc $iPEM 251 cleanfiles starts/restartfi_postPEM .nc $iPEM 252 cleanfiles starts/restartpem .nc $iPEM 220 253 i_myear=$irelaunch 221 254 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 222 255 if [ $irelaunch -eq $(($nPCM_ini - 1)) ]; then 223 256 cp diags/data2reshape${irelaunch}.nc data2reshape_Y1.nc 257 cleanfiles diags/data2reshape .nc $irelaunch 224 258 cyclelaunch $nPCM_ini $irelaunch 225 elif [ $irelaunch -eq $nPCM_ini]; then259 elif [ $irelaunch -eq 0 ]; then 226 260 cp diags/data2reshape$(($irelaunch - 1)).nc data2reshape_Y1.nc 227 261 cp diags/data2reshape${irelaunch}.nc data2reshape_Y2.nc 262 cleanfiles diags/data2reshape .nc $(($irelaunch - 1)) 228 263 submitPEM # The next job is a PEM run 229 264 else 265 cleanfiles diags/data2reshape .nc 0 230 266 cyclelaunch $nPCM_ini $iPCM 231 267 fi 232 268 else 233 269 # PCM relaunch during a cycle 234 iPEM=$(( $irelaunch/$nPCM + 1))270 iPEM=$((($irelaunch - $nPCM_ini)/$nPCM + 1)) 235 271 il=$(echo "($irelaunch - $nPCM_ini)%$nPCM" | bc -l) 236 i_myear=$(($(awk "NR==$(($iPEM + 1)) {print \$1}" "info_PEM.txt") + $il)) 237 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 272 cleanfiles diags/diagpem .nc $iPEM 273 cleanfiles "out_PEM/run" "" $iPEM 274 cleanfiles starts/restart1D_postPEM .txt $iPEM 275 cleanfiles starts/restart_postPEM .nc $iPEM 276 cleanfiles starts/restartfi_postPEM .nc $iPEM 277 cleanfiles starts/restartpem .nc $iPEM 238 278 cp starts/restartpem${iPEM}.nc startpem.nc 239 279 if [ $il -eq $(($nPCM - 1)) ]; then 280 i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $il)) 281 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 240 282 cp diags/data2reshape${irelaunch}.nc data2reshape_Y1.nc 283 cleanfiles diags/data2reshape .nc $irelaunch 241 284 cyclelaunch $nPCM $il 242 elif [ $il -eq $nPCM ]; then 285 elif [ $il -eq 0 ]; then 286 i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $nPCM)) 287 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 243 288 cp diags/data2reshape$(($irelaunch - 1)).nc data2reshape_Y1.nc 244 289 cp diags/data2reshape${irelaunch}.nc data2reshape_Y2.nc 290 cleanfiles diags/data2reshape .nc $(($irelaunch - 1)) 245 291 submitPEM # The next job is a PEM run 246 292 else 293 i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $il)) 294 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 295 cleanfiles diags/data2reshape .nc $irelaunch 247 296 cyclelaunch $nPCM $il 248 297 fi … … 256 305 i_myear=$(awk "NR==$(($iPEM + 1)) {print \$1}" "info_PEM.txt") 257 306 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 307 cleanfiles diags/diagfi .nc $(($iPCM - 1)) 308 cleanfiles "out_PCM/run" "" $(($iPCM - 1)) 309 cleanfiles starts/restart1D .txt $(($iPCM - 1)) 310 cleanfiles starts/restart .nc $(($iPCM - 1)) 311 cleanfiles starts/restartfi .nc $(($iPCM - 1)) 312 cleanfiles diags/data2reshape .nc $(($iPCM - 1)) 313 cleanfiles diags/diagpem .nc $irelaunch 314 cleanfiles "out_PEM/run" "" $irelaunch 315 cleanfiles starts/restart1D_postPEM .txt $irelaunch 316 cleanfiles starts/restart_postPEM .nc $irelaunch 317 cleanfiles starts/restartfi_postPEM .nc $irelaunch 318 cleanfiles starts/restartpem .nc $irelaunch 258 319 cp starts/restartpem${irelaunch}.nc startpem.nc 259 320 cp starts/restartfi_postPEM${irelaunch}.nc startfi.nc -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r3363 r3365 239 239 character(100) :: chtimelimit ! Time limit for the PEM job outputted by the SLURM command 240 240 real :: timelimit ! Time limit for the PEM job in seconds 241 real, parameter :: antetime = 1200 ! Anticipation time to prevent reaching the time timelimit: 1200 s = 20 min by default241 real, parameter :: antetime = 1200 ! Anticipation time to prevent reaching the time limit: 1200 s = 20 min by default 242 242 integer :: cstat, days, hours, minutes, seconds 243 243 character(1) :: sep … … 596 596 call compute_tend(ngrid,nslope,min_h2o_ice,tend_h2o_ice) 597 597 tend_co2_ice_ini = tend_co2_ice 598 deallocate(min_co2_ice,min_h2o_ice) 598 599 599 600 !------------------------ … … 602 603 !------------------------ 603 604 allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope)) 604 deallocate(min_co2_ice,min_h2o_ice)605 605 606 606 allocate(stratif(ngrid,nslope))
Note: See TracChangeset
for help on using the changeset viewer.