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