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

Last change on this file since 236 was 236, checked in by aslmd, 14 years ago

MESOSCALE: a commit to allow one to easily work on several clusters with a minimum amount of changes to the script files or includes. basically one has just to edit MESOSCALE/LMD_MM_MARS/SRC/WRFV2/meso_datafile.h for runs with old physics, and add a link to the GCM start database (if not done, there is now a warning in launch_gcm anyway

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