Changeset 3766 for trunk/LMDZ.MARS/deftank/irene
- Timestamp:
- May 15, 2025, 6:26:24 PM (3 months ago)
- Location:
- trunk/LMDZ.MARS/deftank/irene
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/deftank/irene/run0
r2776 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 … … 9 9 gcm=gcm_64x48x73_phymars_para.e 10 10 # 11 ######################################################################## ###11 ######################################################################## 12 12 set -x 13 13 14 14 echo "---------------------------------------------------------" 15 echo " starting run0"15 echo "Starting run0..." 16 16 17 17 dir=`pwd` … … 19 19 address=`whoami` 20 20 21 # 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 22 28 # the value of the previously computed season 23 29 # (defaults to 0 if file "num_run" does not exist) 24 30 if [[ -r num_run ]] ; then 25 echo " found file num_run"31 echo "Found file \"num_run\"" 26 32 numold=`cat num_run` 27 33 else 28 34 numold=0 29 35 fi 30 echo "numold is set to" $ {numold}36 echo "numold is set to" $numold 31 37 32 33 # Set value of current season 34 (( numnew = ${numold} + 1 )) 35 echo "numnew is set to" ${numnew} 38 # Set value of current season 39 numnew=$((numold + 1 )) 40 echo "numnew is set to" $numnew 36 41 37 42 # Look for initialization data files (exit if none found) … … 40 45 \cp -f startfi${numold}.nc startfi.nc 41 46 else 42 if (( ${numold}== 99999 )) ; then43 echo "No run because previous run crashed ! (99999 in num_run)"44 exit47 if (( numold == 99999 )) ; then 48 echo "Error: no run because previous run crashed! (99999 in \"num_run\")" 49 exit 1 45 50 else 46 echo "Where is file start"${numold}".nc??"47 exit51 echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!" 52 exit 1 48 53 fi 49 54 fi … … 51 56 52 57 # Run GCM 53 ccc_mprun -l $gcm > lrun${numnew} 2>&1 58 ccc_mprun -l $gcm > lrun${numnew} 2>&1 54 59 55 60 56 61 # Check if run ended normaly and copy datafiles 57 62 if [[ ( -r restartfi.nc && -r restart.nc ) ]] ; then 58 echo "Run seems to have ended normal y"63 echo "Run seems to have ended normally." 59 64 \mv -f restartfi.nc startfi${numnew}.nc 60 65 \mv -f restart.nc start${numnew}.nc 61 66 else 67 echo "Error: Run crashed or incomplete output!" 62 68 if [[ -r num_run ]] ; then 63 69 \mv -f num_run num_run.crash 64 70 else 65 echo "No file num_run to build num_run.crash from !!"71 echo "No file num_run to build \"num_run.crash\" from!" 66 72 # Impose a default value of 0 for num_run 67 73 echo 0 > num_run.crash 68 74 fi 69 echo 99999 > num_run75 echo 99999 > num_run 70 76 ############## To receive an Email message if the run crashes ######## 71 mail -s "crash run GCM" $address <<ENDMAIL 72 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. 73 80 ENDMAIL 74 ############################################ ""75 exit81 ############################################# 82 exit 1 76 83 fi 77 84 … … 93 100 # Prepare things for upcoming runs by writing 94 101 # value of computed season in file num_run 95 echo $ {numnew}> num_run102 echo $numnew > num_run 96 103 97 104 # If we are over nummax : stop 98 105 if (( $numnew + 1 > $nummax )) ; then 99 exit106 exit 0 100 107 else 101 102 103 fi 108 \cp -f run0 exe_mars 109 ./exe_mars 110 fi -
trunk/LMDZ.MARS/deftank/irene/run_month1
r2816 r3766 23 23 #MSUB -x 24 24 25 ## Script to run chained simulations 26 ## (uses script "run0" and reference file "run.def.ref") 27 ## Set values of "num_now" and "num_end" in the script below 28 ## to set initial month # and final month # of the simulation 29 25 30 # A few parameters that might need be changed depending on your setup: 26 31 # Path to the arch.env to source 27 32 source ../trunk/LMDZ.COMMON/arch.env 28 # Number of threads to use (must be the same as "#MSUB -c" above) 33 # Number of threads to use (must be the same as "#MSUB -c" above) 29 34 export OMP_NUM_THREADS=5 30 35 export OMP_STACKSIZE=400M 36 # 37 ######################################################################## 38 set -exv 39 ls -al 40 trap 'echo -e "Error at line $LINENO!"' ERR 31 41 32 set -xv 33 ls -al 34 35 ## set starting month and ending month below: 42 # Set starting month and ending month below: 36 43 num_now=1 37 44 num_end=12 38 (( num_previous = $num_now - 1 ))45 num_previous=$(( num_now - 1 )) 39 46 40 47 echo "$num_previous" > num_run 41 48 # next month number 42 (( num_next = $num_now + 1 ))49 num_next=$(( num_now + 1 )) 43 50 # true (i.e. modulo 12) month number 44 (( true_num = $num_now % 12 ))51 true_num=$(( num_now % 12 )) 45 52 53 # Check if required files exist 46 54 \rm -f error; touch error 47 55 56 if [ ! -f run.def.ref ]; then 57 echo "Error: file \"run.def.ref\" not found in current directory!" > error 58 exit 1 59 fi 60 61 if [ ! -x run0 ]; then 62 echo "Error: file \"run0\" not found or not executable in current directory!" > error 63 exit 1 64 fi 65 66 if [ ! -f run_month$num_now ]; then 67 echo "Error: file \"run_month${num_now}\" not found in current directory!" > error 68 exit 1 69 fi 70 71 # Run model depending on current month 48 72 case $true_num in 49 1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;; #150 2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #251 3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #352 4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;; #453 5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;; #554 6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;; #655 7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;; #756 8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;; #857 9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #958 10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #1059 11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;; #1160 0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;; #1261 * ) echo " error";;73 1 ) sed s/9999/61/ run.def.ref > run.def ; ./run0 >> error ;; #1 74 2 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;; #2 75 3 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;; #3 76 4 ) sed s/9999/65/ run.def.ref > run.def ; ./run0 >> error ;; #4 77 5 ) sed s/9999/60/ run.def.ref > run.def ; ./run0 >> error ;; #5 78 6 ) sed s/9999/54/ run.def.ref > run.def ; ./run0 >> error ;; #6 79 7 ) sed s/9999/50/ run.def.ref > run.def ; ./run0 >> error ;; #7 80 8 ) sed s/9999/46/ run.def.ref > run.def ; ./run0 >> error ;; #8 81 9 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;; #9 82 10 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;; #10 83 11 ) sed s/9999/51/ run.def.ref > run.def ; ./run0 >> error ;; #11 84 0 ) sed s/9999/56/ run.def.ref > run.def ; ./run0 >> error ;; #12 85 * ) echo "Error: Invalid value of true_num ($true_num)" ; exit 1 ;; 62 86 esac 63 87 64 # launch job for next month65 if (( $num_next <= $num_end )) ; then88 # Launch job for next month 89 if (( num_next <= num_end )) ; then 66 90 cp -f run_month$num_now tmp 67 91 sed -e "s@run_month${num_now}@run_month${num_next}@" \ 68 92 -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next 69 93 rm tmp 70 71 94 ccc_msub run_month$num_next 72 95 fi
Note: See TracChangeset
for help on using the changeset viewer.