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