source: trunk/MESOSCALE/LMD_MM_MARS/makemeso @ 1898

Last change on this file since 1898 was 1855, checked in by aslmd, 8 years ago

link latest compiled exec in makemeso

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