source: trunk/MESOSCALE/LMD_MM_MARS/makemeso @ 142

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

LMD_LES_MARS: changement majeur pour pallier a plusieurs defauts penibles de la separation d'avec LMD_MM_MARS.

--> le LES est maintenant inclus dans LMD_MM_MARS/SRC/LES [executer le script d'installation LMD_LES_MARS_install au prealable]
--> il se compile avec le script makemeso dans $MMM en mettant l'option "-c les" qui cree un dossier particulier, e.g. lesmpi_64
--> pour l'instant sont supportes : mpi_64, mpifort_64, ancienne et nouvelle physique, cas particulier ciclad (detecte automatiquement)
--> le(s) script(s) makeles sont desormais obsoletes
--> il n'y a plus qu'un seul Registry.EM a modifier pour le LES

(eventuellment il est possible de modifier dans le dossier specifique en remplacant le lien par un fichier)

--> disparition du dossier MESOSCALE/LMD_LES_MARS
--> les changements ont ete fait sans modifier le script copy_model
Il reste a verifier le bon fonctionnement de facon plus approfondie suite a ce changement de structure.
Le nouveau script 'correcfft' est un sparadrap un peu moche mais sans consequence.
Voir changements dans makemeso et LMD_LES_MARS_install

Changements mineurs
M 141 DOC/000-MODELS
M 141 MESOSCALE/NOTES.txt
D 141 MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new_storm/libf/phymars/meso_physiq_julien.F
M 141 MESOSCALE/PLOT/MINIMAL/map_latlon.pro

  • Property svn:executable set to *
File size: 29.5 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=''
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-case configuration)
52#
53# makemeso -d                ## no compilation, just check the name of the compile folder
54#
55# makemeso -c ideal          ## idealized mode (convective cell, mountain wave, etc...)
56# makemeso -c les            ## large-eddy simulations mode based on WRFV3
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="${config}${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             if [[ "${config}" == "les" ]]
185             then
186              echo "NOT SUPPORTED, check options"
187             fi
188        fi
189        if [[ "${config}" == "les" ]]
190        then
191         sed s+"PWD/SRC/"+"PWD/SRC/LES/"+g copy_model_tmp > yeah
192         mv yeah copy_model_tmp
193        fi
194     chmod 755 copy_model_tmp
195     ./copy_model_tmp
196     \rm copy_model_tmp
197     mv WRFV2 ${conf_wrf}/
198     cd ${conf_wrf}/WRFV2
199        if [[ "${scenario}" == "" ]]
200        then
201          ln -sf mars_lmd_new             mars_lmd
202        else
203          ln -sf mars_lmd_new_${scenario} mars_lmd
204          cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/Registry.EM mars_lmd_new_${scenario}/
205          cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/*.inc mars_lmd_new_${scenario}/
206          cd Registry ; ln -sf ../mars_lmd_new_${scenario}/Registry.EM . ; cd ..
207        fi
208     ln -sf meso_callkeys_newphys.h meso_callkeys.h
209     cd Registry ; Registry.bash ; cd ..
210    else
211     #./copy_model
212         if [[ "${config}" == "les" ]]
213         then
214           sed s+"PWD/SRC/"+"PWD/SRC/LES/"+g copy_model > copy_model_tmp
215         else
216           cp copy_model copy_model_tmp
217         fi   
218     chmod 755 copy_model_tmp
219     ./copy_model_tmp
220     \rm copy_model_tmp
221     mv WRFV2 ${conf_wrf}/
222     cd ${conf_wrf}/WRFV2
223     cd Registry ; Registry.bash ; cd ..
224     fi
225          #### sparadrap consequent a l'utilisation de copy_model pour les liens
226          #### -- car alors il manque fftpack
227          if [[ "${config}" == "les" ]]
228          then
229            cp ../../SRC/LES/correcfft ./
230            ./correcfft
231            \rm correcfft
232          fi
233  else
234    cd ${conf_wrf}/WRFV2
235    if [ ${fresh_start} -eq 1 ]
236    then
237      echo '*** FRESH START, I clean everything'
238      clean -a > /dev/null 2> /dev/null
239      cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd ..
240      answer='y' ## a voir... pas si sur
241    else
242      echo Did you modify anything in the Registry or clean ? y for yes, any key for no ; read answer
243      case ${answer} in
244        y) cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. ;;
245        *) answer='no' ;;
246      esac
247    fi
248  fi
249  # summary
250  echo '**********************'
251  echo '*** Your folder is ...'
252  echo '**********************'
253  echo ${conf_wrf}
254  echo '**********************'
255  echo '****************************************'
256  echo so ...
257  echo your computer is ${machine} bits
258  echo ${compilo} is your compiler
259       if [[ "${compilo}" = "mpi" ]]
260       then
261         echo MPICH is in ${WHERE_MPI}
262       fi
263  echo you will use ${numproc} processors
264  echo you have ${lon} x points
265  echo '         '${lat} y points
266  echo '         '${level} z points
267  echo '         '${dom} domains
268  echo '         '${tra} tracers
269  echo '****************************************'
270  # save answer
271  \rm last 2> /dev/null
272  touch last
273  echo ${reply} >> last
274     if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ]
275     then
276     echo ${numproc} >> last
277     fi
278  echo ${lon} >> last
279  echo ${lat} >> last
280  echo ${level} >> last
281  echo ${dom} >> last
282  echo ${tra} >> last
283  echo ${answer} >> last
284
285#------------
286# log files
287#------------
288  \rm log_compile 2> /dev/null
289  \rm log_error 2> /dev/null
290
291#-----------------
292# configure WRF
293#-----------------
294  mv configure.wrf configure.wrf.bak 2> /dev/null
295  ########################
296  conf_wrf_forall="${compilo}_${machine}${single}${testflag}"
297
298         #### in this case options are different because for LES, WRFV3 is used
299         if [[ "${config}" == "les" ]]
300         then
301         conf_wrf_forall="${config}${compilo}_${machine}${single}${testflag}"
302         fi
303
304  case ${conf_wrf_forall} in
305
306     #######LES-specific (WRFV3-based) -- previously in 'makeles'
307     #######
308
309     lesmpi_64)        ## MPI (dm) 64 bits [PS: remplacer 3 par 4 pour openMP]
310                       \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 3 >> conf ; echo 1 >> conf
311                       \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null
312                       sed s+"-lnetcdf"+"-lnetcdf -L../mars_lmd/libo -llmd"+g   configure.wrf > yeah ; mv -f yeah configure.wrf
313                       echo "$(hostname)"
314                       if [[ "$(hostname)" == "ciclad1.ipsl.jussieu.fr" ]]
315                       then
316            echo "SPECIFIC CHANGES FOR CICLAD CLUSTER. EDIT makemeso IF YOU ENCOUNTER PROBLEMS."
317            #sed s+"mpif90 -f90=$(SFC)"+"/usr/lib64/openmpi/1.4.2-pgf/bin/mpif90"+g                      configure.wrf > yeah ; mv -f yeah configure.wrf
318            #sed s+"mpicc -cc=$(SCC)"+"/usr/lib64/openmpi/1.4.2-gfortran/bin/mpicc -DMPI2_SUPPORT"+g     configure.wrf > yeah ; mv -f yeah configure.wrf
319            sed s+"mpif90 -f90=$(SFC)"+"/usr/lib64/openmpi/1.4.3-pgfgcc/bin/mpif90"+g                   configure.wrf > yeah ; mv -f yeah configure.wrf
320            sed s+"mpicc -cc=$(SCC)"+"/usr/lib64/openmpi/1.4.3-pgfgcc/bin/mpicc -DMPI2_SUPPORT"+g       configure.wrf > yeah ; mv -f yeah configure.wrf
321                       else
322            sed s+"mpif90"+"$WHERE_MPI/mpif90"+g                 configure.wrf > yeah ; mv -f yeah configure.wrf
323            sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g    configure.wrf > yeah ; mv -f yeah configure.wrf
324                       fi
325                       sed s+"-fastsse"+" "+g                               configure.wrf > yeah ; mv -f yeah configure.wrf
326                          ### pas forcement necessaire ici mais OK
327                          sed s+"-llmd"+"-llmd $NETCDF/lib/libnetcdf.a"+g     configure.wrf > yeah ; mv -f yeah configure.wrf
328                       \rm conf > /dev/null ;;
329
330     lesmpifort_64)    ## MPI (dm) 64 bits IFORT
331                       \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 7 >> conf ; echo 1 >> conf
332                       \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null
333                       sed s+"-lnetcdf"+"-lnetcdf -L../mars_lmd/libo -llmd"+g   configure.wrf > yeah ; mv -f yeah configure.wrf
334                       sed s+"mpif90"+"$WHERE_MPI/mpif90"+g                 configure.wrf > yeah ; mv -f yeah configure.wrf
335                       sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g    configure.wrf > yeah ; mv -f yeah configure.wrf
336                       sed s+"-fastsse"+" "+g                               configure.wrf > yeah ; mv -f yeah configure.wrf
337                       sed s+"-llmd"+"-llmd $NETCDF/lib/libnetcdf.a"+g     configure.wrf > yeah ; mv -f yeah configure.wrf
338                       \rm conf > /dev/null ;;
339
340     #######
341     #######LES-specific (WRFV3-based) -- previously in 'makeles'   
342
343#######TEST TEST
344                     # GFORTRAN, 64 bits, no nesting     
345     gnu_64_single)    cd arch ; ln -sf ../configure.defaults.gfortran64 configure.defaults ; cd ..
346                       echo 15 | configure > log_compile 2> log_error
347                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf 
348                       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 ;;
349#######TEST TEST
350                     # PGF90, 32 bits, no nesting
351     pgf_32_single)    echo 1 | configure > log_compile 2> log_error
352                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
353                     # PGF90, 32 bits, nesting
354     pgf_32_nest)      echo 2 | configure > log_compile 2> log_error
355                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
356                     # PGF90, 64 bits, no nesting
357     pgf_64_single)    echo 1 | configure > log_compile 2> log_error
358                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
359                     # PGF90, 64 bits, nesting
360     pgf_64_nest)      cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
361                       echo 4 | configure > log_compile 2> log_error
362                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
363                     # G95, 32 bits, no nesting
364     g95_32_single)    echo 13 | configure > log_compile 2> log_error
365                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
366                     # G95, 64 bits, no nesting  ### we modify configure.defaults to add x86_64 next to g95 in the header comment
367     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 ..
368                       echo 14 | configure > log_compile 2> log_error
369                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
370                       #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;;
371                     # IFORT, 64 bits, no nesting
372     ifort_64_single)  echo 5 | configure > log_compile 2> log_error
373                       sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
374                         ## !!! NETCDF must be defined
375                         sed s+"lio_grib_share"+"lio_grib_share -L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah
376                         mv -f yeah configure.wrf ;;
377     mpifort_64)     # MPI+IFORT, 64 bits, no nesting / nesting
378                       echo 9 | configure > log_compile 2> log_error
379                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf
380                       sed s+"-f90=ifort"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
381                       sed s+"-cc=icc"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
382                       sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
383                       sed s+"O3"+"O2"+g configure.wrf > yeah ; mv -f yeah configure.wrf
384                                        #sed s+"O3"+"O0"+g configure.wrf > yeah ; mv -f yeah configure.wrf  ### pour compilation rapide
385                                        #-w -ftz -align all -fno-alias -fp-model precise >>> options indiquees dans WRF3
386                                        #http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-wrf-with-the-intel-compilers/
387                            #### NB: RSL is replaced by RSL_LITE, better memory capacity, less seg fault
388                            sed s+"../external/RSL/RSL"+"../external/RSL_LITE"+g configure.wrf > yeah ; mv -f yeah configure.wrf
389                            sed s+"-DWRF_RSL_IO"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
390                            sed s+"-DRSL"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
391                            sed s+"librsl.a"+"librsl_lite.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf
392                            sed s+"../external/RSL/gen"+"../external/RSL_LITE/gen"+g configure.wrf > yeah ; mv -f yeah configure.wrf
393                            sed s+"../external/RSL/module"+"../external/RSL_LITE/module"+g configure.wrf > yeah ; mv -f yeah configure.wrf
394                            sed s+"-lrsl"+"-lrsl_lite"+g configure.wrf > yeah ; mv -f yeah configure.wrf
395                            sed s+"linux"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
396                         ### necessary even if mpi-selector is used (no need in makegcm though)
397                         sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g > yeah ; mv -f yeah configure.wrf
398                         sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf
399                         ## !!! NETCDF must be defined
400                         sed s+"-L../mars_lmd/libo -llmd"+"-L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah
401                         mv -f yeah configure.wrf
402                         #### POUR LE TRAITEMENT PARTICULIERS des NESTS sur iDATAPLEX [cf. module_lmd_driver]
403                         sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -DSPECIAL_NEST_SAVE "+g configure.wrf > yeah
404                         mv -f yeah configure.wrf ;;
405                     # MPICH, 64 bits, no nesting / nesting
406     mpi_64)           cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
407                       echo 3 | configure > log_compile 2> log_error
408                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf
409                       sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah
410                                #| sed s+"fastsse"+"fast"+g > yeah
411                       mv -f yeah configure.wrf ;;
412                       #sed s+"-fastsse"+"-O2 -Munroll -Mcache_align"+g configure.wrf > yeah
413                       ##sed s+"-fastsse"+"-O2 -fpic"+g configure.wrf > yeah ## marche pas, ILM problem
414                       ##sed s+"-fastsse"+"-mcmodel=medium -Mlarge_arrays"+g configure.wrf > yeah ## marche pas, ILM problem
415                       #mv -f yeah configure.wrf ;;
416                     # MPICH, 64 bits, OK with periodic BC but no positive definite
417     mpi_64_test)      cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
418                       echo 2 | configure > log_compile 2> log_error
419                       sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf
420                       sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah
421                       mv -f yeah configure.wrf ;;
422                     # XLF+MPICH on AIX machine (64 bits) with nesting, NB: the 32bits notice is not to be considered
423     mpixlf_32)        cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
424                       echo 3 | configure > log_compile 2> log_error
425                       sed -f mars.sed configure.wrf > yeah
426                       mv -f yeah configure.wrf ;;
427                     # ANYTHING ELSE
428     *)                echo NO PRESETS ...
429                       if [ ${donotallow} -eq 0 ] 
430                       then
431                         configure
432                       else
433                         # problem when an input file is used
434                         echo 'please cd to '$PWD' and type ./configure' 
435                         exit   
436                       fi ;;
437  esac
438  ########################
439
440
441  if [[ "${phys}" == "newphys_" ]]
442  then
443     if [[ "${config}" == "les" ]]  ### LES is different because of WRFV3
444     then
445       sed s+"ARCH_LOCAL      =       "+"ARCH_LOCAL      =       -DNEWPHYS "+g configure.wrf > yeah
446     else
447       sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -DNEWPHYS "+g configure.wrf > yeah
448     fi
449     mv -f yeah configure.wrf
450  fi
451
452        if [[ ! ("${scenario}" == "") ]]   ### not supported with LES for the moment
453        then
454          sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -D${scenario} "+g configure.wrf > yeah
455          mv -f yeah configure.wrf
456        fi
457
458  if [ ${debug} -ne 0 ]   # not working for xlf!
459  then
460    echo 'DEBUG DEBUG DEBUG DEBUG'
461    sed s+"#-g"+"-g"+g configure.wrf > yeah
462    mv -f yeah configure.wrf
463  fi
464
465
466##################################################
467# compile physics
468##################################################
469if [ ${donotcompilephys} -eq 0 ]
470then
471
472  cd mars_lmd/
473
474  # required size
475  #----------------
476  case ${numproc} in
477    1) physx=$(expr ${lon} - 1)
478       physy=$(expr ${lat} - 1)
479       physz=$(expr ${level} - 1) ;;
480    2) physx=$(expr ${lon} - 1)
481       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2)
482       physz=$(expr ${level} - 1) ;;
483    4) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2)
484       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2)
485       physz=$(expr ${level} - 1) ;;
486    6) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2)
487       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 3)
488       physz=$(expr ${level} - 1) ;;
489    8) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2)
490       physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4)
491       physz=$(expr ${level} - 1) ;;
492    12) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 3)
493        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4)
494        physz=$(expr ${level} - 1) ;;
495    16) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
496        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4)
497        physz=$(expr ${level} - 1) ;;
498    20) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
499        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 5)
500        physz=$(expr ${level} - 1) ;;
501    24) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
502        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 6)
503        physz=$(expr ${level} - 1) ;;
504    32) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4)
505        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8)
506        physz=$(expr ${level} - 1) ;;
507    64) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8)
508        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8)
509        physz=$(expr ${level} - 1) ;;
510    128) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8)
511        physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 16)
512        physz=$(expr ${level} - 1) ;;
513    *) echo not supported ; exit
514  esac
515
516  # change this if you change num_soil_layers in WRF
517  # -- default is 10
518  if [[ "${phys}" == "newphys_" ]]
519  then
520     soilsize=18 ## nouvelle physique
521  else
522     soilsize=10
523  fi
524
525  # GCM environment variables
526  #--------------------------
527  export LMDGCM=$PWD
528  export LIBOGCM=$PWD/libo
529
530  # generate the appropriate dimphys
531  #---------------------------------
532  cd libf/phymars
533  \rm dimphys.h 2> /dev/null
534  physize=$(expr ${physx} \* ${physy})
535  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
536  head -15 dimphys.h
537     ###
538     ### TEST new new phys
539     if [[ "${phys}" == "newphys_" ]]
540     then
541       touch callkeys.h.meso 
542         ln -sf meso_callkeys.h callkeys.h
543       #touch dustlift.F.meso
544       #  ln -sf meso_dustlift.F dustlift.F  ## attention avec "ancienne nouvelle physique"
545       touch readtesassim.F90.meso
546         ln -sf meso_readtesassim.F90 readtesassim.F90  ## attention idem
547       touch gr_fi_dyn.F.lien
548         ln -sf ../dyn3d/gr_fi_dyn.F .  ## dommage, a corriger ## attention idem
549     fi
550     ###
551     ###
552  cd ../..
553
554  # prepare for nesting
555  #---------------------
556  cd libf
557  duplicate${dom} 2> /dev/null
558  cd ..
559
560  # compile physics
561  #--------------------------
562  \rm libf/grid/dimensions.h 2> /dev/null
563  \rm -rf libo/* 2> /dev/null
564  echo 1. compiling LMD physics ...
565  echo compilation info in:
566  echo $PWD/libo/log_compile_phys
567
568  if [ ${debug} -ne 0 ]
569  then
570    echo 'DEBUG DEBUG DEBUG DEBUG'
571    nohup makegcm_${compilo} -debug -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
572  else
573    nohup makegcm_${compilo} -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
574  fi
575  echo ... done
576        # clean the duplicate routines
577        cd libf
578        duplicate1 2> /dev/null
579        cd ..
580
581  # merge LMD executables in one lib
582  #--------------------------------------
583  cd libo
584  mkdir temp
585  #cp -f LINUXfastI._${physz}_t${tra}_reg/*.a temp
586  cp -f LINUX*/*.a temp
587  cd temp
588  ar x libbibio.a
589  ar x libphymars.a
590  ar x libaeronomars.a
591  \rm *.a
592  ar r liblmd.a *
593  cp -f liblmd.a ..
594  cd ..
595  \rm -r temp
596  nm liblmd.a > liblmd_content
597  # finish merge
598  cd ..
599
600  # save a copy
601  #--------------
602  cp -f libo/liblmd.a libo/liblmd.a_${lon}_${lat}_${level}_${dom}_${tra}
603  echo '****************************************'
604
605  # ok
606  #----
607  cd ..
608
609  # manage nest includes in module_lmd_driver.F
610  #----
611  cp call_meso_inifis$dom.inc call_meso_inifis.inc
612  cp call_meso_physiq$dom.inc call_meso_physiq.inc
613
614
615fi
616##################################################
617# END compile physics
618##################################################
619
620#------------------
621# compile WRF
622#------------------
623if [ ${justphys} -eq 0 ]
624then
625
626  echo 2. compiling WRF dynamical core ...
627
628  if [[ ! ( -f "call_meso_physiq.inc" ) ]]
629  then
630   echo 'did you compile the physics ? no call_meso_physiq.inc !'
631   exit
632  fi
633
634  # be sure to compile with the most recent physics
635  touch phys/module_lmd_driver.F
636
637  # talk to user
638  echo '>>> compiling ... this may be long ... <<<'
639  echo check progress in:
640  echo $PWD/log_compile
641  echo check possible errors in:
642  echo $PWD/log_error
643 
644  # compile ...
645  case ${config} in
646    '')         compile em_real > log_compile 2> log_error
647                    # save executables 
648                    cd main
649                      if [[ -f real.exe ]]
650                      then
651                        echo 'Looks good ! real.exe is here...'
652                      fi
653                      if [[ -f wrf.exe ]]
654                      then
655                        echo 'Looks good ! wrf.exe is here...'
656                      fi
657                    cp -f real.exe ../../real_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
658                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
659                    cd ..  ;;
660    'ideal')        #mkdir 'test/em_quarter_ss' 2> /dev/null
661                    echo '>>> YOUR CONFIG IS : '${config}
662                    compile em_quarter_ss > log_compile 2> log_error
663                    # save executables 
664                    cd main
665                      if [[ -f ideal.exe ]]
666                      then
667                        echo 'Looks good ! ideal.exe is here...'
668                      fi
669                      if [[ -f wrf.exe ]]
670                      then
671                        echo 'Looks good ! wrf.exe is here...'
672                      fi
673                    cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
674                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
675                    cd ..  ;;
676    'les')          echo '>>> YOUR CONFIG IS : '${config}
677                    mkdir 'test/em_les' 2> /dev/null                   
678                    compile em_les > log_compile 2> log_error
679                    # save executables 
680                    cd main
681                      if [[ -f ideal.exe ]]
682                      then
683                        echo 'Looks good ! ideal.exe is here...'
684                      fi
685                      if [[ -f wrf.exe ]]
686                      then
687                        echo 'Looks good ! wrf.exe is here...'
688                      fi
689                    cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
690                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
691                    cd ..  ;;
692    *)              echo not supported... please use ; echo ideal les ; exit ;;
693  esac
694  echo '*******last lines from log_error*********'
695  tail -n 20 log_error
696fi
697
698  # the end
699  echo '****************************************'
700  echo 'done.'
701  echo '****************************************'
702  cp last ../makemeso_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}
703  mv last ../../
704
705  # add here specific messages
706  if [[ "${dom}" != "1" ]]
707  then
708  nest=$(expr ${lon} + 4)
709  echo NB: in namelist.input, please set:
710  echo '
711  max_dom = '$dom'
712  s_we    = 1,1,
713  e_we    = '$lon','$nest',
714  s_sn    = 1,1,
715  e_sn    = '$lat','$nest',
716  s_vert  = 1,1,
717  e_vert  = '$level','$level','
718  fi
719
Note: See TracBrowser for help on using the repository browser.