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