Changeset 3766 for trunk/LMDZ.MARS/deftank/run0
- Timestamp:
- May 15, 2025, 6:26:24 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/deftank/run0
r1005 r3766 1 1 #!/bin/bash 2 ######################################################################## ###2 ######################################################################## 3 3 # Script to perform several chained LMD Mars GCM simulations 4 4 # SET HERE the maximum total number of simulations … … 6 6 nummax=1 7 7 8 ########################################################################### 9 8 # Also, ensure that the gcm executable name is correct below: 9 gcm=gcm.e 10 # 11 ######################################################################## 12 set -x 10 13 11 14 echo "---------------------------------------------------------" 12 echo " starting run0"15 echo "Starting run0..." 13 16 14 17 dir=`pwd` … … 16 19 address=`whoami` 17 20 18 # Look for file "num_run" which should contain 21 # Check if GCM executable exists and is executable 22 if [ ! -x $gcm ]; then 23 echo "Error: file \"$gcm\" not found or not executable in $dir!" 24 exit 1 25 fi 26 27 # Look for file "num_run" which should contain 19 28 # the value of the previously computed season 20 29 # (defaults to 0 if file "num_run" does not exist) 21 30 if [[ -r num_run ]] ; then 22 echo " found file num_run"31 echo "Found file \"num_run\"" 23 32 numold=`cat num_run` 24 33 else 25 34 numold=0 26 35 fi 27 echo "numold is set to" $ {numold}36 echo "numold is set to" $numold 28 37 29 30 # Set value of current season 31 (( numnew = ${numold} + 1 )) 32 echo "numnew is set to" ${numnew} 38 # Set value of current season 39 numnew=$((numold + 1 )) 40 echo "numnew is set to" $numnew 33 41 34 42 # Look for initialization data files (exit if none found) … … 37 45 \cp -f startfi${numold}.nc startfi.nc 38 46 else 39 if (( ${numold}== 99999 )) ; then40 echo "No run because previous run crashed ! (99999 in num_run)"41 exit47 if (( numold == 99999 )) ; then 48 echo "Error: no run because previous run crashed! (99999 in \"num_run\")" 49 exit 1 42 50 else 43 echo "Where is file start"${numold}".nc??"44 exit51 echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!" 52 exit 1 45 53 fi 46 54 fi … … 48 56 49 57 # Run GCM 50 gcm.e> lrun${numnew}58 ./$gcm > lrun${numnew} 51 59 52 60 53 61 # Check if run ended normaly and copy datafiles 54 62 if [[ ( -r restartfi.nc && -r restart.nc ) ]] ; then 55 echo "Run seems to have ended normal y"63 echo "Run seems to have ended normally." 56 64 \mv -f restartfi.nc startfi${numnew}.nc 57 65 \mv -f restart.nc start${numnew}.nc 58 66 else 67 echo "Error: Run crashed or incomplete output!" 59 68 if [[ -r num_run ]] ; then 60 69 \mv -f num_run num_run.crash 61 70 else 62 echo "No file num_run to build num_run.crash from !!"71 echo "No file num_run to build \"num_run.crash\" from!" 63 72 # Impose a default value of 0 for num_run 64 73 echo 0 > num_run.crash 65 74 fi 66 echo 99999 > num_run75 echo 99999 > num_run 67 76 ############## To receive an Email message if the run crashes ######## 68 mail -s "crash run GCM" $address <<ENDMAIL 69 The run on $machine in $dir has just crashed. 77 mail -s "Crash in GCM run" $address <<ENDMAIL 78 The GCM run on $machine in $dir has just crashed. 79 Check the output logs for more information. 70 80 ENDMAIL 71 ############################################ ""72 exit81 ############################################# 82 exit 1 73 83 fi 74 84 … … 90 100 # Prepare things for upcoming runs by writing 91 101 # value of computed season in file num_run 92 echo $ {numnew}> num_run102 echo $numnew > num_run 93 103 94 104 # If we are over nummax : stop 95 105 if (( $numnew + 1 > $nummax )) ; then 96 exit106 exit 0 97 107 else 98 \cp -f run0 exe_mars 99 ./exe_mars 100 fi 101 102 108 \cp -f run0 exe_mars 109 ./exe_mars 110 fi
Note: See TracChangeset
for help on using the changeset viewer.