[31] | 1 | #! /bin/bash |
---|
| 2 | |
---|
[236] | 3 | ############################### |
---|
| 4 | # use: - launch_gcm # |
---|
| 5 | # - echo 22 | launch_gcm # |
---|
| 6 | ############################### |
---|
[31] | 7 | |
---|
[236] | 8 | # Author : A. Spiga - Spring/Winter 2008 |
---|
| 9 | # added link trick in 2011 |
---|
[31] | 10 | |
---|
[236] | 11 | if [[ ! -d startbase ]] |
---|
| 12 | then |
---|
| 13 | echo "please create in $PWD a symbolic link: startbase" |
---|
| 14 | echo "for instance: ln -sf /san/home/spiga/DATAFILE/STARTBASE_64_48_32_t2 $PWD/startbase" |
---|
| 15 | echo "(and compile the GCM with the correct dimensions)" |
---|
| 16 | exit |
---|
| 17 | fi |
---|
| 18 | ################## |
---|
[31] | 19 | #startbase='../../STARTS/' |
---|
| 20 | #startbase='/d2/emlmd/run_LMDZ.MARS.BETA.TASI/tau1/' |
---|
| 21 | #startbase='/tmp7/aslmd/flush/' |
---|
| 22 | #startbase='/tmp7/aslmd/flush2/' |
---|
[117] | 23 | #startbase='/d6/vblmd/MERIDIANI_EXOMARS/starts_en_cours/tau05/' |
---|
[239] | 24 | #startbase='/d5/aslmd/LMD_MM_MARS_DATA/STARTBASE_64_48_25_t2dust_JBM/' |
---|
[31] | 25 | ################## |
---|
| 26 | |
---|
[239] | 27 | startbase=./startbase/ |
---|
| 28 | |
---|
[31] | 29 | # |
---|
| 30 | # get simulation start day and compute start/startfi required date (simulation day - 1) |
---|
| 31 | # |
---|
| 32 | echo '>>>' choose start sol ? ; read daygcm |
---|
[236] | 33 | #if [[ "$daygcm" == 0 ]] |
---|
| 34 | #then |
---|
| 35 | #daygcm=669 |
---|
| 36 | #fi |
---|
[31] | 37 | daygcm=$(expr ${daygcm} - 1) |
---|
| 38 | |
---|
| 39 | # |
---|
| 40 | # find the correct start/startfi files among 3-day startbase |
---|
| 41 | # |
---|
| 42 | ls ${startbase}/start${daygcm}.nc > /dev/null 2> /dev/null |
---|
| 43 | if [[ "$?" == 0 ]] |
---|
| 44 | then |
---|
| 45 | echo found ! ${daygcm} |
---|
| 46 | else |
---|
| 47 | #echo not found ! ${daygcm} |
---|
| 48 | daygcm=$(expr ${daygcm} - 1) |
---|
| 49 | ls ${startbase}/start${daygcm}.nc > /dev/null 2> /dev/null |
---|
| 50 | if [[ "$?" == 0 ]] # probably a 'while' loop would be better if more than 3 |
---|
| 51 | then |
---|
| 52 | echo found ! ${daygcm} |
---|
| 53 | else |
---|
| 54 | #echo not found ! ${daygcm} |
---|
| 55 | daygcm=$(expr ${daygcm} - 1) |
---|
| 56 | ls ${startbase}/start${daygcm}.nc > /dev/null 2> /dev/null |
---|
| 57 | echo found ! ${daygcm} |
---|
| 58 | fi |
---|
| 59 | fi |
---|
| 60 | |
---|
| 61 | # |
---|
| 62 | # link start/startfi files |
---|
| 63 | # |
---|
| 64 | ln -sf ${startbase}/start${daygcm}.nc start.nc |
---|
| 65 | ln -sf ${startbase}/startfi${daygcm}.nc startfi.nc |
---|
| 66 | |
---|
| 67 | # |
---|
| 68 | # clean the place |
---|
| 69 | # |
---|
| 70 | rm -rf restart.nc 2> /dev/null |
---|
| 71 | rm -rf restartfi.nc 2> /dev/null |
---|
| 72 | rm -rf log_gcm 2> /dev/null |
---|
| 73 | |
---|
| 74 | # |
---|
| 75 | # run ! |
---|
| 76 | # |
---|
| 77 | echo running the GCM - check in ${PWD}/log_gcm |
---|
| 78 | nohup gcm.e > log_gcm |
---|
| 79 | |
---|
| 80 | exit |
---|