source: trunk/MESOSCALE/LMD_MM_MARS/makemeso @ 2103

Last change on this file since 2103 was 2094, checked in by jleconte, 7 years ago

Changes in makemeso and config files to compile the generic LES with gfortran. Also added def files to run a simple generic LES simulaiton in SIMU/DEF/2019_leconte-test-les

  • Property svn:executable set to *
File size: 40.5 KB
RevLine 
[11]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 #
[29]14#               January   11 #
[11]15##############################
16
[68]17###############################
18#### Type makemeso -h for help
19###############################
[11]20
[2058]21###path to compiled version of ioipsl on your system for generic physics
22pathioipsl='/home/leconte/script/ioipsl/modipsl/lib'
[11]23
24##############################################################################################
25##############################################################################################
26##############################################################################################
27##############################################################################################
28
29donotcompile=0
30donotallow=0
[1588]31config='real'
[11]32donotcompilephys=0
33justphys=0
34debug=0
[54]35fresh_start=0
[1588]36phys="mars_lmd"
[118]37scenario=""
[1038]38from_scratch=0
[1440]39
[1588]40while getopts "drc:njhgp:fs:xe" options; do
[11]41  case $options in
[118]42   d ) donotcompile=1;;       ## just to check the compile folder
43   r ) donotallow=1;;         ## allow only known config (useful with 'makemeso < last')
44   c ) config="${OPTARG}";;   ## idealized cases
45   n ) donotcompilephys=1;;   ## do not recompile physics
46   j ) justphys=1;;           ## just compile LMD physics
47   g ) debug=1;;              ## debug mode
[1588]48   p ) phys="${OPTARG}";;     ## choose physics
[118]49   f ) fresh_start=1;;        ## a fresh start
[1038]50   e ) from_scratch=1;;       ## a fresh start with a completely new folder
[1411]51   s ) scenario="${OPTARG}";; ## a specific scenario (with precompiling flags)
[1590]52   x ) donotcompile=1;phys="void_lmd_new";donotcompilephys=1;; ## a case with no LMD physics included
[11]53   h ) echo "
54# Use:   
55#
[142]56# makemeso                   ## basic use (real-case configuration)
[11]57#
58# makemeso -d                ## no compilation, just check the name of the compile folder
59#
[68]60# makemeso -c ideal          ## idealized mode (convective cell, mountain wave, etc...)
[142]61# makemeso -c les            ## large-eddy simulations mode based on WRFV3
[11]62#
[70]63# makemeso -n                ## do not recompile LMD physics (must have been compiled before)
[68]64#
[11]65# makemeso < last            ## basic use + skip questions [! script must have been executed at least once]
66# makemeso -r < last         ## basic use + skip questions + only known config
67# makemeso -nr < last        ## basic use + skip questions + only known config + no LMD phys recompile
68#
69# makemeso -j                ## just compile the LMD physics
70#
71# makemeso -g                ## debug mode
72#
73# makemeso -h                ## display options
[29]74#
[1588]75# makemeso -p mars_lmd_new   ## choose physics
[1597]76#             venus_lmd_new
[2014]77#             generic_lmd_new             
[54]78#
79# makemeso -f                ## fresh start [clean -a]
[118]80#
[1578]81# makemeso -e                ## a completely new recompile with erasing the WHOLE compiling folder
[1038]82#
[1411]83# makemeso -s DUSTSTORM      ## a specific scenario (with precompiling flags)
[156]84#
85# makemeso -x                ## a case with no LMD physics included
[11]86" ; exit ;;
87  esac
88done   
89
90#--------------
91# talk w/ user
92#--------------
93  echo '****************************************'
94  echo ' LMD Mesoscale Model Compiler. Welcome.'
95  echo '****************************************'
[1588]96  if [[ "${phys}" == *"new"* ]]
[29]97  then
[1588]98    echo '*********** PHYSICS: ' ${phys}
[29]99    echo '****************************************'
100  fi
[11]101  # computer
102  uname -a | grep x86_64 > /dev/null
103  if [[ "$?" == 0 ]]
104  then
105    machine='64'
106  else
107    machine='32'
108  fi
109  # compiler
110  echo "Supported compiler options are "
111  echo "       <1> pgf90"
112  echo "       <2> g95"
113  echo "       <3> pgf90 + mpi"
114  echo "       <4> ifort"
115  echo "       <5> ifort + mpi"
116  echo "       <7> xlf + mpi (IBM AIX)"
[1853]117  echo "       <8> gfortran"
[11]118  echo "Your choice ?" ; read reply
119  case ${reply} in
120    1) compilo='pgf' ; numproc=1 ;;
121    2) compilo='g95' ; numproc=1 ;;
122    3) compilo='mpi'
[1236]123       if [[ "${WHERE_MPI}" = "" ]]
[11]124       then
125         echo Please initialize the variable WHERE_MPI in your environnement
126         exit
[1236]127       fi ;;
[11]128    4) compilo='ifort' ; numproc=1 ;;
[1236]129    5) compilo='mpifort' ;;
130    7) compilo='mpixlf' ;;
[1853]131    8) compilo='gnu' ; numproc=1 ;;
[11]132    *) echo not supported by this script ; exit ;;
133  esac
[1236]134  # number of processors
[1597]135  if [[ "${phys}" == *"new"* ]]
[1236]136  then
137   numproc=999
138  else
139   case ${reply} in
140    3) echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;;
141    5) echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;;
142    7) echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;;
143   esac
144  fi
145
[11]146  # dimensions
147  if [ ${donotcompile} -eq 0 ]
148  then   
[1212]149  # ngrid: now dynamically set in newphys 03/2014
[1597]150   if [[ "${phys}" == *"new"* ]]
[1212]151   then
152      lon=999
153      lat=999
[1272]154      level=999
[1236]155   else
156      echo Grid points in longitude ? ; read lon
157      echo Grid points in latitude ? ; read lat
[1272]158      echo Number of vertical levels ? ; read level
[1212]159   fi
[11]160  fi
161  echo Number of domains ? ; read dom
162
163###PB lecture dom si < last
164
165    case ${dom} in
166       1) single='_single' ;;
167       *) single='_nest' ;;
168    esac
169      if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ]
170      then
171           single=''
172      fi
173
174testflag=''
175####
176#testflag='_test'
177####
178
[1588]179    conf_wrf="${phys}_${config}${scenario}_${compilo}_${machine}${single}${testflag}"
[1234]180
181    if [ ${debug} -eq 1 ]
182    then
183     conf_wrf="debug_${conf_wrf}"
184    fi
185
[11]186    \rm what_folder 2> /dev/null
187    echo ${conf_wrf} > what_folder
[1590]188         if [ ${donotcompile} -eq 0 ]
[11]189         then
[1590]190            ##\rm what_folder 2> /dev/null
191            ##echo '**********************'
192            ##echo '*** Your folder is ...'
193            ##echo '**********************'
194            ##echo ${conf_wrf} | tee what_folder
195            ##cat what_folder
196            ##echo ${conf_wrf} > what_folder
197            ##echo ${reply} > what_compilo
198            ##echo ${numproc} > what_numproc
199            #if [[ "${phys}" != "nophys_" ]]
200            #then
201            #  exit
202            #fi
203         #else
[1212]204            # tracers: now dynamically set in newphys 09/2013
[1597]205            if [[ "${phys}" == *"new"* ]]
[1038]206            then
207              tra=999
208            else
[1236]209              echo Number of tracers ? ; read tra
[1038]210              if [ ${tra} -eq 0 ]
211              then
212                tra=1   
213              fi
[157]214            fi
[11]215         fi
[1038]216  # 'from scratch' case
217  if [ ${from_scratch} -eq 1 ]
218  then
219      echo "***** I ERASE THE FOLDER "${conf_wrf}
220      \rm -rf ${conf_wrf}
221  fi
[11]222  # folder
[1588]223
[11]224  mkdir ${conf_wrf} 2> /dev/null
225  if [[ "$?" == 0 ]]
226  then
227    echo new folder ... link sources
[1588]228    ###############################################
[1597]229     echo ${phys}
[1588]230     ./SRC/SCRIPTS/copy_model -p ${phys} -c ${config}
[215]231     mv zeWRFV2 ${conf_wrf}/WRFV2
[1588]232    ###############################################
233     if [[ "${phys}" == *"new"* ]]
[1411]234     then
[1588]235      cd ${conf_wrf}/WRFV2
[1411]236        if [[ "${config}" != "les" ]]
[118]237        then
[1411]238           cp ../../SRC/WRFV2/Registry/Registry.EM.newphys Registry/Registry.EM
[118]239        else
[1411]240           cp -L ../../SRC/LES/WRFV2/Registry/Registry.EM.newphys Registry/Registry.EM
241        fi
[1588]242      cd phys
243      ln -sf module_lmd_driver.F.new module_lmd_driver.F
244      cd ..
[1212]245
[1746]246     else
247      cd ${conf_wrf}/WRFV2
248      cd Registry ; ./Registry.bash ; cd ..
[54]249     fi
[142]250          #### sparadrap consequent a l'utilisation de copy_model pour les liens
251          #### -- car alors il manque fftpack
252          if [[ "${config}" == "les" ]]
[158]253          then
[1389]254            cp ../../SRC/LES/correcfft ./
[142]255            ./correcfft
256            \rm correcfft
257          fi
[1588]258  else
[11]259    cd ${conf_wrf}/WRFV2
[54]260    if [ ${fresh_start} -eq 1 ]
261    then
262      echo '*** FRESH START, I clean everything'
[318]263      ### clean the whole place 
[54]264      clean -a > /dev/null 2> /dev/null
[318]265      ### get a possibly modified registry !
[1588]266      if [[ "${phys}" == *"new"* ]]
[333]267      then
[1411]268          cp ../../SRC/WRFV2/Registry/Registry.EM.newphys Registry/Registry.EM
269      else
270          cp ../../SRC/WRFV2/Registry/Registry.EM Registry/
[333]271      fi
[341]272      if [[ "${config}" == "les" ]]
273      then
274        cp ../../SRC/LES/WRFV2/Registry/Registry.EM Registry/
275      fi
[318]276      ### ensure the model will be recompiled from scratch with correct registry
[54]277      cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd ..
[262]278#     answer='y' ## a voir... pas si sur
279#    else
280#            if [[ "${phys}" != "nophys_" ]]
281#            then
282#      echo Did you modify anything in the Registry or clean ? y for yes, any key for no ; read answer
283#      case ${answer} in
284#        y) cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. ;;
285#        *) answer='no' ;;
286#      esac
287#            fi
[54]288    fi
[11]289  fi
[153]290
[11]291  # summary
292  echo '**********************'
293  echo '*** Your folder is ...'
294  echo '**********************'
295  echo ${conf_wrf}
296  echo '**********************'
297  echo '****************************************'
298  echo so ...
299  echo your computer is ${machine} bits
300  echo ${compilo} is your compiler
301       if [[ "${compilo}" = "mpi" ]]
302       then
303         echo MPICH is in ${WHERE_MPI}
304       fi
[1272]305  echo you have ${dom} domains
[1588]306  if [[ "${phys}" == *"new"* ]]
[153]307  then
[1236]308   echo number of processors can be changed without recompiling
309   echo x points can be changed without recompiling
310   echo y points can be changed without recompiling
[1272]311   echo z points can be changed without recompiling
[1236]312   echo number of tracers can be changed without recompiling
313  else
314   echo you will use ${numproc} processors
315   echo you have ${lon} x points
316   echo '         '${lat} y points
[1272]317   echo '         '${level} z points
[1236]318   echo '         '${tra} tracers
[153]319  fi
[11]320  echo '****************************************'
321  # save answer
322  \rm last 2> /dev/null
323  touch last
324  echo ${reply} >> last
[1588]325  if [[ "${phys}" != *"new"* ]]
[1236]326  then
327    if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ]
328    then
[11]329     echo ${numproc} >> last
[1236]330    fi
331    echo ${lon} >> last
332    echo ${lat} >> last
[1272]333    echo ${level} >> last
[1236]334  fi
[11]335  echo ${dom} >> last
[1588]336  if [[ "${phys}" != **"new"* ]]
[1236]337  then
338   echo ${tra} >> last
339  fi
[11]340
341#------------
342# log files
343#------------
344  \rm log_compile 2> /dev/null
345  \rm log_error 2> /dev/null
346
347#-----------------
348# configure WRF
349#-----------------
350  mv configure.wrf configure.wrf.bak 2> /dev/null
351  ########################
[30]352  conf_wrf_forall="${compilo}_${machine}${single}${testflag}"
[142]353
354         #### in this case options are different because for LES, WRFV3 is used
355         if [[ "${config}" == "les" ]]
356         then
357         conf_wrf_forall="${config}${compilo}_${machine}${single}${testflag}"
358         fi
359
[30]360  case ${conf_wrf_forall} in
[142]361
362     #######LES-specific (WRFV3-based) -- previously in 'makeles'
363     #######
364
365     lesmpi_64)        ## MPI (dm) 64 bits [PS: remplacer 3 par 4 pour openMP]
366                       \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 3 >> conf ; echo 1 >> conf
367                       \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null
[1588]368                       sed s+"-lnetcdf"+"-lnetcdf -L../$phys/libo -llmd"+g   configure.wrf > yeah ; mv -f yeah configure.wrf
[142]369                       if [[ "$(hostname)" == "ciclad1.ipsl.jussieu.fr" ]]
370                       then
371            echo "SPECIFIC CHANGES FOR CICLAD CLUSTER. EDIT makemeso IF YOU ENCOUNTER PROBLEMS."
372            #sed s+"mpif90 -f90=$(SFC)"+"/usr/lib64/openmpi/1.4.2-pgf/bin/mpif90"+g                      configure.wrf > yeah ; mv -f yeah configure.wrf
373            #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
[158]374            sed s+"mpif90 -f90=\$(SFC)"+"/usr/lib64/openmpi/1.4.3-pgfgcc/bin/mpif90"+g                   configure.wrf > yeah ; mv -f yeah configure.wrf
375            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
[142]376                       else
[390]377            #sed s+"mpif90"+"$WHERE_MPI/mpif90"+g                 configure.wrf > yeah ; mv -f yeah configure.wrf
378            #sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g    configure.wrf > yeah ; mv -f yeah configure.wrf
379            #### OPENMPI
380            sed s+"mpif90 -f90=\$(SFC)"+"$WHERE_MPI/mpif90"+g                 configure.wrf > yeah ; mv -f yeah configure.wrf
381            sed s+"mpicc -cc=\$(SCC)"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g    configure.wrf > yeah ; mv -f yeah configure.wrf
[142]382                       fi
383                       sed s+"-fastsse"+" "+g                               configure.wrf > yeah ; mv -f yeah configure.wrf
384                          ### pas forcement necessaire ici mais OK
385                          sed s+"-llmd"+"-llmd $NETCDF/lib/libnetcdf.a"+g     configure.wrf > yeah ; mv -f yeah configure.wrf
386                       \rm conf > /dev/null ;;
387
388     lesmpifort_64)    ## MPI (dm) 64 bits IFORT
389                       \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 7 >> conf ; echo 1 >> conf
390                       \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null
[1597]391                       if [[ "${phys}" != *"void"* ]]
392                       then
[1937]393                         sed s+"-lnetcdff"+"TOZTOZ"+g configure.wrf > yeah ; mv -f yeah configure.wrf
394                         # ... in case there is netcdff save it in TOZTOZ so that it is not impacted in the following sed
[1597]395                         sed s+"-lnetcdf"+"-lnetcdf -L../$phys/libo -llmd $NETCDF/lib/libnetcdf.a"+g   configure.wrf > yeah ; mv -f yeah configure.wrf
[1937]396                         sed s+"TOZTOZ"+"-lnetcdff"+g configure.wrf > yeah ; mv -f yeah configure.wrf
[1597]397                       else
398                         sed s+"-lnetcdf"+"-lnetcdf $NETCDF/lib/libnetcdf.a"+g   configure.wrf > yeah ; mv -f yeah configure.wrf
399                       fi
[142]400                       sed s+"mpif90"+"$WHERE_MPI/mpif90"+g                 configure.wrf > yeah ; mv -f yeah configure.wrf
401                       sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g    configure.wrf > yeah ; mv -f yeah configure.wrf
402                       sed s+"-fastsse"+" "+g                               configure.wrf > yeah ; mv -f yeah configure.wrf
[1597]403                       sed s+"O3"+"O3 -mcmodel=large -shared-intel"+g configure.wrf > yeah ; mv -f yeah configure.wrf
[1587]404                       #sed s+"-lnetcdf -lnetcdff"+"-lnetcdf -lnetcdff -L../mars_lmd/libo -llmd"+g     configure.wrf > yeah ; mv -f yeah configure.wrf
[674]405                       if [ ${debug} -ne 0 ]   # not working for xlf!
406                             then
407                             echo 'DEBUG DEBUG DEBUG DEBUG'
[790]408                             sed s+"# -g"+" -g -no-ftz -traceback -ftrapuv -fp-stack-check -check"+g configure.wrf > yeah
[674]409                             mv -f yeah configure.wrf
410                       fi
[142]411                       \rm conf > /dev/null ;;
412
[2094]413     lesgnu_64_single) echo Special option...
414                       \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 11 >> conf ; echo 0 >> conf
415                       configure  < conf > log_compile 2> log_error
416                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf 
417                       sed s+"-lnetcdff"+'-lnetcdff -I$(WRF_SRC_ROOT_DIR)/inc'+g configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[142]418     #######
419     #######LES-specific (WRFV3-based) -- previously in 'makeles'   
420
[11]421                     # GFORTRAN, 64 bits, no nesting     
422     gnu_64_single)    cd arch ; ln -sf ../configure.defaults.gfortran64 configure.defaults ; cd ..
423                       echo 15 | configure > log_compile 2> log_error
[1588]424                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf 
[2094]425                       sed s+"-L../$phys/libo -llmd"+"-lnetcdf -lnetcdff -L../$phys/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[11]426                     # PGF90, 32 bits, no nesting
427     pgf_32_single)    echo 1 | configure > log_compile 2> log_error
[1588]428                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[11]429                     # PGF90, 32 bits, nesting
430     pgf_32_nest)      echo 2 | configure > log_compile 2> log_error
[1588]431                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[11]432                     # PGF90, 64 bits, no nesting
433     pgf_64_single)    echo 1 | configure > log_compile 2> log_error
[330]434                       #### the following line is necessary because readtesassim has a line "use netcdf" in it!
[1588]435                       #sed s+"-L../$phys/libo -llmd"+"-L../$phys/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf
436                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[11]437                     # PGF90, 64 bits, nesting
438     pgf_64_nest)      cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
439                       echo 4 | configure > log_compile 2> log_error
[1588]440                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[11]441                     # G95, 32 bits, no nesting
442     g95_32_single)    echo 13 | configure > log_compile 2> log_error
[1588]443                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[24]444                     # G95, 64 bits, no nesting  ### we modify configure.defaults to add x86_64 next to g95 in the header comment
445     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 ..
446                       echo 14 | configure > log_compile 2> log_error
[330]447                         ##### marche pas ....
448                         #sed s+"-fno-second-underscore"+""+g configure.wrf > yeah ; mv -f yeah configure.wrf
[1588]449                         #sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf
450                         #sed s+"-L../$phys/libo -llmd"+"-L../$phys/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf ;;
451                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;;
[24]452                       #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;;
[11]453                     # IFORT, 64 bits, no nesting
454     ifort_64_single)  echo 5 | configure > log_compile 2> log_error
455                       sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
[674]456                       if [ ${debug} -ne 0 ]   # not working for xlf!
457                             then
458                             echo 'DEBUG DEBUG DEBUG DEBUG'
[790]459                             sed s+"# -g"+" -g -no-ftz -traceback -ftrapuv -fp-stack-check -check"+g configure.wrf > yeah
[674]460                             mv -f yeah configure.wrf
461                       fi
[11]462                         ## !!! NETCDF must be defined
[1588]463                         sed s+"lio_grib_share"+"lio_grib_share -L../$phys/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah
[11]464                         mv -f yeah configure.wrf ;;
465     mpifort_64)     # MPI+IFORT, 64 bits, no nesting / nesting
[1752]466                       echo 9 | ./configure > log_compile 2> log_error
[1588]467                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf
[11]468                       sed s+"-f90=ifort"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
469                       sed s+"-cc=icc"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
470                       sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
[1440]471                       sed s+"-O1"+"-O1 -mcmodel=medium -shared-intel"+g configure.wrf > yeah ; mv -f yeah configure.wrf
472                       sed s+"-O2"+"-O2 -mcmodel=medium -shared-intel"+g configure.wrf > yeah ; mv -f yeah configure.wrf
473                       sed s+"-O3"+"-O3 -mcmodel=medium -shared-intel"+g configure.wrf > yeah ; mv -f yeah configure.wrf
[674]474                       if [ ${debug} -ne 0 ]   # not working for xlf!
475                             then
476                             echo 'DEBUG DEBUG DEBUG DEBUG'
[1752]477                             sed s+"#-g"+" -g -no-ftz -traceback -ftrapuv -fp-stack-check -check"+g configure.wrf > yeah
[674]478                             mv -f yeah configure.wrf
479                       fi
[11]480                       sed s+"O3"+"O2"+g configure.wrf > yeah ; mv -f yeah configure.wrf
481                                        #sed s+"O3"+"O0"+g configure.wrf > yeah ; mv -f yeah configure.wrf  ### pour compilation rapide
482                                        #-w -ftz -align all -fno-alias -fp-model precise >>> options indiquees dans WRF3
483                                        #http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-wrf-with-the-intel-compilers/
484                            #### NB: RSL is replaced by RSL_LITE, better memory capacity, less seg fault
485                            sed s+"../external/RSL/RSL"+"../external/RSL_LITE"+g configure.wrf > yeah ; mv -f yeah configure.wrf
486                            sed s+"-DWRF_RSL_IO"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
487                            sed s+"-DRSL"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
488                            sed s+"librsl.a"+"librsl_lite.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf
489                            sed s+"../external/RSL/gen"+"../external/RSL_LITE/gen"+g configure.wrf > yeah ; mv -f yeah configure.wrf
490                            sed s+"../external/RSL/module"+"../external/RSL_LITE/module"+g configure.wrf > yeah ; mv -f yeah configure.wrf
491                            sed s+"-lrsl"+"-lrsl_lite"+g configure.wrf > yeah ; mv -f yeah configure.wrf
492                            sed s+"linux"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf
493                         ### necessary even if mpi-selector is used (no need in makegcm though)
494                         sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g > yeah ; mv -f yeah configure.wrf
495                         sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf
496                         ## !!! NETCDF must be defined
[1752]497                         if [[ "${phys}" != *"void"* ]]
498                         then
499                           sed s+"-L../$phys/libo -llmd"+"-L../$phys/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah
500                         else
501                           sed s+"-lesmf_time"+"-lesmf_time $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah
502                         fi
[70]503                         mv -f yeah configure.wrf
504                         #### POUR LE TRAITEMENT PARTICULIERS des NESTS sur iDATAPLEX [cf. module_lmd_driver]
[71]505                         sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -DSPECIAL_NEST_SAVE "+g configure.wrf > yeah
[11]506                         mv -f yeah configure.wrf ;;
507                     # MPICH, 64 bits, no nesting / nesting
508     mpi_64)           cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
509                       echo 3 | configure > log_compile 2> log_error
[1588]510                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf
[227]511                       ### the following line is necessary because readtesassim has a line "use netcdf" in it!
[1588]512                       sed s+"-L../$phys/libo -llmd"+"-L../$phys/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf
[11]513                       sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah
[341]514                       #sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT -w -O3"+g > yeah
[11]515                                #| sed s+"fastsse"+"fast"+g > yeah
[341]516                       mv -f yeah configure.wrf ;;
[335]517                       #    #sed s+"-fastsse"+"-O2 -Munroll -Mcache_align"+g configure.wrf > yeah
518                       #    ##sed s+"-fastsse"+"-O2 -fpic"+g configure.wrf > yeah ## marche pas, ILM problem
519                       #    ##sed s+"-fastsse"+"-mcmodel=medium -Mlarge_arrays"+g configure.wrf > yeah ## marche pas, ILM problem
520                       #sed s+"-fastsse"+"-O3 -tp=nehalem-64 -fastsse -Mscalarsse -Mvect=sse -Mipa=fast"+g configure.wrf > yeah
521                       #sed s+"-fastsse"+"-O2 -Munroll -Mcache_align"+g configure.wrf > yeah
[341]522                       #sed s+"-fastsse"+""+g configure.wrf > yeah
523                       #sed s+"-fastsse"+"-fast"+g configure.wrf > yeah
524                       #sed s+"-fastsse"+"-Mvect=noaltcode -Msmartalloc -Mprefetch=distance:8 -Mfprelaxed"+g configure.wrf > yeah
525                       #mv -f yeah configure.wrf ;;
[11]526                     # MPICH, 64 bits, OK with periodic BC but no positive definite
527     mpi_64_test)      cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
528                       echo 2 | configure > log_compile 2> log_error
[1588]529                       sed -f physics.sed configure.wrf > yeah ; mv -f yeah configure.wrf
[11]530                       sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah
531                       mv -f yeah configure.wrf ;;
532                     # XLF+MPICH on AIX machine (64 bits) with nesting, NB: the 32bits notice is not to be considered
533     mpixlf_32)        cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd ..
534                       echo 3 | configure > log_compile 2> log_error
[1588]535                       sed -f physics.sed configure.wrf > yeah
[11]536                       mv -f yeah configure.wrf ;;
537                     # ANYTHING ELSE
538     *)                echo NO PRESETS ...
539                       if [ ${donotallow} -eq 0 ] 
540                       then
541                         configure
542                       else
543                         # problem when an input file is used
544                         echo 'please cd to '$PWD' and type ./configure' 
545                         exit   
546                       fi ;;
547  esac
548  ########################
549
[142]550
[156]551  ### here a case structure would be great
552
[1588]553  if [[ "${phys}" == *"new"* ]]
[29]554  then
[142]555     if [[ "${config}" == "les" ]]  ### LES is different because of WRFV3
556     then
557       sed s+"ARCH_LOCAL      =       "+"ARCH_LOCAL      =       -DNEWPHYS "+g configure.wrf > yeah
558     else
559       sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -DNEWPHYS "+g configure.wrf > yeah
560     fi
[29]561     mv -f yeah configure.wrf
562  fi
[11]563
[1411]564        ### SCENARIO SCENARIO SCENARIO
565        if [[ ! ("${scenario}" == "") ]]   ### not supported with LES for the moment?
[118]566        then
[1411]567          # precompiling flag in WRF part
[118]568          sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -D${scenario} "+g configure.wrf > yeah
569          mv -f yeah configure.wrf
[1411]570          # precompiling flag in LMD part
[1588]571          cd $phys
[1411]572          cp -Lrf makegcm_${compilo} yeah
573          \rm makegcm_${compilo}
574          sed s+"-DMESOSCALE"+"-D${scenario} -DMESOSCALE"+ yeah > makegcm_${compilo}
575          chmod 755 makegcm_${compilo}
576          \rm yeah
577          cd ..
[118]578        fi
579
[156]580  ################
[1590]581  #if [[ "${phys}" == "nophys_" ]]
582  #then
583  #   if [[ "${config}" == "les" ]]  ### LES is different because of WRFV3
584  #   then
585  #     sed s+"ARCH_LOCAL      =       "+"ARCH_LOCAL      =       -DNOPHYS "+g configure.wrf > yeah ; mv -f yeah configure.wrf
586  #     sed s+"-L../$phys/libo -llmd"+""+g configure.wrf > yeah ; mv -f yeah configure.wrf
587  #   else
588  #     ### not tested yet but should be working 
589  #     echo CAUTION CAUTION CAUTION NOT FULLY TESTED
590  #     sed s+"ARCHFLAGS       =       "+"ARCHFLAGS       =       -DNOPHYS "+g configure.wrf > yeah ; mv -f yeah configure.wrf
591  #     sed s+"-L../$phys/libo -llmd"+""+g configure.wrf > yeah ; mv -f yeah configure.wrf
592  #   fi
593  #fi
[156]594  ################
595
[1597]596  if [[ "${phys}" == *"venus"* ]]
597  then
598    sed s+"LIB_BUNDLED     = "+"LIB_BUNDLED     =    /usr/lib64/liblapack.so  \ "+g configure.wrf > yeah ; mv -f yeah configure.wrf
599  fi
600
[11]601  if [ ${debug} -ne 0 ]   # not working for xlf!
602  then
603    echo 'DEBUG DEBUG DEBUG DEBUG'
[790]604    sed s+"# -g"+" -g -no-ftz -traceback -ftrapuv -fp-stack-check -check"+g configure.wrf > yeah
605    #sed s+"# -g"+"-g -Ktrap=fp -Mbounds"+g configure.wrf > yeah
606    #sed s+"# -g"+"-g"+g configure.wrf > yeah
[11]607    mv -f yeah configure.wrf
608  fi
609
[1605]610  if [[ "${phys}" == *"prescribed"* ]]
611  then
612     donotcompilephys=1
[1846]613  fi
[1597]614
[1846]615  # some compiler and environment mess things up when using -C
616  sed s+"-C"+""+g configure.wrf > yeah ; mv -f yeah configure.wrf   
617
[1588]618#exit
[11]619##################################################
620# compile physics
621##################################################
[1597]622if [ ${donotcompilephys} -eq 0 ] #|| [[ "${phys}" != *"prescribed"* ]]
[11]623then
624
[1588]625 cd $phys/
[11]626
[1588]627 if [[ "${phys}" == *"new"* ]]
[1212]628 then
629  divx=1
630  divy=1
631 else
[11]632  # required size
633  #----------------
634  case ${numproc} in
[239]635      1) divx=1 ; divy=1  ;;
636      2) divx=1 ; divy=2  ;;
637      4) divx=2 ; divy=2  ;;
638      6) divx=2 ; divy=3  ;;
639      8) divx=2 ; divy=4  ;;
640     12) divx=3 ; divy=4  ;;
641     16) divx=4 ; divy=4  ;;
642     20) divx=4 ; divy=5  ;;
643     24) divx=4 ; divy=6  ;;
644     32) divx=4 ; divy=8  ;;
645     64) divx=8 ; divy=8  ;;
646    128) divx=8 ; divy=16 ;;
647      *) echo not yet supported ; exit ;;
[11]648  esac
[1212]649 fi
[240]650  physx=$(expr ${lon} - 1)
651  restex=$(expr ${physx} \% ${divx})   
652  physy=$(expr ${lat} - 1)
653  restey=$(expr ${physy} \% ${divy})
[239]654  if [[ ${restex} != 0 || ${restey} != 0 ]]
655  then
656     echo nx-1 shall be divided by ${divx}
657     echo ny-1 shall be divided by ${divy}
658     exit
659  fi
[240]660  physx=$(expr ${physx} \/ ${divx})
661  physy=$(expr ${physy} \/ ${divy})
[239]662  physz=$(expr ${level} - 1)
[11]663
664  # change this if you change num_soil_layers in WRF
665  # -- default is 10
[1588]666  if [[ "${phys}" == *"new"* ]]
[30]667  then
[1212]668     soilsize=18 ## nouvelle physique. ne sert a rien ici. voir comsoil.
[30]669  else
670     soilsize=10
671  fi
[11]672
673  # GCM environment variables
674  #--------------------------
675  export LMDGCM=$PWD
676  export LIBOGCM=$PWD/libo
677
678  # generate the appropriate dimphys
679  #---------------------------------
[1597]680  if [[ "${phys}" == *"mars"* ]]
681  then
682    cd libf/phymars
683  elif [[ "${phys}" == *"venus"* ]]
684  then
685    cd libf/phyvenus
[2015]686  elif [[ "${phys}" == *"generic"* ]]
[2014]687  then
688    cd libf/phystd
[1597]689  fi
[11]690  \rm dimphys.h 2> /dev/null
[1746]691#  if [[ "${phys}" == "newphys_" ]]
692#  then
693#    ln -sf ../../meso_dimphys.h_ref . ## ne sert plus !!
694#  else
695  if [[ "${phys}" == "mars_lmd" ]]
[235]696  then
[1272]697    physize=$(expr ${physx} \* ${physy})
698    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
699    head -15 dimphys.h
[235]700  fi
[1746]701     #### TEST new new phys
[1578]702     #if [[ "${phys}" == "newphys_" ]]
703     #then
704     #  touch gr_fi_dyn.F.lien
705     #    ln -sf ../dyn3d/gr_fi_dyn.F .  ## dommage, a corriger
[1746]706     ################################
707     ################################
708     ################################
[1578]709     #fi
[1746]710     ####
711     ####
[11]712  cd ../..
713
714  # prepare for nesting
715  #---------------------
716  cd libf
717  duplicate${dom} 2> /dev/null
718  cd ..
719
720  # compile physics
721  #--------------------------
722  \rm libf/grid/dimensions.h 2> /dev/null
723  \rm -rf libo/* 2> /dev/null
724  echo 1. compiling LMD physics ...
725  echo compilation info in:
726  echo $PWD/libo/log_compile_phys
[2094]727  echo $PWD/libo/log_compile_phys2
[1746]728
[1597]729  if [ ${debug} -ne 0 ] 
[11]730  then
[1597]731    if [[ "${phys}" == *"mars"* ]]
732    then
733      echo 'DEBUG DEBUG DEBUG DEBUG'
[1746]734      nohup makegcm_${compilo} -debug -full -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
[1597]735    elif [[ "${phys}" == *"venus"* ]]
[1752]736    then
[1597]737      echo 'DEBUG DEBUG DEBUG DEBUG'
[1752]738      nohup ./makelmdz -debug -full -p venus -d 51 rcm1d -arch linux-ifort -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys # on /u/ and /planeto/
739      nohup ./makelmdz --debug p venus -d 51 rcm1d -arch linux-ifort -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
[2014]740    elif [[ "${phys}" == *"generic"* ]]
741    then
742      echo 'DEBUG DEBUG DEBUG DEBUG'
743      nohup ./makelmdz -debug -t ${tra} -p std -b 36x32 -s 1 -d 25 rcm1d -arch X64_MESU -cpp MESOSCALE | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys #Proxb
[1597]744    fi
[11]745  else
[2037]746    if [[ "${phys}" == *"mars"* ]]
[1597]747    then
748      nohup makegcm_${compilo} -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
749    elif [[ "${phys}" == *"venus"* ]]
750    then
[1752]751      nohup ./makelmdz -full -p venus -d 51 rcm1d -arch linux-ifort_meso -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys # on /u/ and /planeto/
752      nohup ./makelmdz -p venus -d 51 rcm1d -arch linux-ifort_meso -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
753      #nohup ./makelmdz -full -p venus -d 51 rcm1d -arch CICLADifort -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys # on CICLAD
754      #nohup ./makelmdz -p venus -d 51 rcm1d -arch CICLADifort -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
755      #nohup ./makelmdz -full -p venus -d 51 rcm1d -arch X64_MESU -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys #on MESU
756      #nohup ./makelmdz -p venus -d 51 rcm1d -arch X64_MESU -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
757      #nohup makelmdz -full -p venus -d 51 rcm1d -arch X64_OCCIGEN -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys #on OCCIGEN
758      #nohup makelmdz -p venus -d 51 rcm1d -arch X64_OCCIGEN -cpp MESOSCALE  | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys
[2014]759    elif [[ "${phys}" == *"generic"* ]]
760    then
[2058]761      nohup ./makelmdz -t 1 -p std -b 38x36 -full -s 1 -d 25 rcm1d -arch mascaret_gfortran_para -cpp MESOSCALE | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys #Proxb
[2094]762      nohup ./makelmdz -t 1 -p std -b 38x36 -s 1 -d 25 rcm1d -arch mascaret_gfortran_para -cpp MESOSCALE | tee libo/log_compile_phys2 | grep 'warnings' >> libo/log_compile_phys2 #Proxb
[2037]763    fi
[11]764  fi
765  echo ... done
766        # clean the duplicate routines
767        cd libf
768        duplicate1 2> /dev/null
769        cd ..
770
771  # merge LMD executables in one lib
772  #--------------------------------------
773  cd libo
774  mkdir temp
[1752]775  if [[ "${phys}" == *"mars"* ]]
[1601]776  then
[1752]777    cp -f LINUX*/*.a temp
[2014]778  else #VENUS and GENERIC
[2058]779#    cp -f linux*/*.a temp/ # on /u/ and /planeto/
780    cp -f */*.a temp/ # on /u/ and /planeto/
[1752]781    #cp -f /home/mlefevre/modipsl/lib/libioipsl.a temp/ #on CICLAD
782    #cp -f X64*/*.a temp #on MESU and OCCIGEN
[2058]783    cp -f $pathioipsl/libioipsl.a temp/
[1597]784  fi
[11]785  cd temp
[1597]786  if [[ "${phys}" == *"mars"* ]]
787   then   
788   ar x libbibio.a
789   ar x libphymars.a
790   ar x libaeronomars.a
[2014]791  elif [[ "${phys}" == *"venus"* ]]
792   then
[1597]793   ar x libphyvenus.a
794   ar x libmisc.a
795   ar x libphy_common.a
[1601]796   ar x libioipsl.a
[2014]797  elif [[ "${phys}" == *"generic"* ]]
798   then
799   ar x libphystd.a
800   ar x libmisc.a
801   ar x libphy_common.a
802   ar x libioipsl.a
[1597]803  fi
[11]804  \rm *.a
805  ar r liblmd.a *
806  cp -f liblmd.a ..
807  cd ..
808  \rm -r temp
809  nm liblmd.a > liblmd_content
810  # finish merge
811  cd ..
[1588]812  if [[ "${phys}" == *"new"* ]]
[1234]813  then
[1597]814    if [[ "${phys}" == *"mars"* ]]
815    then
816      # include modules for interfacing
817      mv  *.mod ../inc/
[2014]818    else
[2058]819#      mv  ./libo/linux*/*.mod ../inc/ # on /u/ and /planeto/
820      mv  ./libo/*/*.mod ../inc/ # on /u/ and /planeto/
[1752]821      #mv  ./libo/CICLAD*/*.mod ../inc/ # on CICLAD
822      #mv  ./libo/X64*/*.mod ../inc/ # on MESU and OCCIGEN
[2058]823      cp -f $pathioipsl/*.mod ../inc/
[1597]824    fi
[1234]825  fi
826
[1597]827
[11]828  # save a copy
829  #--------------
[1247]830  cp -f libo/liblmd.a libo/liblmd.a_${lon}_${lat}_${level}_${dom}_${tra}
[11]831  echo '****************************************'
832
833  # ok
834  #----
835  cd ..
836
837  # manage nest includes in module_lmd_driver.F
838  #----
839  cp call_meso_inifis$dom.inc call_meso_inifis.inc
840  cp call_meso_physiq$dom.inc call_meso_physiq.inc
841
842
843fi
844##################################################
845# END compile physics
846##################################################
847
848#------------------
849# compile WRF
850#------------------
851if [ ${justphys} -eq 0 ]
852then
853
854  echo 2. compiling WRF dynamical core ...
855
[1590]856  #if [[ "${phys}" == "nophys_" ]]
857  #then
858  # echo 'NO LMD PHYSICS included'
859  #else
860  # if [[ ! ( -f "call_meso_physiq.inc" ) ]]
861  # then
862  #  echo 'did you compile the physics ? no call_meso_physiq.inc !'
863  #  exit
864  # fi
865  #fi
[11]866
867  # be sure to compile with the most recent physics
868  touch phys/module_lmd_driver.F
869
870  # talk to user
871  echo '>>> compiling ... this may be long ... <<<'
872  echo check progress in:
873  echo $PWD/log_compile
874  echo check possible errors in:
875  echo $PWD/log_error
876 
877  # compile ...
[1588]878  echo '>>> YOUR CONFIG IS : '${config}
[11]879  case ${config} in
[1588]880    'real')         ./compile em_real > log_compile 2> log_error
[11]881                    # save executables 
882                    cd main
[68]883                      if [[ -f real.exe ]]
884                      then
885                        echo 'Looks good ! real.exe is here...'
886                      fi
[11]887                      if [[ -f wrf.exe ]]
888                      then
889                        echo 'Looks good ! wrf.exe is here...'
890                      fi
[1247]891                    cp -f real.exe ../../real_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
892                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
[11]893                    cd ..  ;;
[68]894    'ideal')        #mkdir 'test/em_quarter_ss' 2> /dev/null
[1588]895                    #echo '>>> YOUR CONFIG IS : '${config}
[421]896                    ./compile em_quarter_ss > log_compile 2> log_error
[11]897                    # save executables 
898                    cd main
[68]899                      if [[ -f ideal.exe ]]
900                      then
901                        echo 'Looks good ! ideal.exe is here...'
902                      fi
[11]903                      if [[ -f wrf.exe ]]
904                      then
905                        echo 'Looks good ! wrf.exe is here...'
906                      fi
[1247]907                    cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
908                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
[11]909                    cd ..  ;;
[1588]910    'les')          #echo '>>> YOUR CONFIG IS : '${config}
[142]911                    mkdir 'test/em_les' 2> /dev/null                   
[2094]912                    ./compile em_les ###> log_compile 2> log_error
[142]913                    # save executables 
914                    cd main
915                      if [[ -f ideal.exe ]]
916                      then
917                        echo 'Looks good ! ideal.exe is here...'
918                      fi
919                      if [[ -f wrf.exe ]]
920                      then
921                        echo 'Looks good ! wrf.exe is here...'
922                      fi
[1247]923                    cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
924                    cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe
[142]925                    cd ..  ;;
926    *)              echo not supported... please use ; echo ideal les ; exit ;;
[11]927  esac
928  echo '*******last lines from log_error*********'
929  tail -n 20 log_error
930fi
931
932  # the end
933  echo '****************************************'
934  echo 'done.'
935  echo '****************************************'
[1247]936  cp last ../makemeso_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}
[11]937  mv last ../../
[1247]938  svn info ../../ > ../makemeso_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.svn.info
[11]939
[1445]940  # link latest compiled folder as LATEST
941  cd ../../
[1448]942  rm -rf LATEST
[1445]943  ln -sf ${conf_wrf} LATEST
944
[1855]945  # link latest compiled exec
946  cd LATEST
947  case ${config} in
948    'real')         ln -sf real_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe real.exe ;;
949    'ideal')        ln -sf ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe ideal.exe ;;
950    'les')          ln -sf ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe ideal.exe ;;
951  esac
952  ln -sf wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe wrf.exe
953  cd ..
954
[11]955  # add here specific messages
956  if [[ "${dom}" != "1" ]]
957  then
958  nest=$(expr ${lon} + 4)
959  echo NB: in namelist.input, please set:
960  echo '
961  max_dom = '$dom'
962  s_we    = 1,1,
963  e_we    = '$lon','$nest',
964  s_sn    = 1,1,
965  e_sn    = '$lat','$nest',
966  s_vert  = 1,1,
967  e_vert  = '$level','$level','
968  fi
969
[1588]970
Note: See TracBrowser for help on using the repository browser.