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

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

MESOSCALE: corrected runmeso and namelist.wps template so that nesting is supported by runmeso. and lowered smoothing coefficient in GEOGRID.TBL from 5 to 3 for topography. raised it from 5 to 10 for thermal inertia because of stripes. lastly: discovered that two-way nesting is now working! to be further investigated.

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