- Timestamp:
- Apr 8, 2024, 2:25:58 PM (8 months ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r3287 r3296 262 262 - Small correction to make the 3D PEM be able to compile. 263 263 - Improvement of "launch_pem.sh": a file "kill_launch_pem.sh" is now automatically created which allows the user to kill the process of the launching script in case. 264 265 == 08/04/2024 == JBC 266 Correction of "launch_pem.sh" in the deftank: the number of years to be simulated was not respected because of extra PCM runs at the end of the simulation due to the order of PCM/PEM runs inside the loop. -
trunk/LMDZ.COMMON/libf/evolution/deftank/launch_pem.sh
r3287 r3296 139 139 echo $i_myear $n_myear $convert_years > info_PEM.txt 140 140 141 #-------------------------- Initial PCM runs --------------------------- 141 #---------------------------- Initial runs ----------------------------- 142 #--- Initial PCM runs 142 143 cp run_PCM.def run.def 143 144 for ((i = 1; i <= $nPCM_ini; i++)); do … … 181 182 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt 182 183 184 #--- Reshaping PCM data with XIOS 185 echo "Reshaping PCM data with XIOS..." 186 ./$exeReshape 187 echo "Done!" 188 189 #--- Running PEM 190 echo "Run PEM $iPEM..." 191 cp run_PEM.def run.def 192 mv startfi.nc startfi_evol.nc 193 if [ -f "start.nc" ]; then 194 mv start.nc start_evol.nc 195 elif [ -f "start1D.txt" ]; then 196 mv start1D.txt start1D_evol.txt 197 fi 198 ./$exePEM > out_runPEM${iPEM} 2>&1 199 if [ ! -f "restartfi_evol.nc" ]; then # Check if run ended abnormally 200 echo "Error: the run PEM $iPEM crashed!" 201 exit 1 202 fi 203 # Copy data files and prepare the next run 204 mv out_runPEM${iPEM} out_PEM/run${iPEM} 205 mv diagpem.nc diags/diagpem${iPEM}.nc 206 if [ -f "diagsoilpem.nc" ]; then 207 mv diagsoilpem.nc diags/diagsoilpem${iPEM}.nc 208 fi 209 cp restartpem.nc starts/startpem${iPEM}.nc 210 mv restartpem.nc startpem.nc 211 cp restartfi_evol.nc starts/startfi_postPEM${iPEM}.nc 212 mv restartfi_evol.nc startfi.nc 213 if [ -f "restart_evol.nc" ]; then 214 cp restart_evol.nc starts/restart_postPEM${iPEM}.nc 215 mv restart_evol.nc start.nc 216 elif [ -f "restart1D_evol.txt" ]; then 217 cp restart1D_evol.txt starts/restart1D_postPEM${iPEM}.txt 218 mv restart1D_evol.txt start1D.txt 219 fi 220 ((iPEM++)) 221 read i_myear n_myear convert_years < info_PEM.txt 222 echo "Done!" 223 183 224 #---------------------- Main loop to call PEM/PCM ---------------------- 184 225 while [ $i_myear -lt $n_myear ]; do 226 #--- Loop to run PCM year by year 227 cp run_PCM.def run.def 228 for ((i = 1; i <= $nPCM; i++)); do 229 echo "Run PCM $iPCM: call $i/$nPCM..." 230 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh 231 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh 232 sbatch -W exePCM.sh 233 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally 234 echo "Error: the run PCM $iPCM crashed!" 235 exit 1 236 fi 237 # Copy data files and prepare the next run 238 mv out_runPCM${iPCM} out_PCM/run${iPCM} 239 mv diagfi.nc diags/diagfi${iPCM}.nc 240 if [ -f "diagsoil.nc" ]; then 241 mv diagsoil.nc diags/diagsoil${iPCM}.nc 242 fi 243 if [ -f "stats.nc" ]; then 244 mv stats.nc diags/stats${iPCM}.nc 245 fi 246 k=$(echo "$i + 2 - $nPCM" | bc -l) 247 if [ $(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM 248 mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc 249 else 250 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc 251 mv Xdiurnalave.nc data2reshape_Y${k}.nc 252 fi 253 cp restartfi.nc starts/startfi${iPCM}.nc 254 mv restartfi.nc startfi.nc 255 if [ -f "restart.nc" ]; then 256 cp restart.nc starts/restart${iPCM}.nc 257 mv restart.nc start.nc 258 elif [ -f "restart1D.txt" ]; then 259 cp restart1D.txt starts/restart1D${iPCM}.txt 260 mv restart1D.txt start1D.txt 261 fi 262 ((iPCM++)) 263 ((i_myear++)) 264 echo "Done!" 265 done 266 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt 267 185 268 #--- Reshaping PCM data with XIOS 186 269 echo "Reshaping PCM data with XIOS..." … … 222 305 read i_myear n_myear convert_years < info_PEM.txt 223 306 echo "Done!" 224 225 #--- Loop to run PCM year by year226 cp run_PCM.def run.def227 for ((i = 1; i <= $nPCM; i++)); do228 echo "Run PCM $iPCM: call $i/$nPCM..."229 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh230 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh231 sbatch -W exePCM.sh232 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally233 echo "Error: the run PCM $iPCM crashed!"234 exit 1235 fi236 # Copy data files and prepare the next run237 mv out_runPCM${iPCM} out_PCM/run${iPCM}238 mv diagfi.nc diags/diagfi${iPCM}.nc239 if [ -f "diagsoil.nc" ]; then240 mv diagsoil.nc diags/diagsoil${iPCM}.nc241 fi242 if [ -f "stats.nc" ]; then243 mv stats.nc diags/stats${iPCM}.nc244 fi245 k=$(echo "$i + 2 - $nPCM" | bc -l)246 if [ $(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM247 mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc248 else249 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc250 mv Xdiurnalave.nc data2reshape_Y${k}.nc251 fi252 cp restartfi.nc starts/startfi${iPCM}.nc253 mv restartfi.nc startfi.nc254 if [ -f "restart.nc" ]; then255 cp restart.nc starts/restart${iPCM}.nc256 mv restart.nc start.nc257 elif [ -f "restart1D.txt" ]; then258 cp restart1D.txt starts/restart1D${iPCM}.txt259 mv restart1D.txt start1D.txt260 fi261 ((iPCM++))262 ((i_myear++))263 echo "Done!"264 done265 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt266 307 done 267 308
Note: See TracChangeset
for help on using the changeset viewer.