| 1 | #!/bin/bash |
|---|
| 2 | ######################################################################## |
|---|
| 3 | #### Launching script for a chained simulation of PEM and PCM runs #### |
|---|
| 4 | ######################################################################## |
|---|
| 5 | # This script can take an argument: |
|---|
| 6 | # - If there is no argument, then the script initiates a PEM simulation from scratch. |
|---|
| 7 | # - If the argument is 're', then the script relaunches an existing PEM simulation. |
|---|
| 8 | # It will ask for parameters to know the starting point that you want to. |
|---|
| 9 | ######################################################################## |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | ######################################################################## |
|---|
| 13 | # Modify here the parameters for the simulation |
|---|
| 14 | ############################################### |
|---|
| 15 | # Set the number of years to be simulated, either Martian or Earth years: |
|---|
| 16 | n_mars_years=100 |
|---|
| 17 | #n_earth_years=300 |
|---|
| 18 | |
|---|
| 19 | # Set the number of initial PCM runs: |
|---|
| 20 | nPCM_ini=3 |
|---|
| 21 | |
|---|
| 22 | # Set the number of PCM runs between each PEM run: |
|---|
| 23 | nPCM=2 |
|---|
| 24 | ######################################################################## |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | dir=`pwd` |
|---|
| 28 | machine=`hostname` |
|---|
| 29 | user=`whoami` |
|---|
| 30 | if [ ! -f "lib_launchPEM.sh" ]; then |
|---|
| 31 | echo "Error: file \"lib_launchPEM.sh\" does not exist in $dir!" |
|---|
| 32 | echo "It can be found in the PEM deftank." |
|---|
| 33 | exit 1 |
|---|
| 34 | fi |
|---|
| 35 | |
|---|
| 36 | source lib_launchPEM.sh |
|---|
| 37 | |
|---|
| 38 | if [ $# -eq 0 ]; then # From scratch |
|---|
| 39 | echo "The launching script is starting!" |
|---|
| 40 | echo "The output file is \"log_launchPEM.txt\"." |
|---|
| 41 | exec > log_launchPEM.txt 2>&1 |
|---|
| 42 | echo "Beginning of the launching script for the PEM simulation." |
|---|
| 43 | date |
|---|
| 44 | checklaunch |
|---|
| 45 | initlaunch |
|---|
| 46 | cyclelaunch $nPCM_ini |
|---|
| 47 | else |
|---|
| 48 | if [ $1 = "new" ]; then # New cycle |
|---|
| 49 | exec >> log_launchPEM.txt 2>&1 |
|---|
| 50 | echo "This is a new cycle for the PEM simulation." |
|---|
| 51 | date |
|---|
| 52 | read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt |
|---|
| 53 | cyclelaunch $nPCM |
|---|
| 54 | elif [ $1 = "re" ]; then # Relaunch |
|---|
| 55 | echo "Case not coded yet!" |
|---|
| 56 | errlaunch |
|---|
| 57 | else |
|---|
| 58 | echo "Error: given argument '$1' for the launching script is unknown!" |
|---|
| 59 | errlaunch |
|---|
| 60 | fi |
|---|
| 61 | fi |
|---|