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