Ignore:
Timestamp:
Oct 23, 2023, 4:10:10 PM (22 months ago)
Author:
jbclement
Message:

PEM:
The management of files during the chained simulation of PCM/PEM runs has been simplified:

  • "tmp_PEMyears.txt" and "info_run_PEM.txt" have been merged into one file called "info_PEM.txt";
  • "reshape_XIOS_output.F90" now creates directly the "data_PCM_Y*.nc" files needed by the PEM;
  • where it is relevant, 'GCM' has been replaced by 'PCM' in the files naming;
  • the files in deftank have been updated consequently.

Following r3095, 'iniorbit' is now a subroutine of "planete_h.F90".
JBC

Location:
trunk/LMDZ.MARS/deftank/pem
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/deftank/pem/README

    r3093 r3096  
    22
    33# launch_pem.sh:
    4   Bash script file to launch the chained simulation of PEM and GCM runs.
     4  Bash script file to launch the chained simulation of PEM and PCM runs.
    55  The user has to specify:
    66      (i)   n_earth_years -> the number of Earth years to be simulated in total;
    7       (ii)  nGCM -> the number of GCM calls between PEM runs (usually nGCM=2);
     7      (ii)  nPCM -> the number of PCM calls between PEM runs (usually nPCM=2);
    88      (iii) exePEM -> the name of executable file for the PEM run;
    99      (iv)  exeReshape -> the name of executable file for the data reshaping task with XIOS.
    1010  The path to source the arch file should be adapted to the machine.
    1111
    12 # exeGCM.sh:
    13   Bash script file to run the GCM with a SLURM job. The name of the GCM executable file should be adapted. The header corresponds to the ADASTRA supercomputer and should be changed for other machines.
     12# exePCM.sh:
     13  Bash script file to run the PCM with a SLURM job. The name of the PCM executable file should be adapted. The header corresponds to the ADASTRA supercomputer and should be changed for other machines.
    1414
    1515# run_PEM.def
    1616  All the possible parameters to define a PEM run (read in "conf_pem.F90").
    17   It needs to be included in "run_GCM.def" with "INCLUDEDEF=run_PEM.def".
     17  It needs to be included in "run_PCM.def" with "INCLUDEDEF=run_PEM.def".
    1818
    1919# obl_ecc_lsp.asc
     
    2929  To run the chained simulation, be careful to have:
    3030      (i)   the xml files for XIOS. There should be "iodef.xml", "context_lmdz_physics.xml", "file_def_physics_mars.xml" and "field_def_physics_mars.xml" which can be found in the deftank folder. In "context_lmdz_physics.xml", the line for Xdiurnalave should be activated (enabled=".true.");
    31       (ii)  the usual def files to run the GCM. "run.def" should be renamed in "run_GCM.def";
     31      (ii)  the usual def files to run the PCM. "run.def" should be renamed in "run_PCM.def";
    3232      (iii  the starting files ("startfi.nc" and "start.nc"). The former can be modified by "modify_startfi_orbit.sh";
    3333      (iv)  some optional files. For example, "diagfi.def" and "diagpem.def".
  • trunk/LMDZ.MARS/deftank/pem/exePCM.sh

    r3095 r3096  
    11#!/bin/bash
    22#SBATCH --account=cin0391
    3 #SBATCH --job-name=runGCM1
     3#SBATCH --job-name=runPCM1
    44#SBATCH --constraint=GENOA
    55### GENOA nodes accommodate 96 cores
     
    1212#SBATCH --threads-per-core=1
    1313###SBATCH --exclusive
    14 #SBATCH --output=run_gcm_%A.out
     14#SBATCH --output=run_PCM_%A.out
    1515#SBATCH --time=10:00:00
    1616
    17 srun testphys1d_29_phymars_para.e > out_runGCM1 2>&1
     17srun testphys1d_29_phymars_para.e > out_runPCM1 2>&1
  • trunk/LMDZ.MARS/deftank/pem/launch_pem.sh

    r3093 r3096  
    11#!/bin/bash
    22#####################################################################
    3 ### Launching script for a chained simulation of PEM and GCM runs ###
     3### Launching script for a chained simulation of PEM and PCM runs ###
    44#####################################################################
    55
     
    2525n_earth_years=1000000
    2626
    27 #---------------- Modify here the number of GCM calls ------------------
    28 ## set the number of GCM calls between each PEM call:
    29 nGCM=2
     27#---------------- Modify here the number of PCM calls ------------------
     28## set the number of PCM calls between each PEM call:
     29nPCM=2
    3030
    3131#------------------ Modify here the name of PEM exe --------------------
     
    4545machine=`hostname`
    4646address=`whoami`
    47 if [ ! -f "exeGCM.sh" ]; then
    48     echo "Error: file \"exeGCM.sh\" does not exist in $dir!"
     47if [ ! -f "exePCM.sh" ]; then
     48    echo "Error: file \"exePCM.sh\" does not exist in $dir!"
    4949    exit 1
    5050fi
     
    5353    exit 1
    5454fi
    55 if [ ! -f "run_GCM.def" ]; then
    56     echo "Error: file \"run_GCM.def\" does not exist in $dir!"
     55if [ ! -f "run_PCM.def" ]; then
     56    echo "Error: file \"run_PCM.def\" does not exist in $dir!"
    5757    exit 1
    5858fi
     
    7373    exit 1
    7474fi
    75 if [ ! -d "out_GCM" ]; then
    76     mkdir out_GCM
     75if [ ! -d "out_PCM" ]; then
     76    mkdir out_PCM
    7777fi
    7878if [ ! -d "out_PEM" ]; then
     
    9090machine=`hostname`
    9191address=`whoami`
    92 echo "This is a chained simulation for PEM and GCM runs in $dir on $machine."
     92echo "This is a chained simulation for PEM and PCM runs in $dir on $machine."
    9393convert_years=$(echo "$myear/$eyear" | bc -l)
    9494convert_years=$(printf "%.4f" $convert_years) # Rounding to the 4th decimal to respect the precision of Martian year
     
    9797i_myear=0
    9898iPEM=1
    99 ((iGCM = ($iPEM - 1)*$nGCM + 1))
     99((iPCM = ($iPEM - 1)*$nPCM + 1))
    100100cp startfi.nc starts/
    101101if [ -f "start.nc" ]; then
     
    103103fi
    104104
    105 # Create a temporary file to manage years of the chained simulation
    106 echo $i_myear $n_myear $convert_years > tmp_PEMyears.txt
     105# Create a file to manage years of the chained simulation and store some info from the PEM runs
     106if [ -f "info_PEM.txt" ]; then
     107    rm info_PEM.txt
     108fi
     109echo $i_myear $n_myear $convert_years > info_PEM.txt
    107110
    108 #---------------------- Main loop to call PEM/GCM ----------------------
     111#---------------------- Main loop to call PEM/PCM ----------------------
    109112while [ $i_myear -lt $n_myear ]; do
    110     #--- Loop to run GCM year by year
    111     cp run_GCM.def run.def
    112     for ((i = 1; i <= $nGCM; i++)); do
    113         echo "Run GCM $iGCM: call $i/$nGCM..."
    114         sed -i "s/#SBATCH --job-name=runGCM.*/#SBATCH --job-name=runGCM${iGCM}/" exeGCM.sh
    115         sed -i "s/out_runGCM[0-9]\+/out_runGCM${iGCM}/" exeGCM.sh
    116         sbatch -W exeGCM.sh
     113    #--- Loop to run PCM year by year
     114    cp run_PCM.def run.def
     115    for ((i = 1; i <= $nPCM; i++)); do
     116        echo "Run PCM $iPCM: call $i/$nPCM..."
     117        sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh
     118        sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh
     119        sbatch -W exePCM.sh
    117120        if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally
    118             echo "Error: the run GCM $iGCM has crashed!"
     121            echo "Error: the run PCM $iPCM has crashed!"
    119122            exit 1
    120123        fi
    121124        # Copy data files and prepare the next run
    122         mv out_runGCM${iGCM} out_GCM/run${iGCM}
    123         mv diagfi.nc diags/diagfi${iGCM}.nc
     125        mv out_runPCM${iPCM} out_PCM/run${iPCM}
     126        mv diagfi.nc diags/diagfi${iPCM}.nc
    124127        if [ -f "diagsoil.nc" ]; then
    125             mv diagsoil.nc diags/diagsoil${iGCM}.nc
     128            mv diagsoil.nc diags/diagsoil${iPCM}.nc
    126129        fi
    127130        if [ -f "stats.nc" ]; then
    128             mv stats.nc diags/stats${iGCM}.nc
     131            mv stats.nc diags/stats${iPCM}.nc
    129132        fi
    130         cp Xdiurnalave.nc diags/data2reshape${iGCM}.nc
     133        cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc
    131134        mv Xdiurnalave.nc data2reshape${i}.nc
    132         cp restartfi.nc starts/startfi${iGCM}.nc
     135        cp restartfi.nc starts/startfi${iPCM}.nc
    133136        mv restartfi.nc startfi.nc
    134137        if [ -f "restart.nc" ]; then
    135             cp restart.nc starts/restart${iGCM}.nc
     138            cp restart.nc starts/restart${iPCM}.nc
    136139            mv restart.nc start.nc
    137140        elif [ -f "restart1D.txt" ]; then
    138             cp restart1D.txt starts/restart1D${iGCM}.txt
     141            cp restart1D.txt starts/restart1D${iPCM}.txt
    139142            mv restart1D.txt start1D.txt
    140143        fi
    141         ((iGCM++))
     144        ((iPCM++))
    142145        ((i_myear++))
    143146        echo "Done!"
    144147    done
    145     echo $i_myear $n_myear $convert_years > tmp_PEMyears.txt
    146     #--- Reshaping GCM data with XIOS
    147     echo "Reshaping GCM data with XIOS..."
     148    sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt
     149    #--- Reshaping PCM data with XIOS
     150    echo "Reshaping PCM data with XIOS..."
    148151    ./$exeReshape
    149     for file in datareshaped*; do
    150         mv $file ${file/reshaped/_GCM_Y}
    151     done
    152152    echo "Done!"
    153153    #--- Running PEM
     
    180180    fi
    181181    ((iPEM++))
    182     read i_myear n_myear convert_years < tmp_PEMyears.txt
     182    read i_myear n_myear convert_years < info_PEM.txt
    183183    echo "Done!"
    184184done
    185 
    186 # Delete the temporary file to manage years of the chained simulation
    187 rm tmp_PEMyears.txt
    188185
    189186# Restore the previous value of LC_NUMERIC
    190187LC_NUMERIC=$OLD_LC_NUMERIC
    191188
    192 #----------------- Preparation for relaunch if needed ------------------
    193 #echo "Reinitializing starting files..."
    194 #cp starts/startfi.nc .
    195 #for file in profiles/*_0; do
    196 #    cp $file ${file/_0/}
    197 #done
    198 #echo "Done!"
    199 
    200189date
    201190echo "The launching script has terminated."
Note: See TracChangeset for help on using the changeset viewer.