Changeset 3556 for trunk/LMDZ.COMMON


Ignore:
Timestamp:
Dec 17, 2024, 12:15:17 PM (6 days ago)
Author:
jbclement
Message:

PEM:
As intended, years computed by the PEM runs are now the only ones to be counted for the duration of the PEM simulation. The possibility to count in addition years computed by the PCM runs is left as an option of "launchPEM.sh" with the variable 'counting' (0 = "only PEM runs count"; any other values = "PCM runs are taken into account") + several small corrections/improvements in the launching scripts.
JBC

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

Legend:

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

    r3553 r3556  
    519519== 16/12/2024 == JBC
    520520Addition of the shifting of the soil temperature profile to follow the surface evolution due to ice condensation/sublimation + small cleanings/improvements.
     521
     522== 16/12/2024 == JBC
     523Follow-up of previous commit (r3553).
     524
     525== 17/12/2024 == JBC
     526As intended, years computed by the PEM runs are now the only ones to be counted for the duration of the PEM simulation. The possibility to count in addition years computed by the PCM runs is left as an option of "launchPEM.sh" with the variable 'counting' (0 = "only PEM runs count"; any other values = "PCM runs are taken into account") + several small corrections/improvements in the launching scripts.
  • trunk/LMDZ.COMMON/libf/evolution/deftank/PCMrun.job

    r3518 r3556  
    3232
    3333# Running the PCM
     34read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt
    3435echo "Run PCM $iPCM is starting."
    35 read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt
    3636cp run_PCM.def run.def
    3737eval "$exe_cmd > out_runPCM${iPCM} 2>&1"
    3838if [ ! -f "restartfi.nc" ] || ! (tail -n 100 out_runPCM${iPCM} | grep -iq "everything is cool!"); then # Check if it ended abnormally
    3939    echo "Error: the run PCM $iPCM crashed!"
    40     echo "Be careful: there may be dependent jobs remaining in the SLURM queue with status 'DependencyNeverSatisfied'! You can cancel them by executing the script \"kill_launchPEM.sh\"."
     40    if [ $mode -ne 0 ]; then
     41        echo "Be careful: there may be dependent jobs remaining in the SLURM queue with status 'DependencyNeverSatisfied'! You can cancel them by executing the script \"kill_launchPEM.sh\"."
     42    fi
    4143    exit 1
    4244fi
     
    7072fi
    7173((iPCM++))
    72 ((i_myear++))
     74if [ $counting -ne 0 ]; then
     75    i_myear=$(echo "$i_myear + 1." | bc -l)
     76fi
    7377sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
  • trunk/LMDZ.COMMON/libf/evolution/deftank/README

    r3498 r3556  
    77      (ii)  nPCM_ini -> the number of initial PCM runs (at least 2);
    88      (iii) nPCM -> the number of PCM runs between each PEM run (usually 2);
    9       (iv)  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.
     9      (iv)  counting -> the counting method for the number of years to be simulated (0 = "only PEM runs count"; any other values = "PCM runs are taken into account"). The former option is the PEM default use;
     10      (v)   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.
    1011  The script can take an argument:
    1112      - If there is no argument, then the script initiates a PEM simulation from scratch.
  • trunk/LMDZ.COMMON/libf/evolution/deftank/launchPEM.sh

    r3537 r3556  
    2323nPCM=2
    2424
     25# Set the counting method for the number of years to be simulated (0 = "only PEM runs count"; any other values = "PCM runs are taken into account"):
     26counting=0
     27
    2528# 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:
    2629mode=1
     
    3841
    3942source lib_launchPEM.sh
     43export counting mode
    4044
    4145if [ $# -eq 0 ]; then
     
    4852    checklaunch
    4953    initlaunch
    50     cyclelaunch $mode $nPCM_ini
     54    cyclelaunch $mode $counting $nPCM_ini
    5155
    5256else
     
    6165        fi
    6266        read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt
    63         cyclelaunch $mode $nPCM
     67        cyclelaunch $mode $counting $nPCM
    6468
    6569    # Starting a relaunch
     
    122126        fi
    123127        if [ $relaunch = "PCM" ]; then
    124             relaunchPCM $mode
     128            relaunchPCM $mode $counting
    125129        else
    126             relaunchPEM $mode
     130            relaunchPEM $mode $counting
    127131        fi
    128132
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3538 r3556  
    160160# To submit the PCM runs
    161161# arg1: launching mode
    162 # arg2: number of PCM runs to launch
    163 # arg3: local number of the PCM run from which to start (optional)
     162# arg2: counting method
     163# arg3: number of PCM runs to launch
     164# arg4: local number of the PCM run from which to start (optional)
    164165submitPCM() {
    165166    find . -type f -name "PCMrun*.job" ! -name "PCMrun.job" -delete
    166167    ii=1
    167     if [ ! -z $3 ]; then
    168         ii=$3
     168    if [ ! -z $4 ]; then
     169        ii=$4
    169170    fi
    170171    if [ $(echo "$i_myear < $n_myear" | bc -l) -eq 1 ]; then
    171         echo "Run PCM $iPCM: call $ii/$2..."
     172        echo "Run PCM $iPCM: call $ii/$3..."
    172173        if [ $1 -eq 0 ]; then # Mode: processing scripts
    173174            sed -i "s/^k=[0-9]\+$/k=$(echo "3 - $nPCM_ini" | bc)/" PCMrun.job
     
    187188        fi
    188189        ((iPCM++))
    189         i_myear=$(echo "$i_myear + 1." | bc -l)
     190        if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     191            i_myear=$(echo "$i_myear + 1." | bc -l)
     192        fi
    190193        ((ii++))
    191194    else
    192195        endlaunch
    193196    fi
    194     for ((i = $ii; i <= $2; i++)); do
     197    for ((i = $ii; i <= $3; i++)); do
    195198        if [ $(echo "$i_myear < $n_myear" | bc -l) -eq 1 ]; then
    196             echo "Run PCM $iPCM: call $i/$2..."
     199            echo "Run PCM $iPCM: call $i/$3..."
    197200            if [ $1 -eq 0 ]; then # Mode: processing scripts
    198201                sed -i "s/^k=[0-9]\+$/k=$(echo "$i + 2 - $nPCM_ini" | bc)/" PCMrun.job
     
    209212            fi
    210213            ((iPCM++))
    211             i_myear=$(echo "$i_myear + 1." | bc -l)
     214            if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     215                i_myear=$(echo "$i_myear + 1." | bc -l)
     216            fi
    212217        else
    213218            endlaunch
     
    241246# To make one cycle of PCM and PEM runs
    242247# arg1: launching mode
    243 # arg2: number of PCM runs to launch
    244 # arg3: local number of the PCM run from which to start (optional)
     248# arg2: counting method
     249# arg3: number of PCM runs to launch
     250# arg4: local number of the PCM run from which to start (optional)
    245251cyclelaunch() {
    246252    # PCM runs
    247     submitPCM $1 $2 $3
     253    submitPCM $1 $2 $3 $4
    248254
    249255    # PEM run
     
    292298# To relaunch from PCM run
    293299# arg1: launching mode
     300# arg2: counting method
    294301relaunchPCM() {
    295302    iPCM=$(($irelaunch + 1))
     
    310317        # PCM relaunch during the initialization cycle
    311318        iPEM=1
     319        if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     320            i_myear=$irelaunch
     321        else # Counting: only PEM runs count
     322            i_myear=0
     323        fi
     324        sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
    312325        cleanfiles diags/diagpem .nc $(($iPEM - 1))
    313326        cleanfiles diags/diagsoilpem .nc $(($iPEM - 1))
     
    317330        cleanfiles starts/restartfi_postPEM .nc $(($iPEM - 1))
    318331        cleanfiles starts/restartpem .nc $(($iPEM - 1))
    319         i_myear=$irelaunch
    320         sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
    321332        rm -f startpem.nc
    322333        if [ $irelaunch -eq $(($nPCM_ini - 1)) ]; then
    323334            cp diags/data2reshape${irelaunch}.nc data2reshape_Y1.nc
    324             cyclelaunch $1 $nPCM_ini $iPCM
     335            cyclelaunch $1 $2 $nPCM_ini $iPCM
    325336        elif [ $irelaunch -eq $nPCM_ini ]; then
    326337            cp diags/data2reshape$(($irelaunch - 1)).nc data2reshape_Y1.nc
     
    328339            submitPEM $1 # The next job is a PEM run
    329340        else
    330             cyclelaunch $1 $nPCM_ini $iPCM
     341            cyclelaunch $1 $2 $nPCM_ini $iPCM
    331342        fi
    332343    else
     
    334345        iPEM=$(echo "($iPCM - $nPCM_ini)/$nPCM + 1" | bc)
    335346        il=$(echo "($irelaunch - $nPCM_ini + 1)%$nPCM + 1" | bc)
     347        if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     348            i_myear=$(($(awk "NR==$iPEM {print \$3}" "info_PEM.txt") + $il))
     349        else # Counting: only PEM runs count
     350            i_myear=$(awk "NR==$iPEM {print \$3}" "info_PEM.txt")
     351        fi
     352        sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
    336353        cleanfiles diags/diagpem .nc $(($iPEM - 1))
    337354        cleanfiles diags/diagsoilpem .nc $(($iPEM - 1))
     
    343360        cp starts/restartpem$(($iPEM - 1)).nc startpem.nc
    344361        if [ $il -eq $(($nPCM - 1)) ]; then # Second to last PCM run
    345             i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $il))
    346             sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
    347362            cp diags/data2reshape${irelaunch}.nc data2reshape_Y1.nc
    348             cyclelaunch $1 $nPCM $il
     363            cyclelaunch $1 $2 $nPCM $il
    349364        elif [ $il -eq $nPCM ]; then # Last PCM run so the next job is a PEM run
    350             i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $nPCM))
    351             sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
    352365            cp diags/data2reshape$(($irelaunch - 1)).nc data2reshape_Y1.nc
    353366            cp diags/data2reshape${irelaunch}.nc data2reshape_Y2.nc
    354367            submitPEM $1
    355368        else
    356             i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $il))
    357             sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
    358             cyclelaunch $1 $nPCM $il
     369            cyclelaunch $1 $2 $nPCM $il
    359370        fi
    360371    fi
     
    363374# To relaunch from PEM run
    364375# arg1: launching mode
     376# arg2: counting method
    365377relaunchPEM() {
    366378    iPEM=$(echo "$irelaunch + 1" | bc)
    367379    iPCM=$(echo "$nPCM_ini + $nPCM*($irelaunch - 1) + 1" | bc)
    368     i_myear=$(awk "NR==$(($iPEM + 1)) {print \$1}" "info_PEM.txt")
     380    i_myear=$(awk "NR==$(($iPEM + 1)) {print \$3}" "info_PEM.txt")
    369381    sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
    370382    cleanfiles diags/diagfi .nc $(($iPCM - 1))
     
    389401        cp starts/restart1D_postPEM${irelaunch}.txt start1D.txt
    390402    fi
    391     cyclelaunch $1 $nPCM
    392 }
     403    cyclelaunch $1 $2 $nPCM
     404}
  • trunk/LMDZ.COMMON/libf/evolution/evol_ice_mod.F90

    r3554 r3556  
    7373integer,                intent(in) :: ngrid, nslope            ! # of grid points, # of subslopes
    7474real, dimension(ngrid), intent(in) :: cell_area                ! Area of each mesh grid (m^2)
    75 real, dimension(ngrid), intent(in) :: delta_h2o_adsorbed      ! Mass of H2O adsorbed/desorbded in the soil (kg/m^2)
     75real, dimension(ngrid), intent(in) :: delta_h2o_adsorbed       ! Mass of H2O adsorbed/desorbded in the soil (kg/m^2)
    7676real, dimension(ngrid), intent(in) :: delta_h2o_icetablesublim ! Mass of H2O that have condensed/sublimated at the ice table (kg/m^2)
    7777
Note: See TracChangeset for help on using the changeset viewer.