Ignore:
Timestamp:
Nov 12, 2025, 5:02:00 PM (11 days ago)
Author:
jbclement
Message:

PEM:
Checking if a PCM run length is one Martian year + Changing instruction from "run" to "year" to be clearer.
JBC

Location:
trunk/LMDZ.COMMON/libf/evolution/deftank
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/deftank/README

    r3938 r3958  
    2727    3) [dimensions]: 64x48x54 to define the grid you want to use  (longitude x latitude x atmospheric layers).
    2828To run the PEM, you need a dedicated reshaping tool with consistent options. To compile it, in "LMDZ_COMMON", do: ./makelmdz_fcm -arch [local] -p [planet] -d [dimensions] -j 8 reshape_XIOS_output
    29 To run the PEM, you also need a PCM working with XIOS and consistent options. To compile it, in "LMDZ.COMMON", do: ./makelmdz_fcm -arch [local] -p [planet] -parallel mpi_omp -io XIOS -d [dimensions] -j 8 gcm
     29To run the PEM, you also need a PCM working with XIOS and consistent options. To compile it, in "LMDZ.COMMON", do: ./makelmdz_fcm -arch [local] -p [planet] -parallel mpi_omp -io xios -d [dimensions] -j 8 gcm
    3030After compilation, the executable file can be found in the "bin" sub-directory.
    3131
     
    7575  The user has to specify:
    7676      > n_mars_years, n_earth_years -> the number of Mars/Earth years to be simulated in total (> 0);
    77       > nPCM_ini -> the number of initial PCM runs (>= 2);
    78       > nPCM -> the number of PCM runs between each PEM run (>= 2, usually 2);
    79       > 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 usual one;
     77      > nPCM_ini -> the number of initial PCM years (>= 2);
     78      > nPCM -> the number of PCM years between each PEM run (>= 2, usually 2);
     79      > 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;
    8080      > 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.
    8181  The script can take an argument:
  • trunk/LMDZ.COMMON/libf/evolution/deftank/launchPEM.sh

    r3938 r3958  
    1818#n_earth_years=300.
    1919
    20 # Set the number of initial PCM runs (>= 2):
     20# Set the number of initial PCM years (>= 2):
    2121nPCM_ini=3
    2222
    23 # Set the number of PCM runs between each PEM run (>= 2):
     23# Set the number of PCM years between each PEM run (>= 2):
    2424nPCM=2
    2525
    26 # 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"). The former option is the usual one:
     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:
    2727counting=0
    2828
     
    117117        convertyears
    118118        if [ $nPCM_ini -ne $nPCM_ini_old ]; then
    119             echo "The number of initial PCM runs has been modified from $nPCM_ini_old to $nPCM_ini."
     119            echo "The number of initial PCM years has been modified from $nPCM_ini_old to $nPCM_ini."
    120120        fi
    121121        if [ $nPCM -ne $nPCM_old ]; then
    122             echo "The number of PCM runs between each PEM run has been modified from $nPCM_old to $nPCM."
     122            echo "The number of PCM years between each PEM run has been modified from $nPCM_old to $nPCM."
    123123        fi
    124124        if [ "$(echo "$n_myear != $n_myear_old" | bc)" -eq 1 ]; then
    125             echo "The number of initial PCM runs has been modified from $n_myear_old to $n_myear."
     125            echo "The number of initial PCM years has been modified from $n_myear_old to $n_myear."
    126126        fi
    127127        sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3909 r3958  
    135135}
    136136
     137# To check if a PCM run is one year
     138check_runyear() {
     139    if [ -f "run_PCM.def" ]; then
     140        year_sol=$(ncdump -v controle startfi.nc 2>/dev/null | \
     141                   sed -n '/controle =/,/;/p' | tr -d '[:space:]' | \
     142                   sed 's/.*=//; s/;//' | tr ',' '\n' | sed -n '14p')
     143    else
     144        year_sol=669 # Length of Martian year (sols)
     145    fi
     146    sol_in_file=$(awk -F'=' '/^[[:space:]]*(nday|ndt)[[:space:]]*=/ {
     147                  val=$2
     148                  gsub(/^[[:space:]]+|[[:space:]]+$/,"",val)
     149                  print val
     150                  exit
     151                  }' run_PCM.def)
     152
     153    if [ -z "$sol_in_file" ]; then
     154        echo "Error: no length of year found in \"run_PCM.def\"!"
     155        errlaunch
     156    elif [ "$sol_in_file" -eq "$year_sol" ]; then
     157        # Good: we do nothing
     158        :
     159    else
     160        echo "Error: length of year mismatch between \"run_PCM.def\" ($sol_in_file) and \"startfi.nc\" ($year_sol)!"
     161        errlaunch
     162    fi
     163}
     164
    137165# To check if everything necessary for the launching script is ok
    138166checklaunch() {
     
    210238    get_nslope
    211239    modify_xml
     240    # Check if a PCM run is one year
     241    check_runyear
    212242}
    213243
     
    284314        fi
    285315        ((iPCM++))
    286         if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     316        if [ $2 -ne 0 ]; then # Counting: PCM years taken into account
    287317            i_myear=$(echo "$i_myear + 1." | bc -l)
    288318        fi
     
    312342            fi
    313343            ((iPCM++))
    314             if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     344            if [ $2 -ne 0 ]; then # Counting: PCM years taken into account
    315345                i_myear=$(echo "$i_myear + 1." | bc -l)
    316346            fi
     
    425455        # PCM relaunch during the initialization cycle
    426456        iPEM=1
    427         if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     457        if [ $2 -ne 0 ]; then # Counting: PCM years taken into account
    428458            i_myear=$irelaunch
    429         else # Counting: only PEM runs count
     459        else # Counting: only PEM years count
    430460            i_myear=0
    431461        fi
     
    456486        iPEM=$(echo "($iPCM - $nPCM_ini)/$nPCM + 1" | bc)
    457487        il=$(echo "($irelaunch - $nPCM_ini + 1)%$nPCM + 1" | bc)
    458         if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account
     488        if [ $2 -ne 0 ]; then # Counting: PCM years taken into account
    459489            i_myear=$(echo "$(awk "NR==$iPEM {printf \"%s\n\", \$3}" "info_PEM.txt") + $il" | bc -l)
    460         else # Counting: only PEM runs count
     490        else # Counting: only PEM years count
    461491            i_myear=$(awk "NR==$iPEM {printf \"%s\n\", \$3}" "info_PEM.txt")
    462492        fi
Note: See TracChangeset for help on using the changeset viewer.