1 | #!/bin/ksh |
---|
2 | # |
---|
3 | # |
---|
4 | # |
---|
5 | # |
---|
6 | # The model to be tested |
---|
7 | # |
---|
8 | model='../modipsl/bin/orchidee_ol' |
---|
9 | # |
---|
10 | # File with the forcing data |
---|
11 | # |
---|
12 | forcing='../ISLSCP/islscp_Euro_87.nc' |
---|
13 | # |
---|
14 | # Files of the various maps needed by the model |
---|
15 | # |
---|
16 | vegmap='../surfmap/carteveg5km.nc' |
---|
17 | irrigmap='../surfmap/irrigated.nc' |
---|
18 | routmap='../surfmap/routing.nc' |
---|
19 | soilmap='../surfmap/soils_param.nc' |
---|
20 | reftemp='../surfmap/reftemp.nc' |
---|
21 | # |
---|
22 | # Some tools we will need to process the data |
---|
23 | # |
---|
24 | ncks=$(which ncks) |
---|
25 | ncrcat=$(which ncrcat) |
---|
26 | ncdump=$(which ncdump) |
---|
27 | # |
---|
28 | rm="/bin/rm" |
---|
29 | mv="/bin/mv" |
---|
30 | diff="/usr/bin/diff" |
---|
31 | # |
---|
32 | # |
---|
33 | # DO NOT CHANGE BELOW THIS LINE |
---|
34 | #------------------------------------------------------ |
---|
35 | #------------------------------------------------------ |
---|
36 | # |
---|
37 | ###################################################### |
---|
38 | # |
---|
39 | # Verifications |
---|
40 | # |
---|
41 | ###################################################### |
---|
42 | # |
---|
43 | if [ ! -x ${model} ]; then |
---|
44 | echo "The model executable does not exist" |
---|
45 | echo "Retry the compilation of ORCHIDEE in the modipsl strcture" |
---|
46 | exit |
---|
47 | fi |
---|
48 | # |
---|
49 | if [ ! -x ${ncks} ]; then |
---|
50 | echo "The ncks tool of nco does not exist" |
---|
51 | echo "Check it out at http://www.cgd.ucar.edu/cms/nco/nco.html" |
---|
52 | exit |
---|
53 | fi |
---|
54 | # |
---|
55 | # |
---|
56 | if [ ! -x ${rm} ]; then |
---|
57 | echo "How do I delete a file ?" |
---|
58 | exit |
---|
59 | fi |
---|
60 | # |
---|
61 | if [ ! -f ${forcing} ]; then |
---|
62 | echo "I could not find the forcing file" |
---|
63 | exit |
---|
64 | fi |
---|
65 | # |
---|
66 | if [ ! -f ${vegmap} ]; then |
---|
67 | echo "I could not find the file with the vegetation map" |
---|
68 | exit |
---|
69 | fi |
---|
70 | # |
---|
71 | if [ ! -f ${irrigmap} ]; then |
---|
72 | echo "I could not find the file with the irrigation map" |
---|
73 | exit |
---|
74 | fi |
---|
75 | # |
---|
76 | if [ ! -f ${routmap} ]; then |
---|
77 | echo "I could not find the file with the basin map for the routing" |
---|
78 | exit |
---|
79 | fi |
---|
80 | # |
---|
81 | if [ ! -f ${soilmap} ]; then |
---|
82 | echo "I could not find the file with the map with the soil types" |
---|
83 | exit |
---|
84 | fi |
---|
85 | # |
---|
86 | if [ ! -f ${reftemp} ]; then |
---|
87 | echo "I could not find the file with the map of reference temperatures" |
---|
88 | exit |
---|
89 | fi |
---|
90 | # |
---|
91 | # |
---|
92 | ###################################################### |
---|
93 | # |
---|
94 | # generate the default run.def |
---|
95 | # |
---|
96 | ###################################################### |
---|
97 | # |
---|
98 | # |
---|
99 | ${rm} -f run_default.def |
---|
100 | cat > run_default.def << % |
---|
101 | # |
---|
102 | # SECHIBA_2dim |
---|
103 | # |
---|
104 | DEBUG_INFO=n |
---|
105 | FORCING_FILE=${forcing} |
---|
106 | HEIGHT_LEV1=2.0 |
---|
107 | SPLIT_DT=12 |
---|
108 | RESTART_FILEIN=XXDR_RINXX |
---|
109 | RESTART_FILEOUT=XXDR_ROUTXX |
---|
110 | TIME_SKIP=0 |
---|
111 | TIME_LENGTH=XXTLXX |
---|
112 | # IMPLICIT is not set |
---|
113 | NO_INTER=y |
---|
114 | SPRED_PREC=1 |
---|
115 | NETRAD_CONS=n |
---|
116 | # |
---|
117 | LIMIT_WEST = XX_WEST_XX |
---|
118 | LIMIT_EAST = XX_EAST_XX |
---|
119 | LIMIT_NORTH = XX_NORTH_XX |
---|
120 | LIMIT_SOUTH = XX_SOUTH_XX |
---|
121 | # |
---|
122 | # IOIPSL |
---|
123 | # |
---|
124 | RIVER_ROUTING=y |
---|
125 | ROUTING_RIVERS = 2 |
---|
126 | ROUTING_FILE=${routmap} |
---|
127 | IRRIGATION_FILE=${irrigmap} |
---|
128 | DO_IRRIGATION=y |
---|
129 | DO_FLOODPLAINS=y |
---|
130 | # |
---|
131 | # SECHIBA |
---|
132 | # |
---|
133 | CONDVEG_SNOWA=default |
---|
134 | # IMPOSE_AZE is not set |
---|
135 | SOILALB_FILE=${soilmap} |
---|
136 | SOILTYPE_FILE=${soilmap} |
---|
137 | DIFFUCO_LEAFCI=233. |
---|
138 | ENERBIL_TSURF=280. |
---|
139 | HYDROL_SNOW=0.0 |
---|
140 | HYDROL_SNOWAGE=0.0 |
---|
141 | HYDROL_SNOWICE=0.0 |
---|
142 | HYDROL_SNOWICEAGE=0.0 |
---|
143 | HYDROL_HDRY=0.0 |
---|
144 | HYDROL_HUMR=1.0 |
---|
145 | HYDROL_BQSB=default |
---|
146 | HYDROL_GQSB=0.0 |
---|
147 | HYDROL_DSG=0.0 |
---|
148 | HYDROL_DSP=default |
---|
149 | HYDROL_QSV=0.0 |
---|
150 | # STOMATE_OK_CO2=y |
---|
151 | # STOMATE_OK_STOMATE is not set |
---|
152 | # STOMATE_OK_DGVM is not set |
---|
153 | # STOMATE_WATCHOUT is not set |
---|
154 | SECHIBA_restart_in=XXSE_RINXX |
---|
155 | SECHIBA_rest_out=XXSE_ROUTXX |
---|
156 | SECHIBA_reset_time=y |
---|
157 | STOMATE_RESTART_FILEIN=XXST_RINXX |
---|
158 | STOMATE_RESTART_FILEOUT=XXST_ROUTXX |
---|
159 | OUTPUT_FILE=XX_SEOUT_XX |
---|
160 | WRITE_STEP=86400 |
---|
161 | SECHIBA_HISTLEVEL=5 |
---|
162 | STOMATE_OUTPUT_FILE=XX_STOUT_XX |
---|
163 | STOMATE_HIST_DT=10. |
---|
164 | STOMATE_HISTLEVEL=10 |
---|
165 | SECHIBA_DAY=0.0 |
---|
166 | SECHIBA_ZCANOP=0.5 |
---|
167 | DT_SLOW=86400. |
---|
168 | # IMPOSE_VEG is not set |
---|
169 | VEGETATION_FILE=${vegmap} |
---|
170 | THERMOSOIL_TPRO=280. |
---|
171 | % |
---|
172 | # |
---|
173 | ###################################################### |
---|
174 | # |
---|
175 | # Launch our first simulation. It will be called RLarge |
---|
176 | # |
---|
177 | ###################################################### |
---|
178 | # |
---|
179 | # Build the run.def file for 10 days on the large domaine. |
---|
180 | # |
---|
181 | exp_a='Rlarge' |
---|
182 | # |
---|
183 | ${rm} -f wo |
---|
184 | cat << % > wo |
---|
185 | s/XXDR_RINXX/NONE/ |
---|
186 | s/XXDR_ROUTXX/${exp_a}_drv_rest.nc/ |
---|
187 | s/XXTLXX/10d/ |
---|
188 | s/XX_WEST_XX/-20.0/ |
---|
189 | s/XX_EAST_XX/10.0/ |
---|
190 | s/XX_NORTH_XX/20.0/ |
---|
191 | s/XX_SOUTH_XX/2.0/ |
---|
192 | s/XXSE_RINXX/NONE/ |
---|
193 | s/XXSE_ROUTXX/${exp_a}_sec_rest.nc/ |
---|
194 | s/XXST_RINXX/NONE/ |
---|
195 | s/XXST_ROUTXX/${exp_a}_sto_rest.nc/ |
---|
196 | s/XX_SEOUT_XX/sec_${exp_a}.nc/ |
---|
197 | s/XX_STOUT_XX/sto_${exp_a}.nc/ |
---|
198 | % |
---|
199 | ${rm} -f run.def |
---|
200 | sed -f wo run_default.def > run.def |
---|
201 | # |
---|
202 | # Run the model |
---|
203 | # |
---|
204 | # |
---|
205 | ${rm} -f ${exp_a}.log ${exp_a}_*_rest.nc |
---|
206 | time ${model} > ${exp_a}.log |
---|
207 | ${mv} used_run.def used_run_${exp_a}.def |
---|
208 | ${rm} -f ${exp_a}_drv_rest.nc |
---|
209 | # |
---|
210 | # |
---|
211 | ###################################################### |
---|
212 | # |
---|
213 | # Launch our second simulation. It will test the restart of the model |
---|
214 | # |
---|
215 | ###################################################### |
---|
216 | # |
---|
217 | # Build the run.def file for the first 5 days on the large domaine. |
---|
218 | # |
---|
219 | exp_b='RlargeA' |
---|
220 | # |
---|
221 | ${rm} -f wo |
---|
222 | cat << % > wo |
---|
223 | s/XXDR_RINXX/NONE/ |
---|
224 | s/XXDR_ROUTXX/${exp_b}_drv_rest.nc/ |
---|
225 | s/XXTLXX/5d/ |
---|
226 | s/XX_WEST_XX/-20.0/ |
---|
227 | s/XX_EAST_XX/10.0/ |
---|
228 | s/XX_NORTH_XX/20.0/ |
---|
229 | s/XX_SOUTH_XX/2.0/ |
---|
230 | s/XXSE_RINXX/NONE/ |
---|
231 | s/XXSE_ROUTXX/${exp_b}_sec_rest.nc/ |
---|
232 | s/XXST_RINXX/NONE/ |
---|
233 | s/XXST_ROUTXX/${exp_b}_sto_rest.nc/ |
---|
234 | s/XX_SEOUT_XX/sec_${exp_b}.nc/ |
---|
235 | s/XX_STOUT_XX/sto_${exp_b}.nc/ |
---|
236 | % |
---|
237 | ${rm} -f run.def |
---|
238 | sed -f wo run_default.def > run.def |
---|
239 | # |
---|
240 | # Run the model for the first 5 days |
---|
241 | # |
---|
242 | ${rm} -f ${exp_b}.log ${exp_b}_*_rest.nc |
---|
243 | ${model} > ${exp_b}.log |
---|
244 | ${mv} used_run.def used_run_${exp_b}.def |
---|
245 | # |
---|
246 | # Build the run.def file for the second set of 5 days. |
---|
247 | # |
---|
248 | exp_c='RlargeB' |
---|
249 | # |
---|
250 | ${rm} -f wo |
---|
251 | cat << % > wo |
---|
252 | s/XXDR_RINXX/${exp_b}_drv_rest.nc/ |
---|
253 | s/XXDR_ROUTXX/${exp_c}_drv_rest.nc/ |
---|
254 | s/XXTLXX/5d/ |
---|
255 | s/XX_WEST_XX/-20.0/ |
---|
256 | s/XX_EAST_XX/10.0/ |
---|
257 | s/XX_NORTH_XX/20.0/ |
---|
258 | s/XX_SOUTH_XX/2.0/ |
---|
259 | s/XXSE_RINXX/${exp_b}_sec_rest.nc/ |
---|
260 | s/XXSE_ROUTXX/${exp_c}_sec_rest.nc/ |
---|
261 | s/XXST_RINXX/${exp_b}_sto_rest.nc/ |
---|
262 | s/XXST_ROUTXX/${exp_c}_sto_rest.nc/ |
---|
263 | s/XX_SEOUT_XX/sec_${exp_c}.nc/ |
---|
264 | s/XX_STOUT_XX/sto_${exp_c}.nc/ |
---|
265 | % |
---|
266 | ${rm} -f run.def |
---|
267 | sed -f wo run_default.def > run.def |
---|
268 | # |
---|
269 | # Run the model for the first 5 days |
---|
270 | # |
---|
271 | ${rm} -f ${exp_c}.log ${exp_c}_*_rest.nc |
---|
272 | ${model} > ${exp_c}.log |
---|
273 | ${mv} used_run.def used_run_${exp_c}.def |
---|
274 | ${rm} -f ${exp_b}_drv_rest.nc ${exp_c}_drv_rest.nc |
---|
275 | # |
---|
276 | ################################################################# |
---|
277 | # |
---|
278 | # Do the diagnostics |
---|
279 | # |
---|
280 | ################################################################# |
---|
281 | # |
---|
282 | ${rm} -f sec_${exp_a}_pt.nc sec_${exp_b}_pt.nc sec_${exp_c}_pt.nc sec_${exp_a}_combi_pt.nc |
---|
283 | ${ncks} -d lon,5.25,5.75 -d lat,10.25,10.75 sec_${exp_a}.nc sec_${exp_a}_pt.nc |
---|
284 | ${ncks} -d lon,5.25,5.75 -d lat,10.25,10.75 sec_${exp_b}.nc sec_${exp_b}_pt.nc |
---|
285 | ${ncks} -d lon,5.25,5.75 -d lat,10.25,10.75 sec_${exp_c}.nc sec_${exp_c}_pt.nc |
---|
286 | # |
---|
287 | ${ncrcat} sec_${exp_b}_pt.nc sec_${exp_c}_pt.nc sec_${exp_a}_combi_pt.nc |
---|
288 | # |
---|
289 | vars='evap gqsb bqsb temp_sol' |
---|
290 | for v in $vars ; do |
---|
291 | ${rm} -f full combi |
---|
292 | ${ncdump} -v $v -p 9,17 -f f sec_${exp_a}_pt.nc | tail -12 > full |
---|
293 | ${ncdump} -v $v -p 9,17 -f f sec_${exp_a}_combi_pt.nc | tail -12 > combi |
---|
294 | ${diff} full combi > /dev/null |
---|
295 | if [ $? -eq 1 ]; then |
---|
296 | echo 'The restart did not work and we have differences for variable ' $v |
---|
297 | paste full combi |
---|
298 | else |
---|
299 | echo 'The restart worked for variable ' $v |
---|
300 | fi |
---|
301 | done |
---|
302 | ${rm} full combi sec_${exp_b}.nc sec_${exp_c}.nc |
---|
303 | # |
---|
304 | # Clean up ! |
---|
305 | # |
---|
306 | # |
---|
307 | ${rm} -f wo run.def run_default.def |
---|
308 | |
---|