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

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

MESOSCALE : Preparatory commit for the ultimate option mars=42 which

would allow mesoscale modeling with photochemistry.

[see r76 method to add 'mars' options]
Modified module_lmd_driver.F and Registry.EM and runmeso
Modified readmeteo.F90 and introduced an option -DPHOTOCHEM
...
Transparent to the casual user
Option mars=42 not yet finished though -- so do not use!

  • Property svn:executable set to *
File size: 22.8 KB
RevLine 
[11]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 #
[32]10# Modified    : 2009-2010     #
11# New physics : 2011          #
[11]12###############################
13
14# TODO: - GCM compile
15#       - NETCDF
16#       - (modif registry)
17#       - quick restart
18
19
20###########################################
21###########################################
22###########################################
23
[261]24
[11]25i_want_to_compile=1
[118]26scenario=""
[155]27#scenario="storm"
[118]28
[261]29###########################################
30###########################################
31
[262]32fresh=0
33while getopts "f" options; do
[261]34  case $options in
[274]35   f ) fresh=1;;       
[261]36  esac
37done   
38
[234]39if [[ "${MESO}" = "" ]]
[11]40then
[234]41    echo "Please initialize the variable MESO in your environnement (or modify scripts)"
[11]42    exit
43fi
44####################################
45# A FEW DEFINITIONS YOU CAN MODIFY #
46####################################
[234]47main_folder=$MESO
[11]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
[32]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
[118]72         if [[ ! ("${scenario}" == "") ]]
73         then     
74            echo '** Scenario              >>>' ${scenario}
75            echo '**********************************************'
76         fi
[32]77       fi
78
[11]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
[153]173mars_scenario=$(more ${simu_folder}/namelist.input | grep mars | awk '{print $3}' | sed s+','+''+g)
174  case ${mars_scenario} in
[11]175      0) tracers='1' ;;
176      1) tracers='2' ;;
[76]177      2) tracers='1' ;;
178      3) tracers='2' ;;
179     11) tracers='4' ;;
[324]180     42) tracers='18' ;;
[11]181      *) tracers='1' ;;
182  esac
183echo '** Domain(s)             >>> '${nest}
184echo '** Tracer(s)             >>> '${tracers}
[153]185
186   ############ SCATTERERS SCATTERERS ######
187   if [[ ${newphys} -eq 1 ]]
188   then
189     #### CHANGE THIS IF YOU ADD NEW SCENARIOS
190     case ${mars_scenario} in
191       0) scat=1 ;;
192       1) echo "!! How many scatterers are you using : 1,2,..." ; read scat ;;
193       2) scat=1 ;;
194       3) scat=1 ;;
195      11) echo "!! How many scatterers are you using : 1,2,..." ; read scat ;;
196      20) scat=1 ;;
197       *) scat=1 ;;
198     esac
199     echo '** Scatterers            >>> '${scat}
200   else
201     #### USELESS here BUT COMPATIBILITY
202     scat=1
203   fi
204   #########################################
205
[11]206echo '** Grid points           >>> '${nx}" x "${ny}" x "${nz}
207echo '** Horizontal resolution >>> '${dx}
[153]208
[11]209###########
210# ACTIONS #
211###########
212echo '**********************************************'
[235]213echo "** The runmeso script does it for you !"
[11]214echo '**********************************************'
[235]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
[11]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
[235]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 ;;
[11]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"
[60]261 echo "**      <4> ifort"
262 echo "**      <5> mpi+ifort"
[32]263 echo "**      .... more in makemeso ...."
[11]264 echo '**********************************************'
[60]265 echo "Your choice ? (1-5)" ; read compilo
266   if [[ "${compilo}" == "" || ${compilo} -lt 1 || ${compilo} -gt 5 ]]
[11]267   then
268       echo "** well, let's try g95"
269       compilo=2
270   fi
[60]271   if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
[11]272   then
[235]273       echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc
[11]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
[32]286
287 if [[ ${newphys} -eq 0 ]]
288 then
[11]289 ./makemeso -d < tmp > /dev/null
[32]290 else
[118]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
[32]297 fi
[11]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
[32]302
[11]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
[274]310           if [[ ${step} -eq 1 || ${step} -eq 2 || ${step} -eq 11 || ${step} -eq 12 ]]
[11]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 '**********************************************'
[279]324             echo 'Please define the domain : '
[11]325             echo " - 1/4 Projection: polar lambert mercator ? previous is "${proj} ; read proj
[242]326             echo " - 2/4 Data source (multiple if nests): gcm 32ppd 64ppd 64ppd_noHRti 32ppd_HRalb ? previous is "${data_source} ; read data_source
[11]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             ####
[242]332             if [[ ${nest} -gt 1 ]]
333             then
334                 echo '**********************************************'
335                 echo "USEFUL RULES for NESTS :"
336                 echo "* parent_grid_ratio divides (e_we-s_we+1)"
337                 echo "* nproc divides e_we-1"
338                 echo "* nproc divides e_we-1"
339             fi
340             if [[ ${nest} -ge 4 ]]
341             then
342                 echo more than 3 nests, not supported
343                 echo please edit the namelist.wps template in WPS to allow this
344                 exit
345             fi
346             ####
[11]347             ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps
348             echo '**********************************************'
349             echo OK, thank you. Please wait... ncview will pop up soon !
350             cd ${work_folder}/WPS/
351             \rm geo_em.d0*.nc 2> /dev/null
[242]352             ./geogrid.exe #> /dev/null 2> /dev/null
[11]353             ncview geo_em.d01.nc > /dev/null 2> /dev/null &
354                if [[ -f "geo_em.d02.nc" ]]
355                then
356                     ncview geo_em.d02.nc > /dev/null 2> /dev/null &
357                fi
358                if [[ -f "geo_em.d03.nc" ]]
359                then
360                     ncview geo_em.d03.nc > /dev/null 2> /dev/null &
361                fi
362             cd       ${simu_folder}/
363             echo     '**********************************************' 
364             echo     'Are you happy with the results ? type y if yes, any key if no' ; read happy
365            done
366            fi
367 #####################
368 if [[ ${i_want_to_compile} -ge 1 ]]
369 then
370 cd ${simu_folder}
371     ## corresponding executables
[153]372    wrfexe=${work_folder}/wrf_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}_s${scat}.exe
373    realexe=${work_folder}/real_x${nx}_y${ny}_z${nz}_d${nest}_t${tracers}_p${numproc}_s${scat}.exe
[11]374 if [[ -f ${wrfexe} ]]
375 then
376     echo '**********************************************'
377     echo "    !!!   wrf.exe exists in ${work_folder}"
378     echo '**********************************************'
379     echo "Recompile ? ('yes' to accept, any key to refuse)" ; read reply
380 else
381     reply='yes'
382 fi
383 echo '********************************************** OK thanks. Now please wait...'
384 echo '                                       '
385 if [[ "${reply}" == "yes" ]]
386 then
387 #####################
388 echo "** "Begin compilation process...
389 \rm ${wrfexe} 2> /dev/null
390 \rm ${realexe} 2> /dev/null
391   #
392   # CREATE makemeso_input
393   #
394   \rm ${simu_folder}/makemeso_input 2> /dev/null
395   touch ${simu_folder}/makemeso_input
396   echo ${compilo} >> ${simu_folder}/makemeso_input
[60]397   if [[ "${compilo}" = "3" || "${compilo}" = "5" ]]
[11]398     then
399         echo ${numproc} >> ${simu_folder}/makemeso_input
400   fi
401   echo ${nx} >> ${simu_folder}/makemeso_input
402   echo ${ny} >> ${simu_folder}/makemeso_input
403   echo ${nz} >> ${simu_folder}/makemeso_input
404   echo ${nest} >> ${simu_folder}/makemeso_input
405   echo ${tracers} >> ${simu_folder}/makemeso_input
[153]406   if [[ ${newphys} -eq 1 ]]
407   then
408     echo ${scat} >> ${simu_folder}/makemeso_input
[228]409     #echo 'n' >> ${simu_folder}/makemeso_input
[153]410   fi
[11]411   #
412   # COMPILE THE MODEL
413   #
414   cd ${meso_folder}
[262]415                      #if [[ "${changeregis}" = "1" ]]
416                      #then
417                      #    cd ${work_folder}/WRFV2/Registry
418                      #    \rm Registry 2> /dev/null
419                      #    ./Registry.bash
420                      #    cd ../../..
421                      #fi
422   if [[ ${fresh} -eq 0 ]]
423   then
[32]424     ##******
425     if [[ ${newphys} -eq 0 ]]
426     then
427       ./makemeso -r < ${simu_folder}/makemeso_input
428     else
[118]429         if [[ "${scenario}" == "" ]]
430         then
431          ./makemeso -r -p < ${simu_folder}/makemeso_input
432         else
433          ./makemeso -r -p -s ${scenario} < ${simu_folder}/makemeso_input
434         fi
[32]435     fi
436     ##******
[262]437   else
438     ##******
439     if [[ ${newphys} -eq 0 ]]
440     then
441       ./makemeso -r -f < ${simu_folder}/makemeso_input
442     else
443         if [[ "${scenario}" == "" ]]
444         then
445          ./makemeso -r -p -f < ${simu_folder}/makemeso_input
446         else
447          ./makemeso -r -p -f -s ${scenario} < ${simu_folder}/makemeso_input
448         fi
449     fi
450     ##******
451   fi
[32]452
[11]453   if [[ -f ${wrfexe} ]]
454   then
455       echo "** "seems OK ... linking executables
456       ln -sf ${wrfexe} ${simu_folder}/wrf.exe
457       ln -sf ${realexe} ${simu_folder}/real.exe
458       chmod a+x ${realexe} ${wrfexe} ## sait-on jamais
459       cd $simu_folder
460   else
461       echo no ${wrfexe}
462       echo problem with the compilation
463       exit
464   fi
465 else
466     #echo simply linking existing executables...
467     ln -sf ${wrfexe} ${simu_folder}/wrf.exe
468     ln -sf ${realexe} ${simu_folder}/real.exe
469     chmod a+x ${realexe} ${wrfexe} ## sait-on jamais
470 fi
471fi
472
473######################################
474# 1. RUN GCM FOR INIT/BDY CONDITIONS #
475######################################
476if [ ${gcmstep} -eq 1 ]
477then
478 echo '************************************'
479 echo '**** Step 1: Prepare GCM inputs ****'
480 echo '************************************'
481        #
482        # run GCM
483        #
[56]484        if [[ ${newphys} -eq 0 ]]
485        then
[235]486          cd ${main_folder}'/LMDZ.MARS/'
[56]487        else
[235]488          cd ${main_folder}'/LMDZ.MARS.new/'
[56]489        fi
[235]490        if [[ ! ( -f "gcm.e" ) ]]
491        then
492          echo "Oops. There is no gcm.e, you shall compile the GCM first."
493          exit
494        fi
495        cd myGCM
[11]496        echo ${daygcm} | ./launch_gcm
[236]497        if [[ ! -d startbase ]]
498        then
499          echo "I guess I should stop here."
500          exit
501        fi
[11]502        #
503        # prepare files for WPS
504        #
505        cd ${work_folder}
506        if [[ -f ${work_folder}/PREP_MARS/create_readmeteo.exe && -f ${work_folder}/PREP_MARS/readmeteo.exe ]]
507        then
[235]508              ### This is now generic so PREP_MARS could be moved out of DIRCOMPs files
509              cd ${work_folder}/PREP_MARS/
510              if [[ ${compilo} -eq 1 || ${compilo} -eq 3 ]]
511              then
512                 ln -sf compile_pgf compile
513              fi
514              if [[ ${compilo} -eq 2 ]]
515              then
516                 ln -sf compile_g95 compile
517              fi
518              if [[ ${compilo} -eq 4 || ${compilo} -eq 5 ]]
519              then
520                 ln -sf compile_ifort compile
521              fi
522              if [[ ${compilo} -gt 5 ]]
523              then
524                 echo "please adapt compile in PREP_MARS"
525              fi
526              ./compile_and_exec
[11]527              #echo 1 | ./create_readmeteo.exe
528              #./readmeteo.exe < readmeteo.def
529        else
530              echo please compile the PREP_MARS utilities in ${work_folder}
531              exit
532        fi
533fi     
534
535###################################
536# 2. RUN WRF PREPROCESSING SYSTEM #
537###################################
538if [ ${wpsstep} -eq 1 ]
539then
540 echo '*****************************************'
541 echo '**** Step 2: Perform WPS interpolations *'
542 echo '*****************************************'
543        if [[ -f ${work_folder}/WPS/geogrid.exe && -f ${work_folder}/WPS/metgrid.exe ]]
544        then
545              \rm -rf ${simu_folder}/met_em 2> /dev/null
546              mkdir ${simu_folder}/met_em
547              cd ${work_folder}/WPS/
548              \rm -rf ${work_folder}/WPS/WRFFEED/current 2> /dev/null
549              mkdir ${work_folder}/WPS/WRFFEED/current
550              ln -sf ${simu_folder}/namelist.wps ${work_folder}/WPS/namelist.wps
551              #mv namelist.wps namelist.wps.tmp
552              #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
553              ./geogrid.exe
554              ./metgrid.exe
555              #mv namelist.wps ${simu_folder}
556              #mv namelist.wps.tmp namelist.wps 
557              namedata=$(date +simu_%d%h%Y_%H%M)
558              mv ${work_folder}/WPS/WRFFEED/current ${work_folder}'/WPS/WRFFEED/'${namedata}
559              echo met_em files in $namedata
560              cd ${simu_folder}/met_em
561              ln -sf ${work_folder}/WPS/WRFFEED/${namedata}/* .
562              cd ${simu_folder}
563        else
564              echo please compile the WPS utilities in ${work_folder}
565              exit
566        fi
567fi     
568
569###################
570# 3. RUN REAL.EXE #
571###################
572if [ ${realstep} -eq 1 ]
573then
574 echo '*******************************'
575 echo '**** Step 3: Execute real.exe *'
576 echo '*******************************'
577        cd ${simu_folder}
578        if [[ ! -d met_em ]]
579        then
580                ls
581                echo "PB: no met_em files:"
582                echo "mkdir met_em folder then link met_em** files !"
583                exit
584        fi
585        cd ${simu_folder}/met_em
586        ln -sf ${simu_folder}/namelist.input .
587        ln -sf ${simu_folder}/real.exe .
[235]588        ln -sf ${simu_folder}/levels .
[11]589        rm -rf ${simu_folder}/met_em/wrfbdy* 2> /dev/null
590        rm -rf ${simu_folder}/met_em/wrfinput* 2> /dev/null
[235]591        if [[ ${compilo} -eq 3 || ${compilo} -eq 5 ]]
[11]592        then
593                rm -rf ${simu_folder}/met_em/rsl.* 2> /dev/null
594                echo "check in "${simu_folder}"/met_em/rsl.out.0000"
595                ./real.exe
596                tail -n 4 ${simu_folder}"/met_em/rsl.out.0000"
597        else
598                rm -rf ${simu_folder}/met_em/log* 2> /dev/null
599                echo "check in "${simu_folder}"/met_em/log_real"
600                real.exe > log_real
601                tail -n 4 ${simu_folder}"/met_em/log_real"
602        fi
603        if [[ -f ${simu_folder}/met_em/wrfinput_d01 && -f ${simu_folder}/met_em/wrfbdy_d01 ]]
604        then
605                echo ok... link ini and bdy conditions
606                cd ${simu_folder}
607                ln -sf ${simu_folder}/met_em/wrf*_d0* .
608        else
609                echo mmm... there was a problem, see log files in met_em
610                exit
611        fi
612fi
613
614##################
615# 4. RUN WRF.EXE #
616##################
617if [ ${wrfstep} -eq 1 ]
618then
619 echo '******************************'
620 echo '**** Step 4: Execute wrf.exe *'
621 echo '******************************'
622        cd ${simu_folder}
623        rm -rf ${simu_folder}/wrfout*
624        if [[ ${compilo} -eq 3 ]]
625        then
626                rm -rf ${simu_folder}/rsl.* 2> /dev/null
627#                ${WHERE_MPI}/mpirun -host smith -np ${numproc} wrf.exe < /dev/null &
628                ${WHERE_MPI}/mpirun -np ${numproc} wrf.exe < /dev/null &
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
[248]639xeyes &
[11]640exit
641
642
643
Note: See TracBrowser for help on using the repository browser.