Changeset 3214 for trunk/LMDZ.COMMON/libf/evolution/deftank
- Timestamp:
- Feb 12, 2024, 5:37:25 PM (17 months ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution/deftank
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/deftank/concat_diagpem.sh
r3210 r3214 10 10 ecritpem=1 11 11 12 # Number of initial PCM calls 13 nPCM_ini=4 14 12 15 # Number of GCM calls between each PEM call 13 n GCM=216 nPCM=2 14 17 15 18 # List of NetCDF files to concatenate … … 34 37 35 38 # Loop to concatenate the NetCDF files 36 newTime=$((n GCM+ 1))39 newTime=$((nPCM_ini + 1)) 37 40 for file in "${files[@]}"; do 38 41 # Extract the 'Time' variable into a temporary file … … 61 64 ncrcat -O $output_file $file -o $output_file 62 65 fi 63 newTime=$((newTime + n GCM))66 newTime=$((newTime + nPCM)) 64 67 done 65 68 -
trunk/LMDZ.COMMON/libf/evolution/deftank/launch_pem.sh
r3210 r3214 25 25 #---------- Modify here the number of years to be simulated ------------ 26 26 ## set the number of years, either Martian or Earth years: 27 n_mars_years=1000000 28 #n_earth_years=1000000 27 n_mars_years=1000 28 #n_earth_years=300 29 30 #------------- Modify here the number of initial PCM calls ------------- 31 ## set the number of initial PCM calls between each PEM call: 32 nPCM_ini=4 29 33 30 34 #---------------- Modify here the number of PCM calls ------------------ … … 130 134 echo $i_myear $n_myear $convert_years > info_PEM.txt 131 135 136 #-------------------------- Initial PCM runs --------------------------- 137 cp run_PCM.def run.def 138 for ((i = 1; i <= $nPCM_ini; i++)); do 139 echo "Run PCM $iPCM (initial): call $i/$nPCM_ini..." 140 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh 141 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh 142 sbatch -W exePCM.sh 143 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally 144 echo "Error: the run PCM $iPCM crashed!" 145 exit 1 146 fi 147 # Copy data files and prepare the next run 148 mv out_runPCM${iPCM} out_PCM/run${iPCM} 149 mv diagfi.nc diags/diagfi${iPCM}.nc 150 if [ -f "diagsoil.nc" ]; then 151 mv diagsoil.nc diags/diagsoil${iPCM}.nc 152 fi 153 if [ -f "stats.nc" ]; then 154 mv stats.nc diags/stats${iPCM}.nc 155 fi 156 k=$(echo "$i + 2 - $nPCM_ini" | bc -l) 157 if [$(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM 158 mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc 159 else 160 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc 161 mv Xdiurnalave.nc data2reshape_Y${k}.nc 162 fi 163 cp restartfi.nc starts/startfi${iPCM}.nc 164 mv restartfi.nc startfi.nc 165 if [ -f "restart.nc" ]; then 166 cp restart.nc starts/restart${iPCM}.nc 167 mv restart.nc start.nc 168 elif [ -f "restart1D.txt" ]; then 169 cp restart1D.txt starts/restart1D${iPCM}.txt 170 mv restart1D.txt start1D.txt 171 fi 172 ((iPCM++)) 173 ((i_myear++)) 174 echo "Done!" 175 done 176 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt 177 132 178 #---------------------- Main loop to call PEM/PCM ---------------------- 133 179 while [ $i_myear -lt $n_myear ]; do 134 #--- Loop to run PCM year by year135 cp run_PCM.def run.def136 for ((i = 1; i <= $nPCM; i++)); do137 echo "Run PCM $iPCM: call $i/$nPCM..."138 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh139 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh140 sbatch -W exePCM.sh141 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally142 echo "Error: the run PCM $iPCM has crashed!"143 exit 1144 fi145 # Copy data files and prepare the next run146 mv out_runPCM${iPCM} out_PCM/run${iPCM}147 mv diagfi.nc diags/diagfi${iPCM}.nc148 if [ -f "diagsoil.nc" ]; then149 mv diagsoil.nc diags/diagsoil${iPCM}.nc150 fi151 if [ -f "stats.nc" ]; then152 mv stats.nc diags/stats${iPCM}.nc153 fi154 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc155 mv Xdiurnalave.nc data2reshape${i}.nc156 cp restartfi.nc starts/startfi${iPCM}.nc157 mv restartfi.nc startfi.nc158 if [ -f "restart.nc" ]; then159 cp restart.nc starts/restart${iPCM}.nc160 mv restart.nc start.nc161 elif [ -f "restart1D.txt" ]; then162 cp restart1D.txt starts/restart1D${iPCM}.txt163 mv restart1D.txt start1D.txt164 fi165 ((iPCM++))166 ((i_myear++))167 echo "Done!"168 done169 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt170 171 180 #--- Reshaping PCM data with XIOS 172 181 echo "Reshaping PCM data with XIOS..." … … 185 194 ./$exePEM > out_runPEM${iPEM} 2>&1 186 195 if [ ! -f "restartfi_evol.nc" ]; then # Check if run ended abnormally 187 echo "Error: the run PEM $iPEM hascrashed!"196 echo "Error: the run PEM $iPEM crashed!" 188 197 exit 1 189 198 fi … … 191 200 mv out_runPEM${iPEM} out_PEM/run${iPEM} 192 201 mv diagpem.nc diags/diagpem${iPEM}.nc 193 mv diagsoilpem.nc diags/diagsoilpem${iPEM}.nc 202 if [ -f "diagsoilpem.nc" ]; then 203 mv diagsoilpem.nc diags/diagsoilpem${iPEM}.nc 204 fi 194 205 cp restartpem.nc starts/startpem${iPEM}.nc 195 206 mv restartpem.nc startpem.nc … … 206 217 read i_myear n_myear convert_years < info_PEM.txt 207 218 echo "Done!" 219 220 #--- Loop to run PCM year by year 221 cp run_PCM.def run.def 222 for ((i = 1; i <= $nPCM; i++)); do 223 echo "Run PCM $iPCM: call $i/$nPCM..." 224 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh 225 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh 226 sbatch -W exePCM.sh 227 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally 228 echo "Error: the run PCM $iPCM crashed!" 229 exit 1 230 fi 231 # Copy data files and prepare the next run 232 mv out_runPCM${iPCM} out_PCM/run${iPCM} 233 mv diagfi.nc diags/diagfi${iPCM}.nc 234 if [ -f "diagsoil.nc" ]; then 235 mv diagsoil.nc diags/diagsoil${iPCM}.nc 236 fi 237 if [ -f "stats.nc" ]; then 238 mv stats.nc diags/stats${iPCM}.nc 239 fi 240 k=$(echo "$i + 2 - $nPCM" | bc -l) 241 if [$(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM 242 mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc 243 else 244 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc 245 mv Xdiurnalave.nc data2reshape_Y${k}.nc 246 fi 247 cp restartfi.nc starts/startfi${iPCM}.nc 248 mv restartfi.nc startfi.nc 249 if [ -f "restart.nc" ]; then 250 cp restart.nc starts/restart${iPCM}.nc 251 mv restart.nc start.nc 252 elif [ -f "restart1D.txt" ]; then 253 cp restart1D.txt starts/restart1D${iPCM}.txt 254 mv restart1D.txt start1D.txt 255 fi 256 ((iPCM++)) 257 ((i_myear++)) 258 echo "Done!" 259 done 260 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt 208 261 done 209 262 … … 212 265 213 266 date 214 echo "The launching script has terminated."267 echo "The launching script ended."
Note: See TracChangeset
for help on using the changeset viewer.