Changeset 3918 for trunk/LMDZ.MARS/deftank/launch_1Dchained.sh
- Timestamp:
- Sep 19, 2025, 2:53:16 PM (2 months ago)
- File:
-
- 1 edited
-
trunk/LMDZ.MARS/deftank/launch_1Dchained.sh (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/deftank/launch_1Dchained.sh
r3580 r3918 7 7 8 8 9 echo "The launching script is starting!"10 echo "The output file is \"loglaunch.txt\"."11 if [ "$1" = "bg" ]; then12 date13 else14 nohup "$0" bg > loglaunch.txt 2>&1 &15 exit 116 fi17 18 # Save the current value of LC_NUMERIC and set it to a locale that uses a dot as the decimal separator19 OLD_LC_NUMERIC=$LC_NUMERIC20 LC_NUMERIC=en_US.UTF-821 22 9 ################################################################ 23 10 # Modify here the parameters for the simulation … … 27 14 28 15 # Set the number of Martian years to be simulated: 29 n_myear s=100016 n_myear=100 30 17 31 18 # Name of executable for the PCM: 32 exePCM="testphys1d_ 29_phymars_seq.e"19 exePCM="testphys1d_32_phymars_seq.e" 33 20 ################################################################ 34 21 35 22 36 # Check if files/directories necessary for the script exist 23 echo "The launching script is starting!" 24 echo "The output file is \"launch.log\"." 25 exec > launch.log 2>&1 26 27 # Save the current value of LC_NUMERIC and set it to a locale that uses a dot as the decimal separator 28 OLD_LC_NUMERIC=$LC_NUMERIC 29 LC_NUMERIC=en_US.UTF-8 30 31 # To end the launching script with error 32 errlaunch() { 33 # Restore the previous value of LC_NUMERIC 34 LC_NUMERIC=$OLD_LC_NUMERIC 35 36 date 37 echo "Error: an issue occured in the launching script!" 38 exit 1 39 } 40 41 42 # Check if the set-up is correct 37 43 dir=`pwd` 38 44 machine=`hostname` 39 45 address=`whoami` 46 if [ -v n_myear ]; then 47 if [ $(echo "$n_myear <= 0." | bc -l) -eq 1 ]; then 48 echo "Error: 'n_myear' must be > 0!" 49 errlaunch 50 fi 51 else 52 echo "Error: the number of years to be simulated is not set!" 53 errlaunch 54 fi 40 55 if [ ! -f "$exePCM" ]; then 41 56 echo "Error: file \"$exePCM\" does not exist in $dir!" 42 e xit 157 errlaunch 43 58 fi 44 if [ ! -d " out_PCM" ]; then45 mkdir out_PCM59 if [ ! -d "logs" ]; then 60 mkdir logs 46 61 fi 47 62 if [ ! -d "starts" ]; then … … 56 71 machine=`hostname` 57 72 address=`whoami` 58 echo "This is a chained simulation for PCM runs in $dir on $machine." 59 echo "Number of years to be simulated: $n_myears Martian years." 60 myear=686.9725 # Number of Earth days in Martian year 61 eyear=365.256363004 # Number of days in Earth year 62 convert_years=$(echo "$myear/$eyear" | bc -l) 63 convert_years=$(printf "%.4f" $convert_years) # Rounding to the 4th decimal to respect the precision of Martian year 73 echo "This is a chained simulation for PCM 1D runs in $dir on $machine." 74 echo "Number of years to be simulated: $n_myear Martian years." 64 75 i_myear=0 65 76 iPCM=1 66 cp startfi.nc starts/ 67 if [ -f "star1D.nc" ]; then 68 cp star1D.txt starts/ 77 if [ -f "startfi.nc" ]; then 78 cp startfi.nc starts/ 79 fi 80 if [ -f "start1D.txt" ]; then 81 cp start1D.txt starts/ 69 82 fi 70 83 71 84 # Main loop to to run PCM year by year 72 while [ $i_myear -lt $n_myear s]; do85 while [ $i_myear -lt $n_myear ]; do 73 86 # Run the PCM 74 echo "Run PCM $iPCM: year $iPCM/$n_myears..."75 ./$exePCM > out_runPCM${iPCM}2>&176 if [ ! -f "restartfi.nc" ] ; then # Check if runended abnormally77 echo "Error: the run PCM$iPCM crashed!"78 e xit 187 echo "Run $iPCM: year $iPCM/$n_myear..." 88 ./$exePCM > run.log 2>&1 89 if [ ! -f "restartfi.nc" ] || ! (tail -n 100 run.log | grep -iq "everything is cool!"); then # Check if it ended abnormally 90 echo "Error: the run $iPCM crashed!" 91 errlaunch 79 92 fi 80 93 # Copy data files and prepare the next run 81 mv out_runPCM${iPCM} out_PCM/run${iPCM} 82 mv diagfi.nc diags/diagfi${iPCM}.nc 94 mv run.log logs/run${iPCM}.log 95 if [ -f "diagfi.nc" ]; then 96 mv diagfi.nc diags/diagfi${iPCM}.nc 97 fi 83 98 if [ -f "diagsoil.nc" ]; then 84 99 mv diagsoil.nc diags/diagsoil${iPCM}.nc … … 105 120 106 121 date 107 echo "The launching script ended." 122 echo "Success: the launching script completed normally!" 123 exit 0
Note: See TracChangeset
for help on using the changeset viewer.
