[11] | 1 | #! /bin/bash |
---|
| 2 | |
---|
[226] | 3 | ############################### |
---|
| 4 | # use: - launch_gcm # |
---|
| 5 | # - echo 22 | launch_gcm # |
---|
| 6 | ############################### |
---|
[11] | 7 | |
---|
[236] | 8 | # Author : A. Spiga - Spring/Winter 2008 |
---|
| 9 | # added link trick in 2011 |
---|
[11] | 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 |
---|
[11] | 18 | |
---|
[239] | 19 | startbase=./startbase/ |
---|
| 20 | |
---|
[11] | 21 | # |
---|
| 22 | # get simulation start day and compute start/startfi required date (simulation day - 1) |
---|
| 23 | # |
---|
| 24 | echo '>>>' choose start sol ? ; read daygcm |
---|
| 25 | #if [[ "$daygcm" == 0 ]] |
---|
| 26 | #then |
---|
| 27 | #daygcm=669 |
---|
| 28 | #fi |
---|
| 29 | daygcm=$(expr ${daygcm} - 1) |
---|
| 30 | |
---|
| 31 | # |
---|
| 32 | # find the correct start/startfi files among 3-day startbase |
---|
| 33 | # |
---|
| 34 | ls ${startbase}/start${daygcm}.nc > /dev/null 2> /dev/null |
---|
| 35 | if [[ "$?" == 0 ]] |
---|
| 36 | then |
---|
| 37 | echo found ! ${daygcm} |
---|
| 38 | else |
---|
| 39 | #echo not found ! ${daygcm} |
---|
| 40 | daygcm=$(expr ${daygcm} - 1) |
---|
| 41 | ls ${startbase}/start${daygcm}.nc > /dev/null 2> /dev/null |
---|
| 42 | if [[ "$?" == 0 ]] # probably a 'while' loop would be better if more than 3 |
---|
| 43 | then |
---|
| 44 | echo found ! ${daygcm} |
---|
| 45 | else |
---|
| 46 | #echo not found ! ${daygcm} |
---|
| 47 | daygcm=$(expr ${daygcm} - 1) |
---|
| 48 | ls ${startbase}/start${daygcm}.nc > /dev/null 2> /dev/null |
---|
| 49 | echo found ! ${daygcm} |
---|
| 50 | fi |
---|
| 51 | fi |
---|
| 52 | |
---|
| 53 | # |
---|
| 54 | # link start/startfi files |
---|
| 55 | # |
---|
| 56 | ln -sf ${startbase}/start${daygcm}.nc start.nc |
---|
| 57 | ln -sf ${startbase}/startfi${daygcm}.nc startfi.nc |
---|
| 58 | |
---|
| 59 | # |
---|
| 60 | # clean the place |
---|
| 61 | # |
---|
| 62 | rm -rf restart.nc 2> /dev/null |
---|
| 63 | rm -rf restartfi.nc 2> /dev/null |
---|
| 64 | rm -rf log_gcm 2> /dev/null |
---|
| 65 | |
---|
| 66 | # |
---|
| 67 | # run ! |
---|
| 68 | # |
---|
| 69 | echo running the GCM - check in ${PWD}/log_gcm |
---|
| 70 | nohup gcm.e > log_gcm |
---|
| 71 | |
---|
| 72 | exit |
---|