source: trunk/MESOSCALE/LMD_MM_MARS/makemeso @ 135

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

LMD_MM_MARS: ajout mars_lmd_new_storm avec routines modifiees par J. Faure (stage M2). modification makemeso et runmeso avec ajout d une option -s qui permet de preciser un scenario base sur une physique legerement differente comme par exemple storm. ceci cree un nouveau dossier de compilation dont le nom commence par le nom du scenario.

  • Property svn:executable set to *
File size: 24.4 KB
Line 
1#! /bin/bash
2
3
4##################################
5# makemeso allows you to compile #
6# WRF with modified LMD physics  #
7##################################
8
9##############################
10# Author: A. Spiga           #
11# New version : October 2008 #
12# Last update : January 2009 #
13#               November  09 #
14#               January   11 #
15##############################
16
17###############################
18#### Type makemeso -h for help
19###############################
20
21
22
23##############################################################################################
24##############################################################################################
25##############################################################################################
26##############################################################################################
27
28donotcompile=0
29donotallow=0
30config='real'
31donotcompilephys=0
32justphys=0
33debug=0
34fresh_start=0
35phys=""
36scenario=""
37while getopts "drc:njhgpfs:" options; do
38  case $options in
39   d ) donotcompile=1;;       ## just to check the compile folder
40   r ) donotallow=1;;         ## allow only known config (useful with 'makemeso < last')
41   c ) config="${OPTARG}";;   ## idealized cases
42   n ) donotcompilephys=1;;   ## do not recompile physics
43   j ) justphys=1;;           ## just compile LMD physics
44   g ) debug=1;;              ## debug mode
45   p ) phys="newphys_";;      ## with new physics
46   f ) fresh_start=1;;        ## a fresh start
47   s ) scenario="${OPTARG}";; ## a specific scenario, you need a corresponding "mars_lmd_..."
48   h ) echo "
49# Use:   
50#
51# makemeso                   ## basic use (real configuration)
52#
53# makemeso -d                ## no compilation, just check the name of the compile folder
54#
55# makemeso -c real           ## real-case mode [default]
56# makemeso -c ideal          ## idealized mode (convective cell, mountain wave, etc...)
57#
58# makemeso -n                ## do not recompile LMD physics (must have been compiled before)
59#
60# makemeso < last            ## basic use + skip questions [! script must have been executed at least once]
61# makemeso -r < last         ## basic use + skip questions + only known config
62# makemeso -nr < last        ## basic use + skip questions + only known config + no LMD phys recompile
63#
64# makemeso -j                ## just compile the LMD physics
65#
66# makemeso -g                ## debug mode
67#
68# makemeso -h                ## display options
69#
70# makemeso -p                ## with new LMD physics
71#
72# makemeso -f                ## fresh start [clean -a]
73#
74# makemeso -s storm          ## a specific scenario, you need a corresponding mars_lmd_... (only for newphys)
75" ; exit ;;
76  esac
77done   
78
79#--------------
80# talk w/ user
81#--------------
82  echo '****************************************'
83  echo ' LMD Mesoscale Model Compiler. Welcome.'
84  echo '****************************************'
85  if [[ "${phys}" == "newphys_" ]]
86  then
87    echo '***********with new physics*************'
88    echo '****************************************'
89  fi
90  # computer
91  uname -a | grep x86_64 > /dev/null
92  if [[ "$?" == 0 ]]
93  then
94    machine='64'
95  else
96    machine='32'
97  fi
98  # compiler
99  echo "Supported compiler options are "
100  echo "       <1> pgf90"
101  echo "       <2> g95"
102  echo "       <3> pgf90 + mpi"
103  echo "       <4> ifort"
104  echo "       <5> ifort + mpi"
105  echo "       <7> xlf + mpi (IBM AIX)"
106  echo "Your choice ?" ; read reply
107  case ${reply} in
108    1) compilo='pgf' ; numproc=1 ;;
109    2) compilo='g95' ; numproc=1 ;;
110    3) compilo='mpi'
111       if [[ "${WHERE_MPI}" = "" ]]
112       then
113         echo Please initialize the variable WHERE_MPI in your environnement
114         exit
115       fi
116       echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;;
117    4) compilo='ifort' ; numproc=1 ;;
118    5) compilo='mpifort' ; echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;;
119    7) compilo='mpixlf' ; echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;;
120### for tests
12199) compilo='gnu' ; numproc=1 ;;
122    *) echo not supported by this script ; exit ;;
123  esac
124  # dimensions
125  if [ ${donotcompile} -eq 0 ]
126  then   
127  echo Grid points in longitude ? ; read lon
128  echo Grid points in latitude ? ; read lat
129  echo Number of vertical levels ? ; read level
130  fi
131  echo Number of domains ? ; read dom
132
133###PB lecture dom si < last
134
135    case ${dom} in
136       1) single='_single' ;;
137       *) single='_nest' ;;
138    esac
139      if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ]
140      then
141           single=''
142      fi
143
144testflag=''
145####
146#testflag='_test'
147####
148
149    conf_wrf="${scenario}${phys}${compilo}_${machine}${single}${testflag}"
150    \rm what_folder 2> /dev/null
151    echo ${conf_wrf} > what_folder
152         if [ ${donotcompile} -eq 1 ]
153         then
154            #\rm what_folder 2> /dev/null
155            #echo '**********************'
156            #echo '*** Your folder is ...'
157            #echo '**********************'
158            #echo ${conf_wrf} | tee what_folder
159            #cat what_folder
160            #echo ${conf_wrf} > what_folder
161            #echo ${reply} > what_compilo
162            #echo ${numproc} > what_numproc
163            exit
164         fi
165  echo Number of tracers ? ; read tra
166         if [ ${tra} -eq 0 ]
167         then
168            tra=1       
169         fi
170  # folder
171  mkdir ${conf_wrf} 2> /dev/null
172  if [[ "$?" == 0 ]]
173  then
174    echo new folder ... link sources
175    if [[ "${phys}" == "newphys_" ]]
176    then
177     \rm copy_model_tmp > /dev/null
178        if [[ "${scenario}" == "" ]]
179        then
180          sed s+"mars_lmd"+"mars_lmd_new"+g             copy_model > copy_model_tmp
181        else
182          echo SCENARIO ${scenario} DID YOU INCLUDE THE RIGHT copy_model ? ; read dummy
183          sed s+"mars_lmd"+"mars_lmd_new_${scenario}"+g copy_model > copy_model_tmp
184        fi
185     chmod 755 copy_model_tmp
186     ./copy_model_tmp
187     \rm copy_model_tmp
188     mv WRFV2 ${conf_wrf}/
189     cd ${conf_wrf}/WRFV2
190        if [[ "${scenario}" == "" ]]
191        then
192          ln -sf mars_lmd_new             mars_lmd
193        else
194          ln -sf mars_lmd_new_${scenario} mars_lmd
195          cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/Registry.EM mars_lmd_new_${scenario}/
196          cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/*.inc mars_lmd_new_${scenario}/
197          cd Registry ; ln -sf ../mars_lmd_new_${scenario}/Registry.EM . ; cd ..
198        fi
199     ln -sf meso_callkeys_newphys.h meso_callkeys.h
200     cd Registry ; Registry.bash ; cd ..
201    else
202     ./copy_model
203     mv WRFV2 ${conf_wrf}/
204     cd ${conf_wrf}/WRFV2
205     cd Registry ; Registry.bash ; cd ..
206     fi
207  else
208    cd ${conf_wrf}/WRFV2
209    if [ ${fresh_start} -eq 1 ]
210    then
211      echo '*** FRESH START, I clean everything'
212      clean -a > /dev/null 2> /dev/null
213      cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd ..
214      answer='y' ## a voir... pas si sur
215    else
216      echo Did you modify anything in the Registry or clean ? y for yes, any key for no ; read answer
217      case ${answer} in
218        y) cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. ;;
219        *) answer='no' ;;
220      esac
221    fi
222  fi
223  # summary
224  echo '**********************'
225  echo '*** Your folder is ...'
226  echo '**********************'
227  echo ${conf_wrf}
228  echo '**********************'
229  echo '****************************************'
230  echo so ...
231  echo your computer is ${machine} bits
232  echo ${compilo} is your compiler
233       if [[ "${compilo}" = "mpi" ]]
234       then
235         echo MPICH is in ${WHERE_MPI}
236       fi
237  echo you will use ${numproc} processors
238  echo you have ${lon} x points
239  echo '         '${lat} y points
240  echo '         '${level} z points
241  echo '         '${dom} domains
242  echo '         '${tra} tracers
243  echo '****************************************'
244  # save answer
245  \rm last 2> /dev/null
246  touch last
247  echo ${reply} >> last
248     if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ]
249     then
250     echo ${numproc} >> last
251     fi
252  echo ${lon} >> last
253  echo ${lat} >> last
254  echo ${level} >> last
255  echo ${dom} >> last
256  echo ${tra} >> last
257  echo ${answer} >> last
258
259
260#------------
261# log files
262#------------
263  \rm log_compile 2> /dev/null
264  \rm log_error 2> /dev/null
265
266#-----------------
267# configure WRF
268#-----------------
269  mv configure.wrf configure.wrf.bak 2> /dev/null
270  ########################
271  conf_wrf_forall="${compilo}_${machine}${single}${testflag}"
272  case ${conf_wrf_forall} in
273#######TEST TEST
274                     # GFORTRAN, 64 bits, no nesting     
275     gnu_64_single)    cd arch ; ln -sf ../configure.defaults.gfortran64 configure.defaults ; cd ..
276                       echo 15 | configure > log_compile 2> log_error
277                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf 
278                       sed s+"-L../mars_lmd/libo -llmd"+"-L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf ;;
279#######TEST TEST
280                     # PGF90, 32 bits, no nesting
281     pgf_32_single)    echo 1 | configure > log_compile 2> log_error
282                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
283                     # PGF90, 32 bits, nesting
284     pgf_32_nest)      echo 2 | configure > log_compile 2> log_error
285                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
286                     # PGF90, 64 bits, no nesting
287     pgf_64_single)    echo 1 | configure > log_compile 2> log_error
288                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
289                     # PGF90, 64 bits, nesting
290     pgf_64_nest)      cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
291                       echo 4 | configure > log_compile 2> log_error
292                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
293                     # G95, 32 bits, no nesting
294     g95_32_single)    echo 13 | configure > log_compile 2> log_error
295                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
296                     # G95, 64 bits, no nesting  ### we modify configure.defaults to add x86_64 next to g95 in the header comment
297     g95_64_single)    cd arch ; sed s/"PC Linux i486 i586 i686, g95 compiler"/"PC Linux i486 i586 i686 x86_64, g95 compiler"/g configure.defaults > yeahyeahyeah ; rm configure.defaults ; mv yeahyeahyeah configure.defaults ; cd ..
298                       echo 14 | configure > log_compile 2> log_error
299                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
300                       #sed s+"=       g95"+"=       /home/physastro/aspiga/mysoft/g95/g95-install/bin/x86_64-unknown-linux-gnu-g95"+g configure.wrf > yeah ; mv -f yeah configure.wrf;;
301                     # IFORT, 64 bits, no nesting
302     ifort_64_single)  echo 5 | configure > log_compile 2> log_error
303                       sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
304                         ## !!! NETCDF must be defined
305                         sed s+"lio_grib_share"+"lio_grib_share -L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah
306                         mv -f yeah configure.wrf ;;
307     mpifort_64)     # MPI+IFORT, 64 bits, no nesting / nesting
308                       echo 9 | configure > log_compile 2> log_error
309                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf
310                       sed s+"-f90=ifort"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
311                       sed s+"-cc=icc"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
312                       sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
313                       sed s+"O3"+"O2"+g configure.wrf > yeah ; mv -f yeah configure.wrf
314                                        #sed s+"O3"+"O0"+g configure.wrf > yeah ; mv -f yeah configure.wrf  ### pour compilation rapide
315                                        #-w -ftz -align all -fno-alias -fp-model precise >>> options indiquees dans WRF3
316                                        #http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-wrf-with-the-intel-compilers/
317                            #### NB: RSL is replaced by RSL_LITE, better memory capacity, less seg fault
318                            sed s+"../external/RSL/RSL"+"../external/RSL_LITE"+g configure.wrf > yeah ; mv -f yeah configure.wrf
319                            sed s+"-DWRF_RSL_IO"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
320                            sed s+"-DRSL"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
321                            sed s+"librsl.a"+"librsl_lite.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf
322                            sed s+"../external/RSL/gen"+"../external/RSL_LITE/gen"+g configure.wrf > yeah ; mv -f yeah configure.wrf
323                            sed s+"../external/RSL/module"+"../external/RSL_LITE/module"+g configure.wrf > yeah ; mv -f yeah configure.wrf
324                            sed s+"-lrsl"+"-lrsl_lite"+g configure.wrf > yeah ; mv -f yeah configure.wrf
325                            sed s+"linux"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
326                         ### necessary even if mpi-selector is used (no need in makegcm though)
327                         sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g > yeah ; mv -f yeah configure.wrf
328                         sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf
329                         ## !!! NETCDF must be defined
330                         sed s+"-L../mars_lmd/libo -llmd"+"-L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah
331                         mv -f yeah configure.wrf
332                         #### POUR LE TRAITEMENT PARTICULIERS des NESTS sur iDATAPLEX [cf. module_lmd_driver]
333                         sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -DSPECIAL_NEST_SAVE "+g configure.wrf > yeah
334                         mv -f yeah configure.wrf ;;
335                     # MPICH, 64 bits, no nesting / nesting
336     mpi_64)           cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
337                       echo 3 | configure > log_compile 2> log_error
338                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf
339                       sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah
340                                #| sed s+"fastsse"+"fast"+g > yeah
341                       mv -f yeah configure.wrf ;;
342                       #sed s+"-fastsse"+"-O2 -Munroll -Mcache_align"+g configure.wrf > yeah
343                       ##sed s+"-fastsse"+"-O2 -fpic"+g configure.wrf > yeah ## marche pas, ILM problem
344                       ##sed s+"-fastsse"+"-mcmodel=medium -Mlarge_arrays"+g configure.wrf > yeah ## marche pas, ILM problem
345                       #mv -f yeah configure.wrf ;;
346                     # MPICH, 64 bits, OK with periodic BC but no positive definite
347     mpi_64_test)      cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
348                       echo 2 | configure > log_compile 2> log_error
349                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf
350                       sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah
351                       mv -f yeah configure.wrf ;;
352                     # XLF+MPICH on AIX machine (64 bits) with nesting, NB: the 32bits notice is not to be considered
353     mpixlf_32)        cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
354                       echo 3 | configure > log_compile 2> log_error
355                       sed -f mars.sed configure.wrf > yeah
356                       mv -f yeah configure.wrf ;;
357                     # ANYTHING ELSE
358     *)                echo NO PRESETS ...
359                       if [ ${donotallow} -eq 0 ] 
360                       then
361                         configure
362                       else
363                         # problem when an input file is used
364                         echo 'please cd to '$PWD' and type ./configure' 
365                         exit   
366                       fi ;;
367  esac
368  ########################
369
370  if [[ "${phys}" == "newphys_" ]]
371  then
372     sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -DNEWPHYS "+g configure.wrf > yeah
373     mv -f yeah configure.wrf
374  fi
375
376        if [[ ! ("${scenario}" == "") ]]
377        then
378          sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -D${scenario} "+g configure.wrf > yeah
379          mv -f yeah configure.wrf
380        fi
381
382  if [ ${debug} -ne 0 ]   # not working for xlf!
383  then
384    echo 'DEBUG DEBUG DEBUG DEBUG'
385    sed s+"#-g"+"-g"+g configure.wrf > yeah
386    mv -f yeah configure.wrf
387  fi
388
389
390##################################################
391# compile physics
392##################################################
393if [ ${donotcompilephys} -eq 0 ]
394then
395
396  cd mars_lmd/
397
398  # required size
399  #----------------
400  case ${numproc} in
401    1) physx=$(expr ${lon} - 1)
402       physy=$(expr ${lat} - 1)
403       physz=$(expr ${level} - 1) ;;
404    2) physx=$(expr ${lon} - 1)
405       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2)
406       physz=$(expr ${level} - 1) ;;
407    4) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2)
408       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2)
409       physz=$(expr ${level} - 1) ;;
410    6) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2)
411       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 3)
412       physz=$(expr ${level} - 1) ;;
413    8) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2)
414       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4)
415       physz=$(expr ${level} - 1) ;;
416    12) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 3)
417        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4)
418        physz=$(expr ${level} - 1) ;;
419    16) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
420        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4)
421        physz=$(expr ${level} - 1) ;;
422    20) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
423        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 5)
424        physz=$(expr ${level} - 1) ;;
425    24) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
426        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 6)
427        physz=$(expr ${level} - 1) ;;
428    32) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
429        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8)
430        physz=$(expr ${level} - 1) ;;
431    64) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8)
432        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8)
433        physz=$(expr ${level} - 1) ;;
434    128) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8)
435        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 16)
436        physz=$(expr ${level} - 1) ;;
437    *) echo not supported ; exit
438  esac
439
440  # change this if you change num_soil_layers in WRF
441  # -- default is 10
442  if [[ "${phys}" == "newphys_" ]]
443  then
444     soilsize=18 ## nouvelle physique
445  else
446     soilsize=10
447  fi
448
449  # GCM environment variables
450  #--------------------------
451  export LMDGCM=$PWD
452  export LIBOGCM=$PWD/libo
453
454  # generate the appropriate dimphys
455  #---------------------------------
456  cd libf/phymars
457  \rm dimphys.h 2> /dev/null
458  physize=$(expr ${physx} \* ${physy})
459  sed s/--xsize--/${physx}/g meso_dimphys.h_ref | sed s/--ysize--/${physy}/g | sed s/--physize--/${physize}/g | sed s/--zsize--/${physz}/g | sed s/--soilsize--/${soilsize}/g > dimphys.h
460  head -15 dimphys.h
461     ###
462     ### TEST new new phys
463     if [[ "${phys}" == "newphys_" ]]
464     then
465       touch callkeys.h.meso 
466         ln -sf meso_callkeys.h callkeys.h
467       #touch dustlift.F.meso
468       #  ln -sf meso_dustlift.F dustlift.F  ## attention avec "ancienne nouvelle physique"
469       touch readtesassim.F90.meso
470         ln -sf meso_readtesassim.F90 readtesassim.F90  ## attention idem
471       touch gr_fi_dyn.F.lien
472         ln -sf ../dyn3d/gr_fi_dyn.F .  ## dommage, a corriger ## attention idem
473     fi
474     ###
475     ###
476  cd ../..
477
478  # prepare for nesting
479  #---------------------
480  cd libf
481  duplicate${dom} 2> /dev/null
482  cd ..
483
484  # compile physics
485  #--------------------------
486  \rm libf/grid/dimensions.h 2> /dev/null
487  \rm -rf libo/* 2> /dev/null
488  echo 1. compiling LMD physics ...
489  echo compilation info in:
490  echo $PWD/libo/log_compile_phys
491
492  if [ ${debug} -ne 0 ]
493  then
494    echo 'DEBUG DEBUG DEBUG DEBUG'
495    nohup makegcm_${compilo} -debug -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
496  else
497    nohup makegcm_${compilo} -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
498  fi
499  echo ... done
500        # clean the duplicate routines
501        cd libf
502        duplicate1 2> /dev/null
503        cd ..
504
505  # merge LMD executables in one lib
506  #--------------------------------------
507  cd libo
508  mkdir temp
509  #cp -f LINUXfastI._${physz}_t${tra}_reg/*.a temp
510  cp -f LINUX*/*.a temp
511  cd temp
512  ar x libbibio.a
513  ar x libphymars.a
514  ar x libaeronomars.a
515  \rm *.a
516  ar r liblmd.a *
517  cp -f liblmd.a ..
518  cd ..
519  \rm -r temp
520  nm liblmd.a > liblmd_content
521  # finish merge
522  cd ..
523
524  # save a copy
525  #--------------
526  cp -f libo/liblmd.a libo/liblmd.a_${lon}_${lat}_${level}_${dom}_${tra}
527  echo '****************************************'
528
529  # ok
530  #----
531  cd ..
532
533  # manage nest includes in module_lmd_driver.F
534  #----
535  cp call_meso_inifis$dom.inc call_meso_inifis.inc
536  cp call_meso_physiq$dom.inc call_meso_physiq.inc
537
538
539fi
540##################################################
541# END compile physics
542##################################################
543
544#------------------
545# compile WRF
546#------------------
547if [ ${justphys} -eq 0 ]
548then
549
550  echo 2. compiling WRF dynamical core ...
551
552  if [[ ! ( -f "call_meso_physiq.inc" ) ]]
553  then
554   echo 'did you compile the physics ? no call_meso_physiq.inc !'
555   exit
556  fi
557
558  # be sure to compile with the most recent physics
559  touch phys/module_lmd_driver.F
560
561  # talk to user
562  echo '>>> YOUR CONFIG IS : '${config}
563  echo '>>> compiling ... this may be long ... <<<'
564  echo check progress in:
565  echo $PWD/log_compile
566  echo check possible errors in:
567  echo $PWD/log_error
568 
569  # compile ...
570  case ${config} in
571    'real')         compile em_real > log_compile 2> log_error
572                    # save executables 
573                    cd main
574                      if [[ -f real.exe ]]
575                      then
576                        echo 'Looks good ! real.exe is here...'
577                      fi
578                      if [[ -f wrf.exe ]]
579                      then
580                        echo 'Looks good ! wrf.exe is here...'
581                      fi
582                    cp -f real.exe ../../real_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
583                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
584                    cd ..  ;;
585    'ideal')        #mkdir 'test/em_quarter_ss' 2> /dev/null
586                    compile em_quarter_ss > log_compile 2> log_error
587                    # save executables 
588                    cd main
589                      if [[ -f ideal.exe ]]
590                      then
591                        echo 'Looks good ! ideal.exe is here...'
592                      fi
593                      if [[ -f wrf.exe ]]
594                      then
595                        echo 'Looks good ! wrf.exe is here...'
596                      fi
597                    cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
598                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
599                    cd ..  ;;
600    *)              echo not supported... please use ; echo real ideal ; exit ;;
601  esac
602  echo '*******last lines from log_error*********'
603  tail -n 20 log_error
604fi
605
606  # the end
607  echo '****************************************'
608  echo 'done.'
609  echo '****************************************'
610  cp last ../makemeso_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}
611  mv last ../../
612
613  # add here specific messages
614  if [[ "${dom}" != "1" ]]
615  then
616  nest=$(expr ${lon} + 4)
617  echo NB: in namelist.input, please set:
618  echo '
619  max_dom = '$dom'
620  s_we    = 1,1,
621  e_we    = '$lon','$nest',
622  s_sn    = 1,1,
623  e_sn    = '$lat','$nest',
624  s_vert  = 1,1,
625  e_vert  = '$level','$level','
626  fi
627
Note: See TracBrowser for help on using the repository browser.