source: trunk/MESOSCALE/LMD_MM_MARS/SIMU/runmeso @ 598

Last change on this file since 598 was 577, checked in by aslmd, 13 years ago

MESOSCALE: minor commit : def files; a small correction in runmeso; cosmetic in module_lmd_driver; nircorr=0 default for MESOSCALE in inifis.

  • Property svn:executable set to *
File size: 23.0 KB
Line 
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# Modified    : 2009-2010     #
11# New physics : 2011          #
12###############################
13
14# TODO: - GCM compile
15#       - NETCDF
16#       - (modif registry)
17#       - quick restart
18
19
20###########################################
21###########################################
22###########################################
23
24
25i_want_to_compile=1
26scenario=""
27#scenario="storm"
28
29###########################################
30###########################################
31
32fresh=0
33while getopts "f" options; do
34  case $options in
35   f ) fresh=1;;       
36  esac
37done   
38
39if [[ "${MESO}" = "" ]]
40then
41    echo "Please initialize the variable MESO in your environnement (or modify scripts)"
42    exit
43fi
44####################################
45# A FEW DEFINITIONS YOU CAN MODIFY #
46####################################
47main_folder=$MESO
48meso_folder=${main_folder}'/LMD_MM_MARS'
49calendar=${main_folder}'/LMD_MM_MARS/SIMU/calendar'
50simu_folder=$PWD
51
52################
53# WELCOME USER #
54################
55echo '**********************************************'
56echo '**** LMD Martian Mesoscale Model launcher ****'
57echo '**********************************************'
58echo '** User                  >>> '$(whoami)
59echo '** Hostname              >>> '$(hostname)
60echo '** Hardware              >>> '$(uname -m)
61echo '** Processor             >>> '$(uname -p)
62echo '**********************************************'
63
64       ######## NEWPHYS ???
65       if [[ ! ( -f "run.def" ) ]]
66       then
67         newphys=0
68       else
69         echo '** New LMD physics       >>> YES [run.def is here]'
70         echo '**********************************************'
71         newphys=1
72         if [[ ! ("${scenario}" == "") ]]
73         then     
74            echo '** Scenario              >>>' ${scenario}
75            echo '**********************************************'
76         fi
77       fi
78
79##########################
80# GET INFO FROM NAMELIST #
81##########################
82#echo '***********************'
83#echo '**** Your settings ****'
84#echo '***********************'
85echo '** Simulation directory  >>> '${simu_folder}
86if [[ ! ( -f "namelist.input" ) ]]
87then
88   echo 'no namelist.input file !'
89   exit
90fi
91#
92# READ INFO NEEDED FOR INIT
93#
94year=$(more ${simu_folder}/namelist.input | grep start_year | awk '{print $3}' | sed s+','+''+g)
95month=$(more ${simu_folder}/namelist.input | grep start_month | awk '{print $3}' | sed s+','+''+g)
96day=$(more ${simu_folder}/namelist.input | grep start_day | awk '{print $3}' | sed s+','+''+g)
97hour=$(more ${simu_folder}/namelist.input | grep start_hour | awk '{print $3}' | sed s+','+''+g)
98wrf_date=${year}'-'${month}'-'${day}'_00:00:00'
99daygcm=$(more ${calendar} | grep ${wrf_date} | awk '{print $2}')
100lsubs=$(more ${calendar} | grep ${wrf_date} | awk '{print $3}')
101eyear=$(more ${simu_folder}/namelist.input | grep end_year | awk '{print $3}' | sed s+','+''+g)
102emonth=$(more ${simu_folder}/namelist.input | grep end_month | awk '{print $3}' | sed s+','+''+g)
103eday=$(more ${simu_folder}/namelist.input | grep end_day | awk '{print $3}' | sed s+','+''+g)
104ehour=$(more ${simu_folder}/namelist.input | grep end_hour | awk '{print $3}' | sed s+','+''+g)
105ewrf_date=${eyear}'-'${emonth}'-'${eday}'_00:00:00'
106edaygcm=$(more ${calendar} | grep ${ewrf_date} | awk '{print $2}')
107elsubs=$(more ${calendar} | grep ${ewrf_date} | awk '{print $3}')
108echo '** Start date            >>> '${year}'-'${month}'-'${day}" [sol="${daygcm}", Ls="${lsubs}"]"
109echo '** End date              >>> '${eyear}'-'${emonth}'-'${eday}" [sol="${edaygcm}", Ls="${elsubs}"]"
110#
111# READ INFO NEEDED FOR DOMAIN
112#
113interval_seconds="$(more ${simu_folder}/namelist.input | grep -e '[^!]*interval_seconds *=')"
114if [[ "${interval_seconds}" = "" ]]
115then
116     interval_seconds="interval_seconds = 3700 !! (p2) Frequency of large-scale fields update (s)"
117fi
118#
119max_dom="$(more ${simu_folder}/namelist.input | grep -e '[^!]*max_dom *=')"
120if [[ "${max_dom}" = "" ]]
121then
122     max_dom="max_dom = 1 !! (r)(n)(p2) Total number of domains"
123fi
124#
125parent_id="$(more ${simu_folder}/namelist.input | grep -e '[^!]*parent_id *=')"
126if [[ "${parent_id}" = "" ]]
127then
128     parent_id="parent_id = 0, !! (n)(p2) Associated parent domain"
129fi
130#
131i_parent_start="$(more ${simu_folder}/namelist.input | grep -e '[^!]*i_parent_start *=')"
132if [[ "${i_parent_start}" = "" ]]
133then
134     i_parent_start="i_parent_start = 0, !! (n)(p2) x-position of the bottom-left nest corner"
135fi
136#
137j_parent_start="$(more ${simu_folder}/namelist.input | grep -e '[^!]*j_parent_start *=')"
138if [[ "${j_parent_start}" = "" ]]
139then
140     j_parent_start="j_parent_start = 0, !! (n)(p2) y-position of the bottom-left nest corner"
141fi
142#
143parent_grid_ratio="$(more ${simu_folder}/namelist.input | grep -e '[^!]*parent_grid_ratio *=')"
144if [[ "${parent_grid_ratio}" = "" ]]
145then
146     parent_grid_ratio="parent_grid_ratio = 1, !! (n)(p2) Ratio of horizontal resolution parent/nest"
147fi
148#
149e_we="$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_we *=')"
150e_sn="$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_sn *=')"
151#
152dx="$(more ${simu_folder}/namelist.input | grep -e '[^!]*dx *=' | awk '{print $3}' | sed s+','+''+g)"
153dy="$(more ${simu_folder}/namelist.input | grep -e '[^!]*dy *=' | awk '{print $3}' | sed s+','+''+g)"
154
155#
156# READ INFO NEEDED FOR COMPILATION
157#
158nx=$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_we *=' | awk '{print $3}' | sed s+','+''+g)
159ny=$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_sn *=' | awk '{print $3}' | sed s+','+''+g)
160nz=$(more ${simu_folder}/namelist.input | grep -e '[^!]*e_vert *=' | awk '{print $3}' | sed s+','+''+g)
161nest=$(more ${simu_folder}/namelist.input | grep -e '[^!]*max_dom *=' | awk '{print $3}' | sed s+','+''+g)
162  if [[ "${nest}" = "" ]]
163  then
164     nest='1'
165  fi
166  numcallphys=$(ls callphys*def | wc -l)
167  if [[ ${numcallphys} -lt ${nest} ]]
168  then
169        echo '**********'
170        echo You should have ${nest} callphys.def' file(s)' !!
171        exit
172  fi
173mars_scenario=$(more ${simu_folder}/namelist.input | grep mars | awk '{print $3}' | sed s+','+''+g)
174  case ${mars_scenario} in
175      0) tracers='1' ;;
176      1) tracers='2' ;;
177      2) tracers='1' ;;
178      3) tracers='2' ;;
179     11) tracers='4' ;;
180     12) tracers='6' ;;
181     42) tracers='18' ;;
182      *) tracers='1' ;;
183  esac
184echo '** Domain(s)             >>> '${nest}
185echo '** Tracer(s)             >>> '${tracers}
186
187   ############ SCATTERERS SCATTERERS ######
188   if [[ ${newphys} -eq 1 ]]
189   then
190     #### CHANGE THIS IF YOU ADD NEW SCENARIOS
191     case ${mars_scenario} in
192       0) scat=1 ;;
193       1) echo "!! How many scatterers are you using : 1,2,..." ; read scat ;;
194       2) scat=1 ;;
195       3) scat=1 ;;
196      11) echo "!! How many scatterers are you using : 1,2,..." ; read scat ;;
197      12) echo "!! How many scatterers are you using : 1,2,..." ; read scat ;;
198      20) scat=1 ;;
199       *) scat=1 ;;
200     esac
201     echo '** Scatterers            >>> '${scat}
202   else
203     #### USELESS here BUT COMPATIBILITY
204     scat=1
205   fi
206   #########################################
207
208echo '** Grid points           >>> '${nx}" x "${ny}" x "${nz}
209echo '** Horizontal resolution >>> '${dx}
210
211###########
212# ACTIONS #
213###########
214echo '**********************************************'
215echo "** The runmeso script does it for you !"
216echo '**********************************************'
217echo "** Step 0: compile the model if not done yet"
218echo "** Step 1: run GCM and prepare inputs"
219echo "** Step 2: interpolate on domain horizontal grid"
220echo "** Step 3: interpolate on chosen vertical levels"
221echo "** Step 4: run the model"
222echo "************************* Please make a choice"
223echo " 1 --> Perform steps 0 1 2 3 4  [ -1: step 0 skipped]"
224echo " 2 --> Perform steps 0 2 3 4    [ -2: step 0 skipped]"
225echo " 3 --> Perform steps 0 3 4      [ -3: step 0 skipped]"
226echo " 4 --> Perform steps 0 4        [ -4: step 0 skipped]"
227echo "11 --> Perform steps 0 1 2 3    [-11: step 0 skipped]"
228echo "12 --> Perform steps 0 2 3      [-12: step 0 skipped]"
229echo "13 --> Perform steps 0 3        [-13: step 0 skipped]"
230echo " 0 --> Perform step  0 only"
231echo "99 --> Oops ! Exit now please."
232echo '**********************************************'
233echo "What is your choice? " ; read step
234if [[ ${step} -lt 0 ]]
235then
236        step=$(expr 0 - ${step})
237        i_want_to_compile=0
238        echo ".... ok, I skip the compiling & linking step. you'll just be asked the compiler you previously defined."
239fi
240case ${step} in
241        99) exit ;;
242        0)  gcmstep=0 ; wpsstep=0 ; realstep=0 ; wrfstep=0 ;;
243        1)  gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;;
244        2)  gcmstep=0 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;;
245        3)  gcmstep=0 ; wpsstep=0 ; realstep=1 ; wrfstep=1 ;;
246        4)  gcmstep=0 ; wpsstep=0 ; realstep=0 ; wrfstep=1 ;;
247        11) gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=0 ;;
248        12) gcmstep=0 ; wpsstep=1 ; realstep=1 ; wrfstep=0 ;;
249        13) gcmstep=0 ; wpsstep=0 ; realstep=1 ; wrfstep=0 ;;
250        *)  echo "** I guess you do not know what to do. Let's start from the beginning." 
251            gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;;
252esac
253
254
255###################################
256# LINK THE EXECUTABLES OR COMPILE #
257###################################
258 echo '**********************************************'
259 echo "** Compiling option "
260 echo "**      <1> pgf90"
261 echo "**      <2> g95"
262 echo "**      <3> mpi+pgf90"
263 echo "**      <4> ifort"
264 echo "**      <5> mpi+ifort"
265 echo "**      .... more in makemeso ...."
266 echo '**********************************************'
267 echo "Your choice ? (1-5)" ; read compilo
268   if [[ "${compilo}" == "" || ${compilo} -lt 1 || ${compilo} -gt 5 ]]
269   then
270       echo "** well, let's try g95"
271       compilo=2
272   fi
273   if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
274   then
275       echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc
276   else
277       numproc=1
278   fi
279#if [[ ${i_want_to_compile} -ge 1 ]]
280#then
281 cd ${meso_folder}
282 echo ${compilo} > tmp
283   if [[ ${compilo} -eq 3 ]]
284   then
285        echo ${numproc} >> tmp
286   fi
287 echo ${nest} >> tmp
288
289 if [[ ${newphys} -eq 0 ]]
290 then
291 ./makemeso -d < tmp > /dev/null
292 else
293   if [[ "${scenario}" == "" ]]
294   then
295   ./makemeso -d -p < tmp > /dev/null
296   else
297   ./makemeso -d -p -s ${scenario} < tmp > /dev/null
298   fi
299 fi
300 \rm tmp 2> /dev/null
301 work_folder=${meso_folder}'/'$(more what_folder)
302 echo 'work_folder : '${work_folder}
303 \rm what_folder 2> /dev/null
304
305 ##################### NB: define the domain if was not done yet
306   if [[ -f "${simu_folder}/namelist.wps" ]]
307   then
308     happy='y'
309   else
310     happy=''
311   fi
312           if [[ ${step} -eq 1 || ${step} -eq 2 || ${step} -eq 11 || ${step} -eq 12 ]]
313           then
314           while [[ "${happy}" != "y" ]]
315           do
316             #vi ${simu_folder}/namelist.input
317                if [[ ! ( -d "${work_folder}/WPS" ) ]]
318                then
319                    echo 'no WPS. you need to install it for your architecture'
320                    exit
321                fi
322             \rm ${simu_folder}/namelist.wps 2> /dev/null
323             echo '**********************************************'
324             echo "    !!!   NO namelist.wps FILE FOUND   !!!"   
325             echo '**********************************************'
326             echo 'Please define the domain : '
327             echo " - 1/4 Projection: polar lambert mercator ? previous is "${proj} ; read proj
328             echo " - 2/4 Data source (multiple if nests): gcm 32ppd 64ppd 64ppd_noHRti 32ppd_HRalb ? previous is "${data_source} ; read data_source
329             echo " - 3/4 North Latitude of domain centre ? previous is "${lat} ; read lat
330             echo " - 4/4 East  Longitude of domain centre ? previous is "${lon} ; read lon
331             #####
332             sed s+"__INTERVAL_SECONDS__"+"${interval_seconds}"+g ${meso_folder}/SIMU/namelist.wps.template | 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
333             ####
334             if [[ ${nest} -gt 1 ]]
335             then
336                 echo '**********************************************'
337                 echo "USEFUL RULES for NESTS :"
338                 echo "* parent_grid_ratio divides (e_we-s_we+1)"
339                 echo "* nproc divides e_we-1"
340                 echo "* nproc divides e_we-1"
341             fi
342             if [[ ${nest} -ge 4 ]]
343             then
344                 echo more than 3 nests, not supported.
345                 echo ...but not difficult to implement, cf. user manual.
346                 exit
347             fi
348             ####
349             ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps
350             echo '**********************************************'
351             echo OK, thank you. Please wait... ncview will pop up soon !
352             cd ${work_folder}/WPS/
353             \rm geo_em.d0*.nc 2> /dev/null
354             ./geogrid.exe #> /dev/null 2> /dev/null
355             ncview geo_em.d01.nc > /dev/null 2> /dev/null &
356                if [[ -f "geo_em.d02.nc" ]]
357                then
358                     ncview geo_em.d02.nc > /dev/null 2> /dev/null &
359                fi
360                if [[ -f "geo_em.d03.nc" ]]
361                then
362                     ncview geo_em.d03.nc > /dev/null 2> /dev/null &
363                fi
364             cd       ${simu_folder}/
365             echo     '**********************************************' 
366             echo     'Are you happy with the results ? type y if yes, any key if no' ; read happy
367            done
368            fi
369 #####################
370 if [[ ${i_want_to_compile} -ge 1 ]]
371 then
372 cd ${simu_folder}
373     ## corresponding executables
374    wrfexe=${work_folder}/wrf_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}_s${scat}.exe
375    realexe=${work_folder}/real_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}_s${scat}.exe
376 if [[ ${fresh} -eq 0 && -f ${wrfexe} ]]
377 then
378     echo '**********************************************'
379     echo "    !!!   wrf.exe exists in ${work_folder}"
380     echo '**********************************************'
381     echo "Recompile ? ('yes' to accept, any key to refuse)" ; read reply
382 else
383     reply='yes'
384 fi
385 echo '********************************************** OK thanks. Now please wait...'
386 echo '                                       '
387 if [[ "${reply}" == "yes" ]]
388 then
389 #####################
390 echo "** "Begin compilation process...
391 \rm ${wrfexe} 2> /dev/null
392 \rm ${realexe} 2> /dev/null
393   #
394   # CREATE makemeso_input
395   #
396   \rm ${simu_folder}/makemeso_input 2> /dev/null
397   touch ${simu_folder}/makemeso_input
398   echo ${compilo} >> ${simu_folder}/makemeso_input
399   if [[ "${compilo}" = "3" || "${compilo}" = "5" ]]
400     then
401         echo ${numproc} >> ${simu_folder}/makemeso_input
402   fi
403   echo ${nx} >> ${simu_folder}/makemeso_input
404   echo ${ny} >> ${simu_folder}/makemeso_input
405   echo ${nz} >> ${simu_folder}/makemeso_input
406   echo ${nest} >> ${simu_folder}/makemeso_input
407   echo ${tracers} >> ${simu_folder}/makemeso_input
408   if [[ ${newphys} -eq 1 ]]
409   then
410     echo ${scat} >> ${simu_folder}/makemeso_input
411     #echo 'n' >> ${simu_folder}/makemeso_input
412   fi
413   #
414   # COMPILE THE MODEL
415   #
416   cd ${meso_folder}
417                      #if [[ "${changeregis}" = "1" ]]
418                      #then
419                      #    cd ${work_folder}/WRFV2/Registry
420                      #    \rm Registry 2> /dev/null
421                      #    ./Registry.bash
422                      #    cd ../../..
423                      #fi
424   if [[ ${fresh} -eq 0 ]]
425   then
426     ##******
427     if [[ ${newphys} -eq 0 ]]
428     then
429       ./makemeso -r < ${simu_folder}/makemeso_input
430     else
431         if [[ "${scenario}" == "" ]]
432         then
433          ./makemeso -r -p < ${simu_folder}/makemeso_input
434         else
435          ./makemeso -r -p -s ${scenario} < ${simu_folder}/makemeso_input
436         fi
437     fi
438     ##******
439   else
440     ##******
441     if [[ ${newphys} -eq 0 ]]
442     then
443       ./makemeso -r -f < ${simu_folder}/makemeso_input
444     else
445         if [[ "${scenario}" == "" ]]
446         then
447          ./makemeso -r -p -f < ${simu_folder}/makemeso_input
448         else
449          ./makemeso -r -p -f -s ${scenario} < ${simu_folder}/makemeso_input
450         fi
451     fi
452     ##******
453   fi
454
455   if [[ -f ${wrfexe} ]]
456   then
457       echo "** "seems OK ... linking executables
458       ln -sf ${wrfexe} ${simu_folder}/wrf.exe
459       ln -sf ${realexe} ${simu_folder}/real.exe
460       chmod a+x ${realexe} ${wrfexe} ## sait-on jamais
461       cd $simu_folder
462   else
463       echo no ${wrfexe}
464       echo problem with the compilation
465       exit
466   fi
467 else
468     #echo simply linking existing executables...
469     ln -sf ${wrfexe} ${simu_folder}/wrf.exe
470     ln -sf ${realexe} ${simu_folder}/real.exe
471     chmod a+x ${realexe} ${wrfexe} ## sait-on jamais
472 fi
473fi
474
475######################################
476# 1. RUN GCM FOR INIT/BDY CONDITIONS #
477######################################
478if [ ${gcmstep} -eq 1 ]
479then
480 echo '************************************'
481 echo '**** Step 1: Prepare GCM inputs ****'
482 echo '************************************'
483        #
484        # run GCM
485        #
486        if [[ ${newphys} -eq 0 ]]
487        then
488          cd ${main_folder}'/LMDZ.MARS/'
489        else
490          cd ${main_folder}'/LMDZ.MARS.new/'
491        fi
492        if [[ ! ( -f "gcm.e" ) ]]
493        then
494          echo "Oops. There is no gcm.e, you shall compile the GCM first."
495          exit
496        fi
497        cd myGCM
498        echo ${daygcm} | ./launch_gcm
499        if [[ ! -d startbase ]]
500        then
501          echo "I guess I should stop here."
502          exit
503        fi
504        #
505        # prepare files for WPS
506        #
507        cd ${work_folder}
508        if [[ -f ${work_folder}/PREP_MARS/create_readmeteo.exe && -f ${work_folder}/PREP_MARS/readmeteo.exe ]]
509        then
510              ### This is now generic so PREP_MARS could be moved out of DIRCOMPs files
511              cd ${work_folder}/PREP_MARS/
512              if [[ ${compilo} -eq 1 || ${compilo} -eq 3 ]]
513              then
514                 ln -sf compile_pgf compile
515              fi
516              if [[ ${compilo} -eq 2 ]]
517              then
518                 ln -sf compile_g95 compile
519              fi
520              if [[ ${compilo} -eq 4 || ${compilo} -eq 5 ]]
521              then
522                 ln -sf compile_ifort compile
523              fi
524              if [[ ${compilo} -gt 5 ]]
525              then
526                 echo "please adapt compile in PREP_MARS"
527              fi
528              ./compile_and_exec
529              #echo 1 | ./create_readmeteo.exe
530              #./readmeteo.exe < readmeteo.def
531        else
532              echo please compile the PREP_MARS utilities in ${work_folder}
533              exit
534        fi
535fi     
536
537###################################
538# 2. RUN WRF PREPROCESSING SYSTEM #
539###################################
540if [ ${wpsstep} -eq 1 ]
541then
542 echo '*****************************************'
543 echo '**** Step 2: Perform WPS interpolations *'
544 echo '*****************************************'
545        if [[ -f ${work_folder}/WPS/geogrid.exe && -f ${work_folder}/WPS/metgrid.exe ]]
546        then
547              \rm -rf ${simu_folder}/met_em 2> /dev/null
548              mkdir ${simu_folder}/met_em
549              cd ${work_folder}/WPS/
550              \rm -rf ${work_folder}/WPS/WRFFEED/current 2> /dev/null
551              mkdir ${work_folder}/WPS/WRFFEED/current
552              ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps
553              #mv namelist.wps namelist.wps.tmp
554              #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
555              ./geogrid.exe
556              ./metgrid.exe
557              #mv namelist.wps ${simu_folder}
558              #mv namelist.wps.tmp namelist.wps 
559              namedata=$(date +simu_%d%h%Y_%H%M)
560              mv ${work_folder}/WPS/WRFFEED/current ${work_folder}'/WPS/WRFFEED/'${namedata}
561              echo met_em files in $namedata
562              cd ${simu_folder}/met_em
563              ln -sf ${work_folder}/WPS/WRFFEED/${namedata}/* .
564              cd ${simu_folder}
565        else
566              echo please compile the WPS utilities in ${work_folder}
567              exit
568        fi
569fi     
570
571###################
572# 3. RUN REAL.EXE #
573###################
574if [ ${realstep} -eq 1 ]
575then
576 echo '*******************************'
577 echo '**** Step 3: Execute real.exe *'
578 echo '*******************************'
579        cd ${simu_folder}
580        if [[ ! -d met_em ]]
581        then
582                ls
583                echo "PB: no met_em files:"
584                echo "mkdir met_em folder then link met_em** files !"
585                exit
586        fi
587        cd ${simu_folder}/met_em
588        ln -sf ${simu_folder}/namelist.input .
589        ln -sf ${simu_folder}/real.exe .
590        ln -sf ${simu_folder}/levels .
591        rm -rf ${simu_folder}/met_em/wrfbdy* 2> /dev/null
592        rm -rf ${simu_folder}/met_em/wrfinput* 2> /dev/null
593        if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
594        then
595                rm -rf ${simu_folder}/met_em/rsl.* 2> /dev/null
596                echo "check in "${simu_folder}"/met_em/rsl.out.0000"
597                ./real.exe
598                tail -n 4 ${simu_folder}"/met_em/rsl.out.0000"
599        else
600                rm -rf ${simu_folder}/met_em/log* 2> /dev/null
601                echo "check in "${simu_folder}"/met_em/log_real"
602                real.exe > log_real
603                tail -n 4 ${simu_folder}"/met_em/log_real"
604        fi
605        if [[ -f ${simu_folder}/met_em/wrfinput_d01 && -f ${simu_folder}/met_em/wrfbdy_d01 ]]
606        then
607                echo ok... link ini and bdy conditions
608                cd ${simu_folder}
609                ln -sf ${simu_folder}/met_em/wrf*_d0* .
610        else
611                echo mmm... there was a problem, see log files in met_em
612                exit
613        fi
614fi
615
616##################
617# 4. RUN WRF.EXE #
618##################
619if [ ${wrfstep} -eq 1 ]
620then
621 echo '******************************'
622 echo '**** Step 4: Execute wrf.exe *'
623 echo '******************************'
624        cd ${simu_folder}
625        rm -rf ${simu_folder}/wrfout*
626        if [[ ${compilo} -eq 5 ]]
627        then
628                ulimit -s unlimited
629        fi
630        if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
631        then
632                rm -rf ${simu_folder}/rsl.* 2> /dev/null
633#                ${WHERE_MPI}/mpirun -host smith -np ${numproc} wrf.exe < /dev/null &
634                nohup ${WHERE_MPI}/mpirun -np ${numproc} wrf.exe < /dev/null > log_wrf_mpirun &
635        else
636                rm -rf ${simu_folder}/log* 2> /dev/null
637                nohup wrf.exe > log_wrf &
638        fi
639echo OK ! Simulation should be running now !
640echo Check with the command: "ps -e -o '%u %p %C %x %c' | grep wrf.exe"
641echo '******************************'
642echo '**** End.'
643
644fi
645xeyes &
646exit
647
648
649
Note: See TracBrowser for help on using the repository browser.