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

Last change on this file since 3553 was 1288, checked in by aslmd, 11 years ago

MESOSCALE. adapted runmeso for free horiz grid with new physics. PLANETOPLOT. improved settings.

  • Property svn:executable set to *
File size: 22.5 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
175if [[ ${newphys} -eq 1 ]]
176then
177  tracers='999'
178  nx='999'
179  ny='999'
180  nz='999'
181else
182  case ${mars_scenario} in
183      0) tracers='1' ;;
184      1) tracers='2' ;;
185      2) tracers='1' ;;
186      3) tracers='2' ;;
187     10) tracers='1' ;;
188     11) tracers='4' ;;
189     12) tracers='6' ;;
190     42) tracers='18' ;;
191      *) tracers='1' ;;
192  esac
193fi
194echo '** Domain(s)             >>> '${nest}
195echo '** Tracer(s)             >>> '${tracers}
196echo '** Grid points           >>> '${nx}" x "${ny}" x "${nz}
197echo '** Horizontal resolution >>> '${dx}
198
199###########
200# ACTIONS #
201###########
202echo '**********************************************'
203echo "** The runmeso script does it for you !"
204echo '**********************************************'
205echo "** Step 0: compile the model if not done yet"
206echo "** Step 1: run GCM and prepare inputs"
207echo "** Step 2: interpolate on domain horizontal grid"
208echo "** Step 3: interpolate on chosen vertical levels"
209echo "** Step 4: run the model"
210echo "************************* Please make a choice"
211echo " 1 --> Perform steps 0 1 2 3 4  [ -1: step 0 skipped]"
212echo " 2 --> Perform steps 0 2 3 4    [ -2: step 0 skipped]"
213echo " 3 --> Perform steps 0 3 4      [ -3: step 0 skipped]"
214echo " 4 --> Perform steps 0 4        [ -4: step 0 skipped]"
215echo "11 --> Perform steps 0 1 2 3    [-11: step 0 skipped]"
216echo "12 --> Perform steps 0 2 3      [-12: step 0 skipped]"
217echo "13 --> Perform steps 0 3        [-13: step 0 skipped]"
218echo " 0 --> Perform step  0 only"
219echo "99 --> Oops ! Exit now please."
220echo '**********************************************'
221echo "What is your choice? " ; read step
222if [[ ${step} -lt 0 ]]
223then
224        step=$(expr 0 - ${step})
225        i_want_to_compile=0
226        echo ".... ok, I skip the compiling & linking step. you'll just be asked the compiler you previously defined."
227fi
228case ${step} in
229        99) exit ;;
230        0)  gcmstep=0 ; wpsstep=0 ; realstep=0 ; wrfstep=0 ;;
231        1)  gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;;
232        2)  gcmstep=0 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;;
233        3)  gcmstep=0 ; wpsstep=0 ; realstep=1 ; wrfstep=1 ;;
234        4)  gcmstep=0 ; wpsstep=0 ; realstep=0 ; wrfstep=1 ;;
235        11) gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=0 ;;
236        12) gcmstep=0 ; wpsstep=1 ; realstep=1 ; wrfstep=0 ;;
237        13) gcmstep=0 ; wpsstep=0 ; realstep=1 ; wrfstep=0 ;;
238        *)  echo "** I guess you do not know what to do. Let's start from the beginning." 
239            gcmstep=1 ; wpsstep=1 ; realstep=1 ; wrfstep=1 ;;
240esac
241
242
243###################################
244# LINK THE EXECUTABLES OR COMPILE #
245###################################
246 echo '**********************************************'
247 echo "** Compiling option "
248 echo "**      <1> pgf90"
249 echo "**      <2> g95"
250 echo "**      <3> mpi+pgf90"
251 echo "**      <4> ifort"
252 echo "**      <5> mpi+ifort"
253 echo "**      .... more in makemeso ...."
254 echo '**********************************************'
255 echo "Your choice ? (1-5)" ; read compilo
256   if [[ "${compilo}" == "" || ${compilo} -lt 1 || ${compilo} -gt 5 ]]
257   then
258       echo "** well, let's try g95"
259       compilo=2
260   fi
261   if [[ ${newphys} -eq 0 ]]
262   then
263    if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
264    then
265       echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc
266    else
267       numproc=1
268    fi
269   else
270    numproc=999
271   fi
272#if [[ ${i_want_to_compile} -ge 1 ]]
273#then
274 cd ${meso_folder}
275 echo ${compilo} > tmp
276   if [[ ${compilo} -eq 3 ]]
277   then
278        echo ${numproc} >> tmp
279   fi
280 echo ${nest} >> tmp
281
282 if [[ ${newphys} -eq 0 ]]
283 then
284 ./makemeso -d < tmp > /dev/null
285 else
286   if [[ "${scenario}" == "" ]]
287   then
288   ./makemeso -d -p < tmp > /dev/null
289   else
290   ./makemeso -d -p -s ${scenario} < tmp > /dev/null
291   fi
292 fi
293 \rm tmp 2> /dev/null
294 work_folder=${meso_folder}'/'$(more what_folder)
295 echo 'work_folder : '${work_folder}
296 \rm what_folder 2> /dev/null
297
298 ##################### NB: define the domain if was not done yet
299   if [[ -f "${simu_folder}/namelist.wps" ]]
300   then
301     happy='y'
302   else
303     happy=''
304   fi
305           if [[ ${step} -eq 1 || ${step} -eq 2 || ${step} -eq 11 || ${step} -eq 12 ]]
306           then
307           while [[ "${happy}" != "y" ]]
308           do
309             #vi ${simu_folder}/namelist.input
310                if [[ ! ( -d "${work_folder}/WPS" ) ]]
311                then
312                    echo 'no WPS. you need to install it for your architecture'
313                    exit
314                fi
315             \rm ${simu_folder}/namelist.wps 2> /dev/null
316             echo '**********************************************'
317             echo "    !!!   NO namelist.wps FILE FOUND   !!!"   
318             echo '**********************************************'
319             echo 'Please define the domain : '
320             echo " - 1/4 Projection: polar lambert mercator ? previous is "${proj} ; read proj
321             echo " - 2/4 Data source (multiple if nests): gcm 32ppd 64ppd 64ppd_noHRti 32ppd_HRalb ? previous is "${data_source} ; read data_source
322             echo " - 3/4 North Latitude of domain centre ? previous is "${lat} ; read lat
323             echo " - 4/4 East  Longitude of domain centre ? previous is "${lon} ; read lon
324             #####
325             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
326             ####
327             if [[ ${nest} -gt 1 ]]
328             then
329                 echo '**********************************************'
330                 echo "USEFUL RULES for NESTS :"
331                 echo "* parent_grid_ratio divides (e_we-s_we+1)"
332                 echo "* nproc divides e_we-1"
333                 echo "* nproc divides e_we-1"
334             fi
335             if [[ ${nest} -ge 4 ]]
336             then
337                 echo more than 3 nests, not supported.
338                 echo ...but not difficult to implement, cf. user manual.
339                 exit
340             fi
341             ####
342             ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps
343             echo '**********************************************'
344             echo OK, thank you. Please wait... ncview will pop up soon !
345             cd ${work_folder}/WPS/
346             \rm geo_em.d0*.nc 2> /dev/null
347             ./geogrid.exe #> /dev/null 2> /dev/null
348             ncview geo_em.d01.nc > /dev/null 2> /dev/null &
349                if [[ -f "geo_em.d02.nc" ]]
350                then
351                     ncview geo_em.d02.nc > /dev/null 2> /dev/null &
352                fi
353                if [[ -f "geo_em.d03.nc" ]]
354                then
355                     ncview geo_em.d03.nc > /dev/null 2> /dev/null &
356                fi
357             cd       ${simu_folder}/
358             echo     '**********************************************' 
359             echo     'Are you happy with the results ? type y if yes, any key if no' ; read happy
360            done
361            fi
362 #####################
363 if [[ ${i_want_to_compile} -ge 1 ]]
364 then
365 cd ${simu_folder}
366     ## corresponding executables
367    wrfexe=${work_folder}/wrf_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}.exe
368    realexe=${work_folder}/real_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}.exe
369 if [[ ${fresh} -eq 0 && -f ${wrfexe} ]]
370 then
371     echo '**********************************************'
372     echo "    !!!   wrf.exe exists in ${work_folder}"
373     echo '**********************************************'
374     echo "Recompile ? ('yes' to accept, any key to refuse)" ; read reply
375 else
376     reply='yes'
377 fi
378 echo '********************************************** OK thanks. Now please wait...'
379 echo '                                       '
380 if [[ "${reply}" == "yes" ]]
381 then
382 #####################
383 echo "** "Begin compilation process...
384 \rm ${wrfexe} 2> /dev/null
385 \rm ${realexe} 2> /dev/null
386   #
387   # CREATE makemeso_input
388   #
389   \rm ${simu_folder}/makemeso_input 2> /dev/null
390   touch ${simu_folder}/makemeso_input
391   echo ${compilo} >> ${simu_folder}/makemeso_input
392   if [[ ${newphys} -eq 0 ]]
393   then
394     if [[ "${compilo}" = "3" || "${compilo}" = "5" ]]
395     then
396         echo ${numproc} >> ${simu_folder}/makemeso_input
397     fi
398     echo ${nx} >> ${simu_folder}/makemeso_input
399     echo ${ny} >> ${simu_folder}/makemeso_input
400     echo ${nz} >> ${simu_folder}/makemeso_input
401   fi
402   echo ${nest} >> ${simu_folder}/makemeso_input
403   if [[ ${newphys} -eq 0 ]]
404   then
405     echo ${tracers} >> ${simu_folder}/makemeso_input
406   fi
407   #
408   # COMPILE THE MODEL
409   #
410   cd ${meso_folder}
411                      #if [[ "${changeregis}" = "1" ]]
412                      #then
413                      #    cd ${work_folder}/WRFV2/Registry
414                      #    \rm Registry 2> /dev/null
415                      #    ./Registry.bash
416                      #    cd ../../..
417                      #fi
418   if [[ ${fresh} -eq 0 ]]
419   then
420     ##******
421     if [[ ${newphys} -eq 0 ]]
422     then
423       ./makemeso -r < ${simu_folder}/makemeso_input
424     else
425         if [[ "${scenario}" == "" ]]
426         then
427          ./makemeso -r -p < ${simu_folder}/makemeso_input
428         else
429          ./makemeso -r -p -s ${scenario} < ${simu_folder}/makemeso_input
430         fi
431     fi
432     ##******
433   else
434     ##******
435     if [[ ${newphys} -eq 0 ]]
436     then
437       ./makemeso -r -f < ${simu_folder}/makemeso_input
438     else
439         if [[ "${scenario}" == "" ]]
440         then
441          ./makemeso -r -p -f < ${simu_folder}/makemeso_input
442         else
443          ./makemeso -r -p -f -s ${scenario} < ${simu_folder}/makemeso_input
444         fi
445     fi
446     ##******
447   fi
448
449   if [[ -f ${wrfexe} ]]
450   then
451       echo "** "seems OK ... linking executables
452       ln -sf ${wrfexe} ${simu_folder}/wrf.exe
453       ln -sf ${realexe} ${simu_folder}/real.exe
454       chmod a+x ${realexe} ${wrfexe} ## sait-on jamais
455       cd $simu_folder
456   else
457       echo no ${wrfexe}
458       echo problem with the compilation
459       exit
460   fi
461 else
462     #echo simply linking existing executables...
463     ln -sf ${wrfexe} ${simu_folder}/wrf.exe
464     ln -sf ${realexe} ${simu_folder}/real.exe
465     chmod a+x ${realexe} ${wrfexe} ## sait-on jamais
466 fi
467fi
468
469######################################
470# 1. RUN GCM FOR INIT/BDY CONDITIONS #
471######################################
472if [ ${gcmstep} -eq 1 ]
473then
474 echo '************************************'
475 echo '**** Step 1: Prepare GCM inputs ****'
476 echo '************************************'
477        #
478        # run GCM
479        #
480        if [[ ${newphys} -eq 0 ]]
481        then
482          cd ${main_folder}'/LMDZ.MARS/'
483        else
484          cd ${main_folder}'/LMDZ.MARS.new/'
485        fi
486        if [[ ! ( -f "gcm.e" ) ]]
487        then
488          echo "Oops. There is no gcm.e, you shall compile the GCM first."
489          exit
490        fi
491        cd myGCM
492        echo ${daygcm} | ./launch_gcm
493        if [[ ! -d startbase ]]
494        then
495          echo "I guess I should stop here."
496          exit
497        fi
498        #
499        # prepare files for WPS
500        #
501        cd ${work_folder}
502        if [[ -f ${work_folder}/PREP_MARS/create_readmeteo.exe && -f ${work_folder}/PREP_MARS/readmeteo.exe ]]
503        then
504              ### This is now generic so PREP_MARS could be moved out of DIRCOMPs files
505              cd ${work_folder}/PREP_MARS/
506              if [[ ${compilo} -eq 1 || ${compilo} -eq 3 ]]
507              then
508                 ln -sf compile_pgf compile
509              fi
510              if [[ ${compilo} -eq 2 ]]
511              then
512                 ln -sf compile_g95 compile
513              fi
514              if [[ ${compilo} -eq 4 || ${compilo} -eq 5 ]]
515              then
516                 ln -sf compile_ifort compile
517              fi
518              if [[ ${compilo} -gt 5 ]]
519              then
520                 echo "please adapt compile in PREP_MARS"
521              fi
522              ./compile_and_exec
523              #echo 1 | ./create_readmeteo.exe
524              #./readmeteo.exe < readmeteo.def
525        else
526              echo please compile the PREP_MARS utilities in ${work_folder}
527              exit
528        fi
529fi     
530
531###################################
532# 2. RUN WRF PREPROCESSING SYSTEM #
533###################################
534if [ ${wpsstep} -eq 1 ]
535then
536 echo '*****************************************'
537 echo '**** Step 2: Perform WPS interpolations *'
538 echo '*****************************************'
539        if [[ -f ${work_folder}/WPS/geogrid.exe && -f ${work_folder}/WPS/metgrid.exe ]]
540        then
541              \rm -rf ${simu_folder}/met_em 2> /dev/null
542              mkdir ${simu_folder}/met_em
543              cd ${work_folder}/WPS/
544              \rm -rf ${work_folder}/WPS/WRFFEED/current 2> /dev/null
545              mkdir ${work_folder}/WPS/WRFFEED/current
546              ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps
547              #mv namelist.wps namelist.wps.tmp
548              #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
549              ./geogrid.exe
550              ./metgrid.exe
551              #mv namelist.wps ${simu_folder}
552              #mv namelist.wps.tmp namelist.wps 
553              namedata=$(date +simu_%d%h%Y_%H%M)
554              mv ${work_folder}/WPS/WRFFEED/current ${work_folder}'/WPS/WRFFEED/'${namedata}
555              echo met_em files in $namedata
556              cd ${simu_folder}/met_em
557              ln -sf ${work_folder}/WPS/WRFFEED/${namedata}/* .
558              cd ${simu_folder}
559        else
560              echo please compile the WPS utilities in ${work_folder}
561              exit
562        fi
563fi     
564
565###################
566# 3. RUN REAL.EXE #
567###################
568if [ ${realstep} -eq 1 ]
569then
570 echo '*******************************'
571 echo '**** Step 3: Execute real.exe *'
572 echo '*******************************'
573        cd ${simu_folder}
574        if [[ ! -d met_em ]]
575        then
576                ls
577                echo "PB: no met_em files:"
578                echo "mkdir met_em folder then link met_em** files !"
579                exit
580        fi
581        cd ${simu_folder}/met_em
582        ln -sf ${simu_folder}/namelist.input .
583        ln -sf ${simu_folder}/real.exe .
584        ln -sf ${simu_folder}/levels .
585        rm -rf ${simu_folder}/met_em/wrfbdy* 2> /dev/null
586        rm -rf ${simu_folder}/met_em/wrfinput* 2> /dev/null
587        if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
588        then
589                rm -rf ${simu_folder}/met_em/rsl.* 2> /dev/null
590                echo "check in "${simu_folder}"/met_em/rsl.out.0000"
591                ./real.exe
592                tail -n 4 ${simu_folder}"/met_em/rsl.out.0000"
593        else
594                rm -rf ${simu_folder}/met_em/log* 2> /dev/null
595                echo "check in "${simu_folder}"/met_em/log_real"
596                real.exe > log_real
597                tail -n 4 ${simu_folder}"/met_em/log_real"
598        fi
599        if [[ -f ${simu_folder}/met_em/wrfinput_d01 && -f ${simu_folder}/met_em/wrfbdy_d01 ]]
600        then
601                echo ok... link ini and bdy conditions
602                cd ${simu_folder}
603                ln -sf ${simu_folder}/met_em/wrf*_d0* .
604        else
605                echo mmm... there was a problem, see log files in met_em
606                exit
607        fi
608fi
609
610##################
611# 4. RUN WRF.EXE #
612##################
613if [ ${wrfstep} -eq 1 ]
614then
615 echo '******************************'
616 echo '**** Step 4: Execute wrf.exe *'
617 echo '******************************'
618        cd ${simu_folder}
619        rm -rf ${simu_folder}/wrfout*
620        if [[ ${compilo} -eq 5 ]]
621        then
622                ulimit -s unlimited
623        fi
624        if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
625        then
626                rm -rf ${simu_folder}/rsl.* 2> /dev/null
627#                ${WHERE_MPI}/mpirun -host smith -np ${numproc} wrf.exe < /dev/null &
628                nohup ${WHERE_MPI}/mpirun -np ${numproc} wrf.exe < /dev/null > log_wrf_mpirun &
629        else
630                rm -rf ${simu_folder}/log* 2> /dev/null
631                nohup wrf.exe > log_wrf &
632        fi
633echo OK ! Simulation should be running now !
634echo Check with the command: "ps -e -o '%u %p %C %x %c' | grep wrf.exe"
635echo '******************************'
636echo '**** End.'
637
638fi
639xeyes &
640exit
641
642
643
Note: See TracBrowser for help on using the repository browser.