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