Changeset 3096 for trunk/LMDZ.MARS/deftank
- Timestamp:
- Oct 23, 2023, 4:10:10 PM (22 months ago)
- Location:
- trunk/LMDZ.MARS/deftank/pem
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/deftank/pem/README
r3093 r3096 2 2 3 3 # 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. 5 5 The user has to specify: 6 6 (i) n_earth_years -> the number of Earth years to be simulated in total; 7 (ii) n GCM -> 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); 8 8 (iii) exePEM -> the name of executable file for the PEM run; 9 9 (iv) exeReshape -> the name of executable file for the data reshaping task with XIOS. 10 10 The path to source the arch file should be adapted to the machine. 11 11 12 # exe GCM.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. 14 14 15 15 # run_PEM.def 16 16 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". 18 18 19 19 # obl_ecc_lsp.asc … … 29 29 To run the chained simulation, be careful to have: 30 30 (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"; 32 32 (iii the starting files ("startfi.nc" and "start.nc"). The former can be modified by "modify_startfi_orbit.sh"; 33 33 (iv) some optional files. For example, "diagfi.def" and "diagpem.def". -
trunk/LMDZ.MARS/deftank/pem/exePCM.sh
r3095 r3096 1 1 #!/bin/bash 2 2 #SBATCH --account=cin0391 3 #SBATCH --job-name=run GCM13 #SBATCH --job-name=runPCM1 4 4 #SBATCH --constraint=GENOA 5 5 ### GENOA nodes accommodate 96 cores … … 12 12 #SBATCH --threads-per-core=1 13 13 ###SBATCH --exclusive 14 #SBATCH --output=run_ gcm_%A.out14 #SBATCH --output=run_PCM_%A.out 15 15 #SBATCH --time=10:00:00 16 16 17 srun testphys1d_29_phymars_para.e > out_run GCM1 2>&117 srun testphys1d_29_phymars_para.e > out_runPCM1 2>&1 -
trunk/LMDZ.MARS/deftank/pem/launch_pem.sh
r3093 r3096 1 1 #!/bin/bash 2 2 ##################################################################### 3 ### Launching script for a chained simulation of PEM and GCM runs ###3 ### Launching script for a chained simulation of PEM and PCM runs ### 4 4 ##################################################################### 5 5 … … 25 25 n_earth_years=1000000 26 26 27 #---------------- Modify here the number of GCM calls ------------------28 ## set the number of GCM calls between each PEM call:29 n GCM=227 #---------------- Modify here the number of PCM calls ------------------ 28 ## set the number of PCM calls between each PEM call: 29 nPCM=2 30 30 31 31 #------------------ Modify here the name of PEM exe -------------------- … … 45 45 machine=`hostname` 46 46 address=`whoami` 47 if [ ! -f "exe GCM.sh" ]; then48 echo "Error: file \"exe GCM.sh\" does not exist in $dir!"47 if [ ! -f "exePCM.sh" ]; then 48 echo "Error: file \"exePCM.sh\" does not exist in $dir!" 49 49 exit 1 50 50 fi … … 53 53 exit 1 54 54 fi 55 if [ ! -f "run_ GCM.def" ]; then56 echo "Error: file \"run_ GCM.def\" does not exist in $dir!"55 if [ ! -f "run_PCM.def" ]; then 56 echo "Error: file \"run_PCM.def\" does not exist in $dir!" 57 57 exit 1 58 58 fi … … 73 73 exit 1 74 74 fi 75 if [ ! -d "out_ GCM" ]; then76 mkdir out_ GCM75 if [ ! -d "out_PCM" ]; then 76 mkdir out_PCM 77 77 fi 78 78 if [ ! -d "out_PEM" ]; then … … 90 90 machine=`hostname` 91 91 address=`whoami` 92 echo "This is a chained simulation for PEM and GCM runs in $dir on $machine."92 echo "This is a chained simulation for PEM and PCM runs in $dir on $machine." 93 93 convert_years=$(echo "$myear/$eyear" | bc -l) 94 94 convert_years=$(printf "%.4f" $convert_years) # Rounding to the 4th decimal to respect the precision of Martian year … … 97 97 i_myear=0 98 98 iPEM=1 99 ((i GCM = ($iPEM - 1)*$nGCM + 1))99 ((iPCM = ($iPEM - 1)*$nPCM + 1)) 100 100 cp startfi.nc starts/ 101 101 if [ -f "start.nc" ]; then … … 103 103 fi 104 104 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 106 if [ -f "info_PEM.txt" ]; then 107 rm info_PEM.txt 108 fi 109 echo $i_myear $n_myear $convert_years > info_PEM.txt 107 110 108 #---------------------- Main loop to call PEM/ GCM ----------------------111 #---------------------- Main loop to call PEM/PCM ---------------------- 109 112 while [ $i_myear -lt $n_myear ]; do 110 #--- Loop to run GCM year by year111 cp run_ GCM.def run.def112 for ((i = 1; i <= $n GCM; i++)); do113 echo "Run GCM $iGCM: call $i/$nGCM..."114 sed -i "s/#SBATCH --job-name=run GCM.*/#SBATCH --job-name=runGCM${iGCM}/" exeGCM.sh115 sed -i "s/out_run GCM[0-9]\+/out_runGCM${iGCM}/" exeGCM.sh116 sbatch -W exe GCM.sh113 #--- 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 117 120 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!" 119 122 exit 1 120 123 fi 121 124 # Copy data files and prepare the next run 122 mv out_run GCM${iGCM} out_GCM/run${iGCM}123 mv diagfi.nc diags/diagfi${i GCM}.nc125 mv out_runPCM${iPCM} out_PCM/run${iPCM} 126 mv diagfi.nc diags/diagfi${iPCM}.nc 124 127 if [ -f "diagsoil.nc" ]; then 125 mv diagsoil.nc diags/diagsoil${i GCM}.nc128 mv diagsoil.nc diags/diagsoil${iPCM}.nc 126 129 fi 127 130 if [ -f "stats.nc" ]; then 128 mv stats.nc diags/stats${i GCM}.nc131 mv stats.nc diags/stats${iPCM}.nc 129 132 fi 130 cp Xdiurnalave.nc diags/data2reshape${i GCM}.nc133 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc 131 134 mv Xdiurnalave.nc data2reshape${i}.nc 132 cp restartfi.nc starts/startfi${i GCM}.nc135 cp restartfi.nc starts/startfi${iPCM}.nc 133 136 mv restartfi.nc startfi.nc 134 137 if [ -f "restart.nc" ]; then 135 cp restart.nc starts/restart${i GCM}.nc138 cp restart.nc starts/restart${iPCM}.nc 136 139 mv restart.nc start.nc 137 140 elif [ -f "restart1D.txt" ]; then 138 cp restart1D.txt starts/restart1D${i GCM}.txt141 cp restart1D.txt starts/restart1D${iPCM}.txt 139 142 mv restart1D.txt start1D.txt 140 143 fi 141 ((i GCM++))144 ((iPCM++)) 142 145 ((i_myear++)) 143 146 echo "Done!" 144 147 done 145 echo $i_myear $n_myear $convert_years > tmp_PEMyears.txt146 #--- Reshaping GCM data with XIOS147 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..." 148 151 ./$exeReshape 149 for file in datareshaped*; do150 mv $file ${file/reshaped/_GCM_Y}151 done152 152 echo "Done!" 153 153 #--- Running PEM … … 180 180 fi 181 181 ((iPEM++)) 182 read i_myear n_myear convert_years < tmp_PEMyears.txt182 read i_myear n_myear convert_years < info_PEM.txt 183 183 echo "Done!" 184 184 done 185 186 # Delete the temporary file to manage years of the chained simulation187 rm tmp_PEMyears.txt188 185 189 186 # Restore the previous value of LC_NUMERIC 190 187 LC_NUMERIC=$OLD_LC_NUMERIC 191 188 192 #----------------- Preparation for relaunch if needed ------------------193 #echo "Reinitializing starting files..."194 #cp starts/startfi.nc .195 #for file in profiles/*_0; do196 # cp $file ${file/_0/}197 #done198 #echo "Done!"199 200 189 date 201 190 echo "The launching script has terminated."
Note: See TracChangeset
for help on using the changeset viewer.