Changeset 3981 for trunk/LMDZ.COMMON
- Timestamp:
- Nov 28, 2025, 6:12:59 PM (3 days ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 7 edited
-
changelog.txt (modified) (1 diff)
-
deftank/PCMrun.job (modified) (1 diff)
-
deftank/README (modified) (1 diff)
-
deftank/launchPEM.sh (modified) (5 diffs)
-
deftank/lib_launchPEM.sh (modified) (15 diffs)
-
pemetat0.F90 (modified) (2 diffs)
-
pemredem.F90 (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r3980 r3981 808 808 == 28/11/2025 == JBC 809 809 Renaming the file "info_PEM.txt" into "launchPEM.info". 810 811 == 28/11/2025 == JBC 812 - Removing the counting method where PCM years are taken into account. 813 - CO2 ice is now a PEM reservoir such as H2O ice. -
trunk/LMDZ.COMMON/libf/evolution/deftank/PCMrun.job
r3980 r3981 74 74 fi 75 75 ((iPCM++)) 76 if [ $counting -ne 0 ]; then77 i_myear=$(echo "$i_myear + 1." | bc -l)78 fi79 76 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" launchPEM.info -
trunk/LMDZ.COMMON/libf/evolution/deftank/README
r3980 r3981 76 76 > nPCM_ini -> the number of initial PCM years (>= 2); 77 77 > nPCM -> the number of PCM years between each PEM run (>= 2, usually 2); 78 > counting -> the counting method for the number of years to be simulated (0 = "only PEM years count"; any other values = "PCM years are taken into account"). The former option is the usual one;79 78 > mode -> the launching mode (0 = "processing scripts"; any other values = "submitting jobs"). The former option is usually used to process the script on a local machine while the latter is used to submit jobs on a supercomputer with SLURM or PBS/TORQUE. 80 79 The script can take an argument: -
trunk/LMDZ.COMMON/libf/evolution/deftank/launchPEM.sh
r3980 r3981 24 24 nPCM=2 25 25 26 # Set the counting method for the number of years to be simulated (0 = "only PEM years count"; any other values = "PCM years are taken into account"). The former option is the usual one:27 counting=028 29 26 # Set the launching mode (0 = "processing scripts"; any other values = "submitting jobs"). The former option is usually used to process the script on a local machine while the latter is used to submit jobs on a supercomputer with SLURM or PBS/TORQUE: 30 27 mode=1 … … 42 39 43 40 source lib_launchPEM.sh 44 export countingmode41 export mode 45 42 46 43 if [ $# -eq 0 ]; then … … 53 50 checklaunch 54 51 initlaunch 55 cyclelaunch $mode $ counting $nPCM_ini52 cyclelaunch $mode $nPCM_ini 56 53 57 54 else … … 69 66 fi 70 67 read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < launchPEM.info 71 cyclelaunch $mode $ counting $nPCM68 cyclelaunch $mode $nPCM 72 69 73 70 # Starting a relaunch … … 130 127 fi 131 128 if [ $relaunch = "PCM" ]; then 132 relaunchPCM $mode $counting129 relaunchPCM $mode 133 130 else 134 relaunchPEM $mode $counting131 relaunchPEM $mode 135 132 fi 136 133 -
trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh
r3980 r3981 295 295 # To submit the PCM runs 296 296 # arg1: launching mode 297 # arg2: counting method 298 # arg3: number of PCM runs to launch 299 # arg4: local number of the PCM run from which to start (optional) 297 # arg2: number of PCM runs to launch 298 # arg3: local number of the PCM run from which to start (optional) 300 299 submitPCM() { 301 300 find . -type f -name "PCMrun*.job" ! -name "PCMrun.job" -delete 302 301 ii=1 303 if [ ! -z $ 4]; then304 ii=$ 4302 if [ ! -z $3 ]; then 303 ii=$3 305 304 fi 306 305 if [ $(echo "$i_myear < $n_myear" | bc -l) -eq 1 ]; then 307 echo "Run \"PCM $iPCM\" ($ii/$ 3)"306 echo "Run \"PCM $iPCM\" ($ii/$2)" 308 307 if [ $1 -eq 0 ]; then # Mode: processing scripts 309 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$ii - $ 3+ 2" | bc)/" PCMrun.job308 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$ii - $2 + 2" | bc)/" PCMrun.job 310 309 ./PCMrun.job 311 310 if [ $? -ne 0 ]; then … … 315 314 cp PCMrun.job PCMrun${iPCM}.job 316 315 sed -i -E "/^$name_job/s/(.*[^0-9])([0-9]+)(_[^0-9]*)?$/\1${iPCM}\3/" PCMrun${iPCM}.job 317 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$ii - $ 3+ 2" | bc)/" PCMrun${iPCM}.job316 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$ii - $2 + 2" | bc)/" PCMrun${iPCM}.job 318 317 if [[ "$scheduler" == "SLURM" ]]; then 319 318 jobID=$(sbatch --parsable PCMrun${iPCM}.job) … … 327 326 fi 328 327 ((iPCM++)) 329 if [ $2 -ne 0 ]; then # Counting: PCM years taken into account330 i_myear=$(echo "$i_myear + 1." | bc -l)331 fi332 328 ((ii++)) 333 329 else 334 330 endlaunch 335 331 fi 336 for ((i = $ii; i <= $ 3; i++)); do332 for ((i = $ii; i <= $2; i++)); do 337 333 if [ $(echo "$i_myear < $n_myear" | bc -l) -eq 1 ]; then 338 echo "Run \"PCM $iPCM\" ($i/$ 3)"334 echo "Run \"PCM $iPCM\" ($i/$2)" 339 335 if [ $1 -eq 0 ]; then # Mode: processing scripts 340 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$i - $ 3+ 2" | bc)/" PCMrun.job336 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$i - $2 + 2" | bc)/" PCMrun.job 341 337 ./PCMrun.job 342 338 if [ $? -ne 0 ]; then … … 346 342 cp PCMrun.job PCMrun${iPCM}.job 347 343 sed -i -E "/^$name_job/s/(.*[^0-9])([0-9]+)(_[^0-9]*)?$/\1${iPCM}\3/" PCMrun${iPCM}.job 348 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$i - $ 3+ 2" | bc)/" PCMrun${iPCM}.job344 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$i - $2 + 2" | bc)/" PCMrun${iPCM}.job 349 345 if [[ "$scheduler" == "SLURM" ]]; then 350 346 jobID=$(sbatch --parsable --dependency=afterok:${jobID} PCMrun${iPCM}.job) … … 355 351 fi 356 352 ((iPCM++)) 357 if [ $2 -ne 0 ]; then # Counting: PCM years taken into account358 i_myear=$(echo "$i_myear + 1." | bc -l)359 fi360 353 else 361 354 endlaunch … … 393 386 # To make one cycle of PCM and PEM runs 394 387 # arg1: launching mode 395 # arg2: counting method 396 # arg3: number of PCM runs to launch 397 # arg4: local number of the PCM run from which to start (optional) 388 # arg2: number of PCM runs to launch 389 # arg3: local number of the PCM run from which to start (optional) 398 390 cyclelaunch() { 399 391 # PCM runs 400 submitPCM $1 $2 $3 $4392 submitPCM $1 $2 $3 401 393 402 394 # PEM run … … 449 441 # To relaunch from PCM run 450 442 # arg1: launching mode 451 # arg2: counting method452 443 relaunchPCM() { 453 444 iPCM=$(($irelaunch + 1)) … … 469 460 # PCM relaunch during the initialization cycle 470 461 iPEM=1 471 if [ $2 -ne 0 ]; then # Counting: PCM years taken into account 472 i_myear=$irelaunch 473 else # Counting: only PEM years count 474 i_myear=0 475 fi 462 i_myear=0 476 463 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" launchPEM.info 477 464 cleanfiles diags/diagpem .nc $(($iPEM - 1)) … … 489 476 cp diags/Xoutdaily4pem${irelaunch}.nc Xoutdaily4pem_Y1.nc 490 477 cp diags/Xoutyearly4pem${irelaunch}.nc Xoutyearly4pem_Y1.nc 491 cyclelaunch $1 $ 2 $nPCM_ini $iPCM478 cyclelaunch $1 $nPCM_ini $iPCM 492 479 elif [ $irelaunch -eq $nPCM_ini ]; then 493 480 cp diags/Xoutdaily4pem$(($irelaunch - 1)).nc Xoutdaily4pem_Y1.nc … … 497 484 submitPEM $1 # The next job is a PEM run 498 485 else 499 cyclelaunch $1 $ 2 $nPCM_ini $iPCM486 cyclelaunch $1 $nPCM_ini $iPCM 500 487 fi 501 488 else … … 503 490 iPEM=$(echo "($iPCM - $nPCM_ini)/$nPCM + 1" | bc) 504 491 il=$(echo "($irelaunch - $nPCM_ini + 1)%$nPCM + 1" | bc) 505 if [ $2 -ne 0 ]; then # Counting: PCM years taken into account 506 i_myear=$(echo "$(awk "NR==$iPEM {printf \"%s\n\", \$3}" "launchPEM.info") + $il" | bc -l) 507 else # Counting: only PEM years count 508 i_myear=$(awk "NR==$iPEM {printf \"%s\n\", \$3}" "launchPEM.info") 509 fi 492 i_myear=$(awk "NR==$iPEM {printf \"%s\n\", \$3}" "launchPEM.info") 510 493 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" launchPEM.info 511 494 cleanfiles diags/diagpem .nc $(($iPEM - 1)) … … 520 503 cp diags/Xoutdaily4pem${irelaunch}.nc Xoutdaily4pem_Y1.nc 521 504 cp diags/Xoutyearly4pem${irelaunch}.nc Xoutyearly4pem_Y1.nc 522 cyclelaunch $1 $ 2 $nPCM $(($il + 1))505 cyclelaunch $1 $nPCM $(($il + 1)) 523 506 elif [ $il -eq $nPCM ]; then # Last PCM run so the next job is a PEM run 524 507 cp diags/Xoutdaily4pem$(($irelaunch - 1)).nc Xoutdaily4pem_Y1.nc … … 528 511 submitPEM $1 529 512 else 530 cyclelaunch $1 $ 2 $nPCM $(($il + 1))513 cyclelaunch $1 $nPCM $(($il + 1)) 531 514 fi 532 515 fi … … 535 518 # To relaunch from PEM run 536 519 # arg1: launching mode 537 # arg2: counting method538 520 relaunchPEM() { 539 521 iPEM=$(echo "$irelaunch + 1" | bc) … … 563 545 cp starts/restart1D_postPEM${irelaunch}.txt start1D.txt 564 546 fi 565 cyclelaunch $1 $ 2 $nPCM566 } 547 cyclelaunch $1 $nPCM 548 } -
trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90
r3961 r3981 25 25 use glaciers_mod, only: rho_co2ice, rho_h2oice 26 26 use comcstfi_h, only: r, mugaz, pi 27 use surfdat_h, only: watercaptag, watercap,perennial_co2ice27 use surfdat_h, only: watercaptag, perennial_co2ice 28 28 29 29 implicit none … … 112 112 if (watercaptag(ig)) h2o_ice(ig,:) = ini_huge_h2oice 113 113 enddo 114 else115 ! The variations of infinite reservoirs during the PCM years are taken into account116 h2o_ice = h2o_ice + watercap117 114 endif 118 115 119 116 ! co2 ice 120 co2_ice = perennial_co2ice 117 co2_ice = 0. 118 call get_field("co2_ice",co2_ice,found) 119 if (.not. found) then 120 write(*,*)'Pemetat0: failed loading <co2_ice>' 121 write(*,*)'will reconstruct the values from perennial_co2ice' 122 co2_ice = perennial_co2ice 123 endif 121 124 122 125 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -
trunk/LMDZ.COMMON/libf/evolution/pemredem.F90
r3789 r3981 77 77 real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: ice_porefilling ! under mesh bining according to slope 78 78 real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: m_co2_regolith, m_h2o_regolith 79 real, dimension(ngrid,nslope), intent(in) :: h2o_ice 79 real, dimension(ngrid,nslope), intent(in) :: h2o_ice, co2_ice 80 80 type(layering), dimension(ngrid,nslope), intent(in) :: layerings_map ! Layerings 81 81 … … 93 93 call put_var("Time","Year of simulation",Year) 94 94 call put_field('h2o_ice','h2o_ice',h2o_ice,Year) 95 call put_field('co2_ice','co2_ice',co2_ice,Year) 95 96 96 97 if (layering_algo) then
Note: See TracChangeset
for help on using the changeset viewer.
