Changeset 3981 for trunk/LMDZ.COMMON


Ignore:
Timestamp:
Nov 28, 2025, 6:12:59 PM (3 days ago)
Author:
jbclement
Message:

PEM:

  • Removing the counting method where PCM years are taken into account.
  • CO2 ice is now a PEM reservoir such as H2O ice.

JBC

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

Legend:

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

    r3980 r3981  
    808808== 28/11/2025 == JBC
    809809Renaming 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  
    7474fi
    7575((iPCM++))
    76 if [ $counting -ne 0 ]; then
    77     i_myear=$(echo "$i_myear + 1." | bc -l)
    78 fi
    7976sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" launchPEM.info
  • trunk/LMDZ.COMMON/libf/evolution/deftank/README

    r3980 r3981  
    7676      > nPCM_ini -> the number of initial PCM years (>= 2);
    7777      > 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;
    7978      > 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.
    8079  The script can take an argument:
  • trunk/LMDZ.COMMON/libf/evolution/deftank/launchPEM.sh

    r3980 r3981  
    2424nPCM=2
    2525
    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=0
    28 
    2926# 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:
    3027mode=1
     
    4239
    4340source lib_launchPEM.sh
    44 export counting mode
     41export mode
    4542
    4643if [ $# -eq 0 ]; then
     
    5350    checklaunch
    5451    initlaunch
    55     cyclelaunch $mode $counting $nPCM_ini
     52    cyclelaunch $mode $nPCM_ini
    5653
    5754else
     
    6966        fi
    7067        read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < launchPEM.info
    71         cyclelaunch $mode $counting $nPCM
     68        cyclelaunch $mode $nPCM
    7269
    7370    # Starting a relaunch
     
    130127        fi
    131128        if [ $relaunch = "PCM" ]; then
    132             relaunchPCM $mode $counting
     129            relaunchPCM $mode
    133130        else
    134             relaunchPEM $mode $counting
     131            relaunchPEM $mode
    135132        fi
    136133
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3980 r3981  
    295295# To submit the PCM runs
    296296# 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)
    300299submitPCM() {
    301300    find . -type f -name "PCMrun*.job" ! -name "PCMrun.job" -delete
    302301    ii=1
    303     if [ ! -z $4 ]; then
    304         ii=$4
     302    if [ ! -z $3 ]; then
     303        ii=$3
    305304    fi
    306305    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)"
    308307        if [ $1 -eq 0 ]; then # Mode: processing scripts
    309             sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$ii - $3 + 2" | bc)/" PCMrun.job
     308            sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$ii - $2 + 2" | bc)/" PCMrun.job
    310309            ./PCMrun.job
    311310            if [ $? -ne 0 ]; then
     
    315314            cp PCMrun.job PCMrun${iPCM}.job
    316315            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}.job
     316            sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$ii - $2 + 2" | bc)/" PCMrun${iPCM}.job
    318317            if [[ "$scheduler" == "SLURM" ]]; then
    319318                jobID=$(sbatch --parsable PCMrun${iPCM}.job)
     
    327326        fi
    328327        ((iPCM++))
    329         if [ $2 -ne 0 ]; then # Counting: PCM years taken into account
    330             i_myear=$(echo "$i_myear + 1." | bc -l)
    331         fi
    332328        ((ii++))
    333329    else
    334330        endlaunch
    335331    fi
    336     for ((i = $ii; i <= $3; i++)); do
     332    for ((i = $ii; i <= $2; i++)); do
    337333        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)"
    339335            if [ $1 -eq 0 ]; then # Mode: processing scripts
    340                 sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$i - $3 + 2" | bc)/" PCMrun.job
     336                sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$i - $2 + 2" | bc)/" PCMrun.job
    341337                ./PCMrun.job
    342338                if [ $? -ne 0 ]; then
     
    346342                cp PCMrun.job PCMrun${iPCM}.job
    347343                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}.job
     344                sed -i "s/^k=-\?[0-9]\+$/k=$(echo "$i - $2 + 2" | bc)/" PCMrun${iPCM}.job
    349345                if [[ "$scheduler" == "SLURM" ]]; then
    350346                    jobID=$(sbatch --parsable --dependency=afterok:${jobID} PCMrun${iPCM}.job)
     
    355351            fi
    356352            ((iPCM++))
    357             if [ $2 -ne 0 ]; then # Counting: PCM years taken into account
    358                 i_myear=$(echo "$i_myear + 1." | bc -l)
    359             fi
    360353        else
    361354            endlaunch
     
    393386# To make one cycle of PCM and PEM runs
    394387# 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)
    398390cyclelaunch() {
    399391    # PCM runs
    400     submitPCM $1 $2 $3 $4
     392    submitPCM $1 $2 $3
    401393
    402394    # PEM run
     
    449441# To relaunch from PCM run
    450442# arg1: launching mode
    451 # arg2: counting method
    452443relaunchPCM() {
    453444    iPCM=$(($irelaunch + 1))
     
    469460        # PCM relaunch during the initialization cycle
    470461        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
    476463        sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" launchPEM.info
    477464        cleanfiles diags/diagpem .nc $(($iPEM - 1))
     
    489476            cp diags/Xoutdaily4pem${irelaunch}.nc Xoutdaily4pem_Y1.nc
    490477            cp diags/Xoutyearly4pem${irelaunch}.nc Xoutyearly4pem_Y1.nc
    491             cyclelaunch $1 $2 $nPCM_ini $iPCM
     478            cyclelaunch $1 $nPCM_ini $iPCM
    492479        elif [ $irelaunch -eq $nPCM_ini ]; then
    493480            cp diags/Xoutdaily4pem$(($irelaunch - 1)).nc Xoutdaily4pem_Y1.nc
     
    497484            submitPEM $1 # The next job is a PEM run
    498485        else
    499             cyclelaunch $1 $2 $nPCM_ini $iPCM
     486            cyclelaunch $1 $nPCM_ini $iPCM
    500487        fi
    501488    else
     
    503490        iPEM=$(echo "($iPCM - $nPCM_ini)/$nPCM + 1" | bc)
    504491        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")
    510493        sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" launchPEM.info
    511494        cleanfiles diags/diagpem .nc $(($iPEM - 1))
     
    520503            cp diags/Xoutdaily4pem${irelaunch}.nc Xoutdaily4pem_Y1.nc
    521504            cp diags/Xoutyearly4pem${irelaunch}.nc Xoutyearly4pem_Y1.nc
    522             cyclelaunch $1 $2 $nPCM $(($il + 1))
     505            cyclelaunch $1 $nPCM $(($il + 1))
    523506        elif [ $il -eq $nPCM ]; then # Last PCM run so the next job is a PEM run
    524507            cp diags/Xoutdaily4pem$(($irelaunch - 1)).nc Xoutdaily4pem_Y1.nc
     
    528511            submitPEM $1
    529512        else
    530             cyclelaunch $1 $2 $nPCM $(($il + 1))
     513            cyclelaunch $1 $nPCM $(($il + 1))
    531514        fi
    532515    fi
     
    535518# To relaunch from PEM run
    536519# arg1: launching mode
    537 # arg2: counting method
    538520relaunchPEM() {
    539521    iPEM=$(echo "$irelaunch + 1" | bc)
     
    563545        cp starts/restart1D_postPEM${irelaunch}.txt start1D.txt
    564546    fi
    565     cyclelaunch $1 $2 $nPCM
    566 }
     547    cyclelaunch $1 $nPCM
     548}
  • trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90

    r3961 r3981  
    2525use glaciers_mod,               only: rho_co2ice, rho_h2oice
    2626use comcstfi_h,                 only: r, mugaz, pi
    27 use surfdat_h,                  only: watercaptag, watercap, perennial_co2ice
     27use surfdat_h,                  only: watercaptag, perennial_co2ice
    2828
    2929implicit none
     
    112112            if (watercaptag(ig)) h2o_ice(ig,:) = ini_huge_h2oice
    113113        enddo
    114     else
    115         ! The variations of infinite reservoirs during the PCM years are taken into account
    116         h2o_ice = h2o_ice + watercap
    117114    endif
    118115
    119116    ! 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
    121124
    122125!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • trunk/LMDZ.COMMON/libf/evolution/pemredem.F90

    r3789 r3981  
    7777real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: ice_porefilling       ! under mesh bining according to slope
    7878real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: m_co2_regolith, m_h2o_regolith
    79 real, dimension(ngrid,nslope),           intent(in) :: h2o_ice
     79real, dimension(ngrid,nslope),           intent(in) :: h2o_ice, co2_ice
    8080type(layering), dimension(ngrid,nslope), intent(in) :: layerings_map ! Layerings
    8181
     
    9393call put_var("Time","Year of simulation",Year)
    9494call put_field('h2o_ice','h2o_ice',h2o_ice,Year)
     95call put_field('co2_ice','co2_ice',co2_ice,Year)
    9596
    9697if (layering_algo) then
Note: See TracChangeset for help on using the changeset viewer.