1 | #!/bin/bash |
---|
2 | # script pour lancer un cycle antarctique |
---|
3 | |
---|
4 | echo "----------------------------------------------" |
---|
5 | echo "Launching GRISLI Ant-40 last deglaciation" |
---|
6 | echo "Schoof or Tsai parameterisation ?" |
---|
7 | echo "For Tsai : 1" |
---|
8 | echo "For Schoof : 2" |
---|
9 | read gr_select |
---|
10 | echo |
---|
11 | |
---|
12 | tmodelend="10000." |
---|
13 | tmodelbegin="-126000." #"-150000." |
---|
14 | tmodellength="136000." |
---|
15 | |
---|
16 | parallel="yes" # "yes or no?" |
---|
17 | |
---|
18 | #Revision number : |
---|
19 | rev=`svn info | grep "Révision : " | awk '{print $2}'` |
---|
20 | echo "Code revision svn "$rev |
---|
21 | |
---|
22 | # name of the run: |
---|
23 | if [ $gr_select = "1" ] ; then |
---|
24 | echo "grounding line parameterisation type : Tsai" |
---|
25 | namerun="Cyc-Tsai" |
---|
26 | elif [ $gr_select = "2" ] ; then |
---|
27 | echo "grounding line parameterisation type : Schoof" |
---|
28 | namerun="Cyc-Scho" |
---|
29 | else |
---|
30 | echo "Bad choice for gr_select (1 or 2 only) !!!" |
---|
31 | exit 0 |
---|
32 | fi |
---|
33 | |
---|
34 | echo |
---|
35 | echo "----------------------------------------------" |
---|
36 | echo " Now launching run: " $namerun |
---|
37 | echo "----------------------------------------------" |
---|
38 | echo |
---|
39 | |
---|
40 | #-------------------------------------------------- |
---|
41 | # Check if times are ok: |
---|
42 | #-------------------------------------------------- |
---|
43 | |
---|
44 | tcheck=`echo "$tmodelbegin + $tmodellength" | bc -l` |
---|
45 | tcheckbis=`echo "$tmodelend + 0" | bc -l` |
---|
46 | if [ $tcheck != $tcheckbis ]; then |
---|
47 | echo "The times provided are wrong!" |
---|
48 | echo $tcheck $tcheckbis |
---|
49 | echo "Tbegin:" $tmodelbegin ", Tend:" $tmodelend ", length:" $tmodellength |
---|
50 | exit 0 |
---|
51 | else |
---|
52 | echo "The times provided are correct." |
---|
53 | fi |
---|
54 | |
---|
55 | #-------------------------------------------------- |
---|
56 | # The different directories: |
---|
57 | #-------------------------------------------------- |
---|
58 | #RUNDIR="/home/climold/aquiquet/GRISLI/GRISLI_trunk/RUNS/"$namerun |
---|
59 | #MODELMASTER="/home/climold/aquiquet/GRISLI/GRISLI_trunk/SOURCES" |
---|
60 | #MODEL=$RUNDIR"/SOURCES" |
---|
61 | LAUCHING_DIR=`pwd` |
---|
62 | GRISLI_DIR=${LAUCHING_DIR%%/lauching_area} |
---|
63 | RUNDIR=${GRISLI_DIR}"/RUNS/"${namerun}-r${rev} |
---|
64 | MODELMASTER=${GRISLI_DIR}"/SOURCES" |
---|
65 | MODEL=${RUNDIR}"/SOURCES" |
---|
66 | |
---|
67 | if [ -d $RUNDIR ]; then |
---|
68 | echo "This run exists, do you really want to overwrite?" |
---|
69 | echo "You have 3 sec. to do a ctr+c..." |
---|
70 | sleep 3 |
---|
71 | echo "Ok, your choice." |
---|
72 | else |
---|
73 | mkdir $RUNDIR |
---|
74 | echo " Run will be in:" |
---|
75 | echo " " $RUNDIR |
---|
76 | fi |
---|
77 | |
---|
78 | if [ -d $MODEL ]; then |
---|
79 | echo "model dir already created, cleaning up before copying files" |
---|
80 | rm -rf $MODEL"/"* |
---|
81 | else |
---|
82 | mkdir $MODEL |
---|
83 | fi |
---|
84 | |
---|
85 | cp -R $MODELMASTER"/"* $MODEL"/." |
---|
86 | svn status $MODELMASTER > $MODEL"/svn.status.txt" |
---|
87 | svn diff $MODELMASTER > $MODEL"/svn.diff.txt" |
---|
88 | |
---|
89 | if [ -d $RUNDIR"/bin" ]; then |
---|
90 | echo "exe in bin/" |
---|
91 | else |
---|
92 | mkdir $RUNDIR"/bin" |
---|
93 | fi |
---|
94 | |
---|
95 | if [ -d $RUNDIR"/RESULTATS" ]; then |
---|
96 | echo "exe in RESULTATS/" |
---|
97 | else |
---|
98 | mkdir $RUNDIR"/RESULTATS" |
---|
99 | fi |
---|
100 | |
---|
101 | if [ -d $RUNDIR"/INPUT" ]; then |
---|
102 | echo "inputs are linked to model master" |
---|
103 | else |
---|
104 | echo "inputs will be linked to model master" |
---|
105 | mkdir $RUNDIR"/INPUT" |
---|
106 | fi |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | echo "Now copying master files to the working directory:" |
---|
111 | echo $RUNDIR |
---|
112 | echo "And to the model directory:" |
---|
113 | echo $MODEL |
---|
114 | |
---|
115 | #cp "../Master-files/Makefile" $MODEL"/Makefile" |
---|
116 | #cp "../Master-files/anteis1_param_list.dat" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
117 | cp "Master-files/anteis1_TEMPS-NETCDF-cycle.dat" $MODEL"/Fichiers-parametres/anteis1_TEMPS-NETCDF.dat" |
---|
118 | cp "Master-files/module_choix-antar40-0.4-cycles.f90" $MODEL"/Ant40_files/module_choix-antar40-0.4.f90" |
---|
119 | if [ $gr_select = "1" ] ; then |
---|
120 | cp "../Param/anteis1_param_list_Cyc-Tsai.dat" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
121 | elif [ $gr_select = "2" ] ; then |
---|
122 | cp "../Param/anteis1_param_list_Cyc-Scho.dat" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
123 | fi |
---|
124 | |
---|
125 | if [ $parallel = "yes" ]; then |
---|
126 | cp "Master-files/grisli.run.openmp_ant40" $RUNDIR"/bin/grisli.run" |
---|
127 | else |
---|
128 | cp "Master-files/grisli.run_ant40" $RUNDIR"/bin/grisli.run" |
---|
129 | fi |
---|
130 | |
---|
131 | cd $RUNDIR"/INPUT" |
---|
132 | ln -sf ${GRISLI_DIR}"/INPUT/ANTEIS1" . |
---|
133 | ln -sf ${GRISLI_DIR}"/INPUT/Forcage" . |
---|
134 | ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" . |
---|
135 | |
---|
136 | #-------------------------------------------------- |
---|
137 | # Replacing key words: |
---|
138 | #-------------------------------------------------- |
---|
139 | |
---|
140 | # run spec.: |
---|
141 | sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
142 | sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
143 | sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
144 | |
---|
145 | # submission script: |
---|
146 | sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run" |
---|
147 | sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run" |
---|
148 | sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/grisli.run" |
---|
149 | if [ $parallel = "yes" ]; then |
---|
150 | sed -i '/EXEDIR/s/$/\nmodule load netcdf\/4p\n/' $RUNDIR"/bin/grisli.run" |
---|
151 | else |
---|
152 | sed -i '/EXEDIR/s/$/\nmodule load netcdf\/4\n/' $RUNDIR"/bin/grisli.run" |
---|
153 | fi |
---|
154 | |
---|
155 | # Makefile: |
---|
156 | if [ $parallel = "yes" ]; then |
---|
157 | sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile" |
---|
158 | else |
---|
159 | sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile" |
---|
160 | fi |
---|
161 | |
---|
162 | # param values: |
---|
163 | #sed -i "s/PARAMENHFACT/$enh_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
164 | #sed -i "s/PARAMCF/$cf_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
165 | #sed -i "s/PARAMSEUILNEFF/$seuilneff_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
166 | #sed -i "s/PARAMINFILTR/$infiltr_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
167 | #sed -i "s/PARAMKOND0/$kond0_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
168 | #sed -i "s/BETAMAX/$betamax_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
169 | #sed -i "s/TOSTICK/$tostick_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
170 | #sed -i "s/EXPOSLOPE/$exposlope_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
171 | #sed -i "s/PARAMBSLOPE/$bslope_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
172 | #sed -i "s/PARAMBEXPO/$bexpo_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
173 | #sed -i "s/PARAMBMELTCOEF/$bmelt_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
174 | #sed -i "s/PARAMSF/$sf_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
175 | |
---|
176 | |
---|
177 | #-------------------------------------------------- |
---|
178 | # Submitting the job: |
---|
179 | #-------------------------------------------------- |
---|
180 | |
---|
181 | echo "submitting the job" |
---|
182 | qsub $RUNDIR"/bin/grisli.run" |
---|
183 | echo "-------------------------------------" |
---|
184 | |
---|
185 | |
---|
186 | |
---|
187 | |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | |
---|