1 | #! /bin/bash |
---|
2 | |
---|
3 | ######################################################### |
---|
4 | # runmeso : # |
---|
5 | # utility to combine compilation + preprocessing + run # |
---|
6 | ######################################################### |
---|
7 | ############################### |
---|
8 | # Author: A. Spiga # |
---|
9 | # New version : December 2008 # |
---|
10 | ############################### |
---|
11 | |
---|
12 | # TODO: - GCM compile |
---|
13 | # - NETCDF |
---|
14 | # - (modif registry) |
---|
15 | # - quick restart |
---|
16 | |
---|
17 | |
---|
18 | ########################################### |
---|
19 | ########################################### |
---|
20 | ########################################### |
---|
21 | |
---|
22 | |
---|
23 | changeregis=0 ## 1 if changed registry |
---|
24 | #changeregis=1 ## 1 if changed registry |
---|
25 | i_want_to_compile=1 |
---|
26 | |
---|
27 | if [[ "${LMDMOD}" = "" ]] |
---|
28 | then |
---|
29 | echo "Please initialize the variable LMDMOD in your environnement (or modify scripts)" |
---|
30 | exit |
---|
31 | fi |
---|
32 | #################################### |
---|
33 | # A FEW DEFINITIONS YOU CAN MODIFY # |
---|
34 | #################################### |
---|
35 | main_folder=$LMDMOD |
---|
36 | meso_folder=${main_folder}'/LMD_MM_MARS' |
---|
37 | gcm_folder=${main_folder}'/LMDZ.MARS/myGCM' |
---|
38 | calendar=${main_folder}'/LMD_MM_MARS/SIMU/calendar' |
---|
39 | simu_folder=$PWD |
---|
40 | |
---|
41 | |
---|
42 | ################ |
---|
43 | # WELCOME USER # |
---|
44 | ################ |
---|
45 | echo '**********************************************' |
---|
46 | echo '**** LMD Martian Mesoscale Model launcher ****' |
---|
47 | echo '**********************************************' |
---|
48 | #echo '** Hello '$(whoami)' on '$(hostname)' !' |
---|
49 | #echo '** ['$(uname -a)']' |
---|
50 | echo '** User >>> '$(whoami) |
---|
51 | echo '** Hostname >>> '$(hostname) |
---|
52 | echo '** Hardware >>> '$(uname -m) |
---|
53 | echo '** Processor >>> '$(uname -p) |
---|
54 | echo '**********************************************' |
---|
55 | |
---|
56 | ########################## |
---|
57 | # GET INFO FROM NAMELIST # |
---|
58 | ########################## |
---|
59 | #echo '***********************' |
---|
60 | #echo '**** Your settings ****' |
---|
61 | #echo '***********************' |
---|
62 | echo '** Simulation directory >>> '${simu_folder} |
---|
63 | if [[ ! ( -f "namelist.input" ) ]] |
---|
64 | then |
---|
65 | echo 'no namelist.input file !' |
---|
66 | exit |
---|
67 | fi |
---|
68 | # |
---|
69 | # READ INFO NEEDED FOR INIT |
---|
70 | # |
---|
71 | year=$(more ${simu_folder}/namelist.input | grep start_year | awk '{print $3}' | sed s+','+''+g) |
---|
72 | month=$(more ${simu_folder}/namelist.input | grep start_month | awk '{print $3}' | sed s+','+''+g) |
---|
73 | day=$(more ${simu_folder}/namelist.input | grep start_day | awk '{print $3}' | sed s+','+''+g) |
---|
74 | hour=$(more ${simu_folder}/namelist.input | grep start_hour | awk '{print $3}' | sed s+','+''+g) |
---|
75 | wrf_date=${year}'-'${month}'-'${day}'_00:00:00' |
---|
76 | daygcm=$(more ${calendar} | grep ${wrf_date} | awk '{print $2}') |
---|
77 | lsubs=$(more ${calendar} | grep ${wrf_date} | awk '{print $3}') |
---|
78 | eyear=$(more ${simu_folder}/namelist.input | grep end_year | awk '{print $3}' | sed s+','+''+g) |
---|
79 | emonth=$(more ${simu_folder}/namelist.input | grep end_month | awk '{print $3}' | sed s+','+''+g) |
---|
80 | eday=$(more ${simu_folder}/namelist.input | grep end_day | awk '{print $3}' | sed s+','+''+g) |
---|
81 | ehour=$(more ${simu_folder}/namelist.input | grep end_hour | awk '{print $3}' | sed s+','+''+g) |
---|
82 | ewrf_date=${eyear}'-'${emonth}'-'${eday}'_00:00:00' |
---|
83 | edaygcm=$(more ${calendar} | grep ${ewrf_date} | awk '{print $2}') |
---|
84 | elsubs=$(more ${calendar} | grep ${ewrf_date} | awk '{print $3}') |
---|
85 | echo '** Start date >>> '${year}'-'${month}'-'${day}" [sol="${daygcm}", Ls="${lsubs}"]" |
---|
86 | echo '** End date >>> '${eyear}'-'${emonth}'-'${eday}" [sol="${edaygcm}", Ls="${elsubs}"]" |
---|
87 | # |
---|
88 | # READ INFO NEEDED FOR DOMAIN |
---|
89 | # |
---|
90 | interval_seconds="$(more ${simu_folder}/namelist.input | grep -e '[^!]*interval_seconds *=')" |
---|
91 | if [[ "${interval_seconds}" = "" ]] |
---|
92 | then |
---|
93 | interval_seconds="interval_seconds = 3700 !! (p2) Frequency of large-scale fields update (s)" |
---|
94 | fi |
---|
95 | # |
---|
96 | max_dom="$(more ${simu_folder}/namelist.input | grep -e '[^!]*max_dom *=')" |
---|
97 | if [[ "${max_dom}" = "" ]] |
---|
98 | then |
---|
99 | max_dom="max_dom = 1 !! (r)(n)(p2) Total number of domains" |
---|
100 | fi |
---|
101 | # |
---|
102 | parent_id="$(more ${simu_folder}/namelist.input | grep -e '[^!]*parent_id *=')" |
---|
103 | if [[ "${parent_id}" = "" ]] |
---|
104 | then |
---|
105 | parent_id="parent_id = 0, !! (n)(p2) Associated parent domain" |
---|
106 | fi |
---|
107 | # |
---|
108 | i_parent_start="$(more ${simu_folder}/namelist.input | grep -e '[^!]*i_parent_start *=')" |
---|
109 | if [[ "${i_parent_start}" = "" ]] |
---|
110 | then |
---|
111 | i_parent_start="i_parent_start = 0, !! (n)(p2) x-position of the bottom-left nest corner" |
---|
112 | fi |
---|
113 | # |
---|
114 | j_parent_start="$(more ${simu_folder}/namelist.input | grep -e '[^!]*j_parent_start *=')" |
---|
115 | if [[ "${j_parent_start}" = "" ]] |
---|
116 | then |
---|
117 | j_parent_start="j_parent_start = 0, !! (n)(p2) y-position of the bottom-left nest corner" |
---|
118 | fi |
---|
119 | # |
---|
120 | parent_grid_ratio="$(more ${simu_folder}/namelist.input | grep -e '[^!]*parent_grid_ratio *=')" |
---|
121 | if [[ "${parent_grid_ratio}" = "" ]] |
---|
122 | then |
---|
123 | parent_grid_ratio="parent_grid_ratio = 1, !! (n)(p2) Ratio of horizontal resolution parent/nest" |
---|
124 | fi |
---|
125 | # |
---|
126 | e_we="$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_we *=')" |
---|
127 | e_sn="$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_sn *=')" |
---|
128 | # |
---|
129 | dx="$(more ${simu_folder}/namelist.input | grep -e '[^!]*dx *=' | awk '{print $3}' | sed s+','+''+g)" |
---|
130 | dy="$(more ${simu_folder}/namelist.input | grep -e '[^!]*dy *=' | awk '{print $3}' | sed s+','+''+g)" |
---|
131 | |
---|
132 | |
---|
133 | # |
---|
134 | # READ INFO NEEDED FOR COMPILATION |
---|
135 | # |
---|
136 | nx=$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_we *=' | awk '{print $3}' | sed s+','+''+g) |
---|
137 | ny=$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_sn *=' | awk '{print $3}' | sed s+','+''+g) |
---|
138 | nz=$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_vert *=' | awk '{print $3}' | sed s+','+''+g) |
---|
139 | nest=$(more ${simu_folder}/namelist.input | grep -e '[^!]*max_dom *=' | awk '{print $3}' | sed s+','+''+g) |
---|
140 | if [[ "${nest}" = "" ]] |
---|
141 | then |
---|
142 | nest='1' |
---|
143 | fi |
---|
144 | numcallphys=$(ls callphys*def | wc -l) |
---|
145 | if [[ ${numcallphys} -lt ${nest} ]] |
---|
146 | then |
---|
147 | echo '**********' |
---|
148 | echo You should have ${nest} callphys.def' file(s)' !! |
---|
149 | exit |
---|
150 | fi |
---|
151 | tracers=$(more ${simu_folder}/namelist.input | grep mars | awk '{print $3}' | sed s+','+''+g) |
---|
152 | case ${tracers} in |
---|
153 | 0) tracers='1' ;; |
---|
154 | 1) tracers='2' ;; |
---|
155 | *) tracers='1' ;; |
---|
156 | esac |
---|
157 | echo '** Domain(s) >>> '${nest} |
---|
158 | echo '** Tracer(s) >>> '${tracers} |
---|
159 | echo '** Grid points >>> '${nx}" x "${ny}" x "${nz} |
---|
160 | echo '** Horizontal resolution >>> '${dx} |
---|
161 | #echo "OK ? ('no' to exit, any key if OK)" ; read wellok |
---|
162 | # if [[ "${wellok}" = "no" ]] |
---|
163 | # then |
---|
164 | # exit |
---|
165 | # fi |
---|
166 | |
---|
167 | ########### |
---|
168 | # ACTIONS # |
---|
169 | ########### |
---|
170 | #echo '***********************' |
---|
171 | #echo '**** Steps ****' |
---|
172 | #echo '***********************' |
---|
173 | echo '**********************************************' |
---|
174 | echo "** This script will compile the model then :" |
---|
175 | echo "** <1> Prepare GCM inputs <-1> to skip compilation" |
---|
176 | echo "** <2> Perform WPS interpolations <-2> to skip compilation" |
---|
177 | echo "** <3> Execute real.exe <-3> to skip compilation" |
---|
178 | echo "** <4> Execute wrf.exe <-4> to skip compilation" |
---|
179 | echo "** <5> Exit" |
---|
180 | echo "** <9> Oops ! Exit now please." |
---|
181 | echo '**********************************************' |
---|
182 | #echo "Start at which step ? (1-4)" ; read step |
---|
183 | echo "Where shall we start ? 1, 2, 3, 4, 5 or 9" ; read step |
---|
184 | if [[ ${step} -lt 0 ]] |
---|
185 | then |
---|
186 | step=$(expr 0 - ${step}) |
---|
187 | i_want_to_compile=0 |
---|
188 | echo ".... ok, I skip the compiling & linking step. you'll just be asked the compiler you previously defined." |
---|
189 | fi |
---|
190 | case ${step} in |
---|
191 | 9) exit ;; |
---|
192 | 5) gcmstep=0 ; wpsstep=0 ; realstep=0 ; wrfstep=0 ;; |
---|
193 | 1) gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;; |
---|
194 | 2) gcmstep=0 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;; |
---|
195 | 3) gcmstep=0 ; wpsstep=0 ; realstep=1 ; wrfstep=1 ;; |
---|
196 | 4) gcmstep=0 ; wpsstep=0 ; realstep=0 ; wrfstep=1 ;; |
---|
197 | *) echo "** I guess you do not know what to do. Let's start from the beginning." |
---|
198 | gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;; |
---|
199 | esac |
---|
200 | |
---|
201 | |
---|
202 | ################################### |
---|
203 | # LINK THE EXECUTABLES OR COMPILE # |
---|
204 | ################################### |
---|
205 | echo '**********************************************' |
---|
206 | echo "** Compiling option " |
---|
207 | echo "** <1> pgf90" |
---|
208 | echo "** <2> g95" |
---|
209 | echo "** <3> mpi+pgf90" |
---|
210 | echo '**********************************************' |
---|
211 | echo "Your choice ? (1-3)" ; read compilo |
---|
212 | if [[ "${compilo}" == "" || ${compilo} -lt 1 || ${compilo} -gt 3 ]] |
---|
213 | then |
---|
214 | echo "** well, let's try g95" |
---|
215 | compilo=2 |
---|
216 | fi |
---|
217 | if [[ ${compilo} -eq 3 ]] |
---|
218 | then |
---|
219 | echo How many processors ? 1, 2, 4, 6, 8, 16 ; read numproc |
---|
220 | else |
---|
221 | numproc=1 |
---|
222 | fi |
---|
223 | #if [[ ${i_want_to_compile} -ge 1 ]] |
---|
224 | #then |
---|
225 | cd ${meso_folder} |
---|
226 | echo ${compilo} > tmp |
---|
227 | if [[ ${compilo} -eq 3 ]] |
---|
228 | then |
---|
229 | echo ${numproc} >> tmp |
---|
230 | fi |
---|
231 | echo ${nest} >> tmp |
---|
232 | ./makemeso -d < tmp > /dev/null |
---|
233 | \rm tmp 2> /dev/null |
---|
234 | work_folder=${meso_folder}'/'$(more what_folder) |
---|
235 | echo 'work_folder : '${work_folder} |
---|
236 | \rm what_folder 2> /dev/null |
---|
237 | ##################### NB: define the domain if was not done yet |
---|
238 | if [[ -f "${simu_folder}/namelist.wps" ]] |
---|
239 | then |
---|
240 | happy='y' |
---|
241 | else |
---|
242 | happy='' |
---|
243 | fi |
---|
244 | if [[ ${step} -le 2 ]] |
---|
245 | then |
---|
246 | while [[ "${happy}" != "y" ]] |
---|
247 | do |
---|
248 | #vi ${simu_folder}/namelist.input |
---|
249 | if [[ ! ( -d "${work_folder}/WPS" ) ]] |
---|
250 | then |
---|
251 | echo 'no WPS. you need to install it for your architecture' |
---|
252 | exit |
---|
253 | fi |
---|
254 | \rm ${simu_folder}/namelist.wps 2> /dev/null |
---|
255 | echo '**********************************************' |
---|
256 | echo " !!! NO namelist.wps FILE FOUND !!!" |
---|
257 | echo '**********************************************' |
---|
258 | echo 'Please define the domain (not for nests for the moment) : ' |
---|
259 | echo " - 1/4 Projection: polar lambert mercator ? previous is "${proj} ; read proj |
---|
260 | echo " - 2/4 Data source (multiple if nests): 'gcm' '32ppd' '64ppd' '64ppd_noHRti' '32ppd_HRalb' ? previous is "${data_source} ; read data_source |
---|
261 | echo " - 3/4 North Latitude of domain centre ? previous is "${lat} ; read lat |
---|
262 | echo " - 4/4 East Longitude of domain centre ? previous is "${lon} ; read lon |
---|
263 | ##### |
---|
264 | sed s+"__INTERVAL_SECONDS__"+"${interval_seconds}"+g ${meso_folder}/SIMU/namelist.wps | sed s+"__MAX_DOM__"+"${max_dom}"+g | sed s+"__PARENT_ID__"+"${parent_id}"+g | sed s+"__PARENT_GRID_RATIO__"+"${parent_grid_ratio}"+g | sed s+"__I_PARENT_START__"+"${i_parent_start}"+g | sed s+"__J_PARENT_START__"+"${j_parent_start}"+g | sed s+"__E_WE__"+"${e_we}"+g | sed s+"__E_SN__"+"${e_sn}"+g | sed s+"__DX__"+"${dx}"+g | sed s+"__DY__"+"${dy}"+g | sed s+"__PROJ__"+"${proj}"+g | sed s+"__DATA_SOURCE__"+"${data_source}"+g | sed s+"__LAT__"+"${lat}"+g | sed s+"__LON__"+"${lon}"+g | sed s+'0000-00-00_00:00:00'+${year}'-'${month}'-'${day}'_'${hour}':00:00'+g | sed s+'1111-11-11_11:11:11'+${eyear}'-'${emonth}'-'${eday}'_'${ehour}':00:00'+g > ${simu_folder}/namelist.wps |
---|
265 | #### |
---|
266 | ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps |
---|
267 | #vi ${work_folder}/WPS/namelist.wps |
---|
268 | echo '**********************************************' |
---|
269 | echo OK, thank you. Please wait... ncview will pop up soon ! |
---|
270 | cd ${work_folder}/WPS/ |
---|
271 | \rm geo_em.d0*.nc 2> /dev/null |
---|
272 | ./geogrid.exe > /dev/null 2> /dev/null |
---|
273 | ncview geo_em.d01.nc > /dev/null 2> /dev/null & |
---|
274 | if [[ -f "geo_em.d02.nc" ]] |
---|
275 | then |
---|
276 | ncview geo_em.d02.nc > /dev/null 2> /dev/null & |
---|
277 | fi |
---|
278 | if [[ -f "geo_em.d03.nc" ]] |
---|
279 | then |
---|
280 | ncview geo_em.d03.nc > /dev/null 2> /dev/null & |
---|
281 | fi |
---|
282 | cd ${simu_folder}/ |
---|
283 | echo '**********************************************' |
---|
284 | echo 'Are you happy with the results ? type y if yes, any key if no' ; read happy |
---|
285 | done |
---|
286 | fi |
---|
287 | ##################### |
---|
288 | if [[ ${i_want_to_compile} -ge 1 ]] |
---|
289 | then |
---|
290 | cd ${simu_folder} |
---|
291 | ## corresponding executables |
---|
292 | wrfexe=${work_folder}/wrf_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}.exe |
---|
293 | realexe=${work_folder}/real_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}.exe |
---|
294 | if [[ -f ${wrfexe} ]] |
---|
295 | then |
---|
296 | echo '**********************************************' |
---|
297 | echo " !!! wrf.exe exists in ${work_folder}" |
---|
298 | echo '**********************************************' |
---|
299 | echo "Recompile ? ('yes' to accept, any key to refuse)" ; read reply |
---|
300 | else |
---|
301 | reply='yes' |
---|
302 | fi |
---|
303 | echo '********************************************** OK thanks. Now please wait...' |
---|
304 | echo ' ' |
---|
305 | if [[ "${reply}" == "yes" ]] |
---|
306 | then |
---|
307 | ##################### |
---|
308 | echo "** "Begin compilation process... |
---|
309 | \rm ${wrfexe} 2> /dev/null |
---|
310 | \rm ${realexe} 2> /dev/null |
---|
311 | # |
---|
312 | # CREATE makemeso_input |
---|
313 | # |
---|
314 | \rm ${simu_folder}/makemeso_input 2> /dev/null |
---|
315 | touch ${simu_folder}/makemeso_input |
---|
316 | echo ${compilo} >> ${simu_folder}/makemeso_input |
---|
317 | if [[ "${compilo}" = "3" ]] |
---|
318 | then |
---|
319 | echo ${numproc} >> ${simu_folder}/makemeso_input |
---|
320 | fi |
---|
321 | echo ${nx} >> ${simu_folder}/makemeso_input |
---|
322 | echo ${ny} >> ${simu_folder}/makemeso_input |
---|
323 | echo ${nz} >> ${simu_folder}/makemeso_input |
---|
324 | echo ${nest} >> ${simu_folder}/makemeso_input |
---|
325 | echo ${tracers} >> ${simu_folder}/makemeso_input |
---|
326 | #echo 'y' >> ${simu_folder}/makemeso_input |
---|
327 | # |
---|
328 | # COMPILE THE MODEL |
---|
329 | # |
---|
330 | cd ${meso_folder} |
---|
331 | if [[ "${changeregis}" = "1" ]] |
---|
332 | then |
---|
333 | cd ${work_folder}/WRFV2/Registry |
---|
334 | \rm Registry 2> /dev/null |
---|
335 | ./Registry.bash |
---|
336 | cd ../../.. |
---|
337 | fi |
---|
338 | ##****** |
---|
339 | ./makemeso -r < ${simu_folder}/makemeso_input |
---|
340 | ##****** |
---|
341 | if [[ -f ${wrfexe} ]] |
---|
342 | then |
---|
343 | echo "** "seems OK ... linking executables |
---|
344 | ln -sf ${wrfexe} ${simu_folder}/wrf.exe |
---|
345 | ln -sf ${realexe} ${simu_folder}/real.exe |
---|
346 | chmod a+x ${realexe} ${wrfexe} ## sait-on jamais |
---|
347 | cd $simu_folder |
---|
348 | else |
---|
349 | echo no ${wrfexe} |
---|
350 | echo problem with the compilation |
---|
351 | exit |
---|
352 | fi |
---|
353 | else |
---|
354 | #echo simply linking existing executables... |
---|
355 | ln -sf ${wrfexe} ${simu_folder}/wrf.exe |
---|
356 | ln -sf ${realexe} ${simu_folder}/real.exe |
---|
357 | chmod a+x ${realexe} ${wrfexe} ## sait-on jamais |
---|
358 | fi |
---|
359 | fi |
---|
360 | |
---|
361 | ###################################### |
---|
362 | # 1. RUN GCM FOR INIT/BDY CONDITIONS # |
---|
363 | ###################################### |
---|
364 | if [ ${gcmstep} -eq 1 ] |
---|
365 | then |
---|
366 | echo '************************************' |
---|
367 | echo '**** Step 1: Prepare GCM inputs ****' |
---|
368 | echo '************************************' |
---|
369 | # |
---|
370 | # run GCM |
---|
371 | # |
---|
372 | cd ${gcm_folder} |
---|
373 | #echo '(during the run, you might like to check domain settings in '${work_folder}'/WPS)' |
---|
374 | echo ${daygcm} | ./launch_gcm |
---|
375 | # |
---|
376 | # prepare files for WPS |
---|
377 | # |
---|
378 | cd ${work_folder} |
---|
379 | if [[ -f ${work_folder}/PREP_MARS/create_readmeteo.exe && -f ${work_folder}/PREP_MARS/readmeteo.exe ]] |
---|
380 | then |
---|
381 | cd ${work_folder}/PREP_MARS/ |
---|
382 | ./compile_and_exec |
---|
383 | #echo 1 | ./create_readmeteo.exe |
---|
384 | #./readmeteo.exe < readmeteo.def |
---|
385 | else |
---|
386 | echo please compile the PREP_MARS utilities in ${work_folder} |
---|
387 | exit |
---|
388 | fi |
---|
389 | fi |
---|
390 | |
---|
391 | ################################### |
---|
392 | # 2. RUN WRF PREPROCESSING SYSTEM # |
---|
393 | ################################### |
---|
394 | if [ ${wpsstep} -eq 1 ] |
---|
395 | then |
---|
396 | echo '*****************************************' |
---|
397 | echo '**** Step 2: Perform WPS interpolations *' |
---|
398 | echo '*****************************************' |
---|
399 | if [[ -f ${work_folder}/WPS/geogrid.exe && -f ${work_folder}/WPS/metgrid.exe ]] |
---|
400 | then |
---|
401 | \rm -rf ${simu_folder}/met_em 2> /dev/null |
---|
402 | mkdir ${simu_folder}/met_em |
---|
403 | cd ${work_folder}/WPS/ |
---|
404 | \rm -rf ${work_folder}/WPS/WRFFEED/current 2> /dev/null |
---|
405 | mkdir ${work_folder}/WPS/WRFFEED/current |
---|
406 | ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps |
---|
407 | #mv namelist.wps namelist.wps.tmp |
---|
408 | #sed s+'0000-00-00_00:00:00'+${year}'-'${month}'-'${day}'_'${hour}':00:00'+g namelist.wps.tmp | sed s+'1111-11-11_11:11:11'+${eyear}'-'${emonth}'-'${eday}'_'${ehour}':00:00'+g > namelist.wps |
---|
409 | ./geogrid.exe |
---|
410 | ./metgrid.exe |
---|
411 | #mv namelist.wps ${simu_folder} |
---|
412 | #mv namelist.wps.tmp namelist.wps |
---|
413 | namedata=$(date +simu_%d%h%Y_%H%M) |
---|
414 | mv ${work_folder}/WPS/WRFFEED/current ${work_folder}'/WPS/WRFFEED/'${namedata} |
---|
415 | echo met_em files in $namedata |
---|
416 | cd ${simu_folder}/met_em |
---|
417 | ln -sf ${work_folder}/WPS/WRFFEED/${namedata}/* . |
---|
418 | cd ${simu_folder} |
---|
419 | else |
---|
420 | echo please compile the WPS utilities in ${work_folder} |
---|
421 | exit |
---|
422 | fi |
---|
423 | fi |
---|
424 | |
---|
425 | ################### |
---|
426 | # 3. RUN REAL.EXE # |
---|
427 | ################### |
---|
428 | if [ ${realstep} -eq 1 ] |
---|
429 | then |
---|
430 | echo '*******************************' |
---|
431 | echo '**** Step 3: Execute real.exe *' |
---|
432 | echo '*******************************' |
---|
433 | cd ${simu_folder} |
---|
434 | if [[ ! -d met_em ]] |
---|
435 | then |
---|
436 | ls |
---|
437 | echo "PB: no met_em files:" |
---|
438 | echo "mkdir met_em folder then link met_em** files !" |
---|
439 | exit |
---|
440 | fi |
---|
441 | cd ${simu_folder}/met_em |
---|
442 | ln -sf ${simu_folder}/namelist.input . |
---|
443 | ln -sf ${simu_folder}/real.exe . |
---|
444 | rm -rf ${simu_folder}/met_em/wrfbdy* 2> /dev/null |
---|
445 | rm -rf ${simu_folder}/met_em/wrfinput* 2> /dev/null |
---|
446 | if [[ ${compilo} -eq 3 ]] |
---|
447 | then |
---|
448 | rm -rf ${simu_folder}/met_em/rsl.* 2> /dev/null |
---|
449 | echo "check in "${simu_folder}"/met_em/rsl.out.0000" |
---|
450 | ./real.exe |
---|
451 | tail -n 4 ${simu_folder}"/met_em/rsl.out.0000" |
---|
452 | else |
---|
453 | rm -rf ${simu_folder}/met_em/log* 2> /dev/null |
---|
454 | echo "check in "${simu_folder}"/met_em/log_real" |
---|
455 | real.exe > log_real |
---|
456 | tail -n 4 ${simu_folder}"/met_em/log_real" |
---|
457 | fi |
---|
458 | if [[ -f ${simu_folder}/met_em/wrfinput_d01 && -f ${simu_folder}/met_em/wrfbdy_d01 ]] |
---|
459 | then |
---|
460 | echo ok... link ini and bdy conditions |
---|
461 | cd ${simu_folder} |
---|
462 | ln -sf ${simu_folder}/met_em/wrf*_d0* . |
---|
463 | else |
---|
464 | echo mmm... there was a problem, see log files in met_em |
---|
465 | exit |
---|
466 | fi |
---|
467 | fi |
---|
468 | |
---|
469 | ################## |
---|
470 | # 4. RUN WRF.EXE # |
---|
471 | ################## |
---|
472 | if [ ${wrfstep} -eq 1 ] |
---|
473 | then |
---|
474 | xeyes & |
---|
475 | echo '******************************' |
---|
476 | echo '**** Step 4: Execute wrf.exe *' |
---|
477 | echo '******************************' |
---|
478 | cd ${simu_folder} |
---|
479 | rm -rf ${simu_folder}/wrfout* |
---|
480 | if [[ ${compilo} -eq 3 ]] |
---|
481 | then |
---|
482 | rm -rf ${simu_folder}/rsl.* 2> /dev/null |
---|
483 | # ${WHERE_MPI}/mpirun -host smith -np ${numproc} wrf.exe < /dev/null & |
---|
484 | ${WHERE_MPI}/mpirun -np ${numproc} wrf.exe < /dev/null & |
---|
485 | else |
---|
486 | rm -rf ${simu_folder}/log* 2> /dev/null |
---|
487 | nohup wrf.exe > log_wrf & |
---|
488 | fi |
---|
489 | echo OK ! Simulation should be running now ! |
---|
490 | echo Check with the command: "ps -e -o '%u %p %C %x %c' | grep wrf.exe" |
---|
491 | echo '******************************' |
---|
492 | echo '**** End.' |
---|
493 | |
---|
494 | fi |
---|
495 | exit |
---|
496 | |
---|
497 | |
---|
498 | |
---|