source: LMDZ6/branches/LMDZ-ECRAD/makelmdz_fcm @ 4092

Last change on this file since 4092 was 3880, checked in by idelkadi, 3 years ago

Online implementation of the radiative transfer code ECRAD in LMDZ.

  • Inclusion of the ecrad directory containing the sources of the ECRAD code
  • Adaptation of compilation scripts (CPP_ECRAD keys)
  • Call of ecrad in radlwsw_m.F90 under the logical key iflag_rrtm = 2
  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 21.3 KB
RevLine 
[1279]1#!/bin/bash
2# $Id: makelmdz_fcm 3880 2021-04-28 14:55:57Z fhourdin $
3# This is a script in Bash.
4
[2098]5# FH : on ne cr\'ee plus le fichier arch.mk qui est suppos\'e exister par
[783]6# FH : ailleurs.
[2098]7# FH : ulterieurement, ce fichier sera pr\'e-existant pour une s\'erie
8# FH : de configurations en versions optimis\'ees et debug qui seront
9# FH : li\'es (ln -s) avec arch.mk en fonction de l'architecture.
10# FH : Pour le moment, cette version est en test et on peut cr\'eer les
11# FH : arch.mk en lan\c{}cant une premi\`ere fois makegcm.
[783]12#
[1279]13##set -x
[2202]14set -e
[783]15########################################################################
16# options par defaut pour la commande make
17########################################################################
18
[1279]19dim="96x72x19"
20physique=lmd
21filtre=filtrez
22grille=reg
23couple=false
24veget=false
[1865]25sisvat=false
[3793]26inlandsis=false
[1990]27rrtm=false
[3880]28ecrad=false
[2631]29dust=false
[2690]30strataer=false
[1279]31chimie=false
32parallel=none
[1680]33paramem="par"
[1279]34compil_mod=prod
35io=ioipsl
36LIBPREFIX=""
37cosp=false
[3358]38cosp2=false
[3491]39cospv2=false
[1802]40job=1
41full=''
[2358]42libphy=false
[783]43
[2743]44arch_defined="FALSE"
45arch_path="arch"
46arch_default_path="arch"
47
[1279]48LMDGCM=`/bin/pwd`
49LIBOGCM=$LMDGCM/libo
50LIBFGCM=$LMDGCM/libf
[2239]51DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
[2084]52# path for optional packages, but default set to ".void_dir"
[2239]53FILTRE_PATH=$LMDGCM/.void_dir
54DYN_PHYS_PATH=$LMDGCM/.void_dir
[2242]55DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
[2326]56PHY_COMMON_PATH=$LMDGCM/.void_dir
[2084]57RRTM_PATH=$LMDGCM/.void_dir
[3880]58ECRAD_PATH=$LMDGCM/.void_dir
[2631]59DUST_PATH=$LMDGCM/.void_dir
[2690]60STRATAER_PATH=$LMDGCM/.void_dir
[2084]61SISVAT_PATH=$LMDGCM/.void_dir
[1327]62COSP_PATH=$LMDGCM/.void_dir
[1578]63fcm_path=$LMDGCM/tools/fcm/bin
[783]64
65########################################################################
66#  Quelques initialisations de variables du shell.
67########################################################################
68
[1279]69CPP_KEY="" 
70INCLUDE=""
71LIB=""
72adjnt=""
73COMPIL_FFLAGS="%PROD_FFLAGS"
74PARA_FFLAGS=""
75PARA_LD=""
76EXT_SRC=""
[783]77
78########################################################################
79# lecture des options de mymake
80########################################################################
81
[1279]82while (($# > 0))
83  do
84  case $1 in
85      "-h") cat <<fin
[783]86Usage :
[1772]87makelmdz_fcm [options] -arch nom_arch exec
88[-h]                       : brief help
89[-d [[IMx]JMx]LM]          : IM, JM, LM are the dimensions in x, y, z (default: $dim)
90[-p PHYS]                  : set of physical parametrizations (in libf/phyPHYS), (default: lmd)
91[-prod / -dev / -debug]    : compilation mode production (default) / developement / debug
[1965]92[-c false/MPI1/OMCT]       : coupling with ocean model : MPI1/OMCT/false (default: false)
[1772]93[-v false/orchidee2.0/orchidee1.9/true] : version of the vegetation model to include (default: false)
94          false       : no vegetation model
[3435]95          orchidee2.1 : compile using ORCHIDEE 2.1 (or more recent version)
96          orchidee2.0 : compile using ORCHIDEE 2.0
[1772]97          orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
98          true        : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6
99[-chimie INCA/false]       : with INCA chemistry model or without (default: false)
[2238]100[-cosp true/false]    : compile with/without cosp package (default: false)
[3358]101[-cosp2 true/false]    : compile with/without cosp2 package (default: false)
[3491]102[-cospv2 true/false]    : compile with/without cospv2 package (default: false)
[2238]103[-sisvat true/false]  : compile with/without sisvat package (default: false)
[3793]104[-inlandsis true/false]  : compile with/without inlandsis package (default: false)
[2238]105[-rrtm true/false]    : compile with/without rrtm package (default: false)
[3880]106[-ecrad true/false]    : compile with/without ecrad package (default: false)
[2631]107[-dust true/false]    : compile with/without the dust package by Boucher and co (default: false)
[2690]108[-strataer true/false]    : compile with/without the strat aer package by Boucher and co (default: false)
[1772]109[-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
110[-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
[2097]111[-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
[1772]112[-include INCLUDES]        : extra include path to add
113[-cpp CPP_KEY]             : additional preprocessing definitions
114[-adjnt]                   : adjoint model, not operational ...
115[-mem]                     : reduced memory dynamics (if in parallel mode)
116[-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
117[-link LINKS]              : additional links with other libraries
[1802]118[-j n]                     : active parallel compiling on ntask
119[-full]                    : full recompiling
[2358]120[-libphy]                  : only compile physics package (no dynamics or main program)
[1772]121[-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
122[-ext_src path]            : path to an additional set of routines to compile with the model
[2743]123[-arch_path path]          : path to architecture files (default: $arch_default_path)
[1772]124 -arch nom_arch            : target architecture
125 exec                      : executable to build
[783]126fin
[1279]127          exit;;
[783]128
[1279]129      "-d")
130          dim=$2 ; shift ; shift ;;
131     
132      "-p")
133          physique="$2" ;  shift ; shift ;;
[783]134
[1279]135      "-g")
136          grille="$2" ; shift ; shift ;;
[783]137
[1279]138      "-c")
139          couple="$2" ; shift ; shift ;;
[783]140
[1279]141      "-prod")
142          compil_mod="prod" ; shift ;;
[1002]143
[1279]144      "-dev")
145          compil_mod="dev" ; shift ;;
[1002]146
[1279]147      "-debug")
148          compil_mod="debug" ; shift ;;
[1002]149
[1279]150      "-io")
151          io="$2" ; shift ; shift ;;
[783]152
[1279]153      "-v")
154          veget="$2" ; shift ; shift ;;
[783]155
[1865]156      "-sisvat")
157          sisvat="$2" ; shift ; shift ;;
158
[3793]159      "-inlandsis")
[3794]160    inlandsis="$2" ; shift ; shift ;;
[3793]161
[1990]162      "-rrtm")
163          rrtm="$2" ; shift ; shift ;;
164
[3880]165      "-ecrad")
166          ecrad="$2" ; shift ; shift ;;
167
[2631]168      "-dust")
169          dust="$2" ; shift ; shift ;;
170
[2690]171      "-strataer")
172          strataer="$2" ; shift ; shift ;;
173
[1279]174      "-chimie")
175          chimie="$2" ; shift ; shift ;;
[783]176
[1279]177      "-parallel")
178          parallel="$2" ; shift ; shift ;;
179     
180      "-include")
181          INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
[783]182
[1279]183      "-cpp")
184          CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
[1132]185
[1279]186      "-adjnt")
[1772]187          echo "not operational ... work to be done here ";exit
[1279]188          opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d "
189          optim="$optim -Dadj" ; shift ;;
[783]190
[1279]191      "-cosp")
192          cosp="$2" ; shift ; shift ;;
[3358]193
194      "-cosp2")
195          cosp2="$2" ; shift ; shift ;;
[3491]196
197      "-cospv2")
198          cospv2="$2" ; shift ; shift ;;
[1680]199     
200      "-mem")
201          paramem="mem" ; shift ;;
[783]202
[1279]203      "-filtre")
204          filtre=$2 ; shift ; shift ;;
[783]205
[1279]206      "-link")
207          LIB="$LIB $2" ; shift ; shift ;;
[1136]208
[1279]209      "-fcm_path")
210          fcm_path=$2 ; shift ; shift ;;
[783]211
[1279]212      "-ext_src")
213          EXT_SRC=$2 ; shift ; shift ;;
[2358]214
[1802]215      "-j")
216          job=$2 ; shift ; shift ;;
[2358]217
[1802]218      "-full")
219          full="-full" ; shift ;;
[783]220
[2358]221      "-libphy")
222          libphy="true" ; shift ;;
223
[1279]224      "-arch")
[2743]225          arch=$2 ; arch_defined="TRUE" ; shift ; shift ;;
[783]226
[2743]227      "-arch_path")
228          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
229
[1279]230      *)
231          code="$1" ; shift ;;
232  esac
233done
234
[1136]235###############################################################
[1755]236# path to fcm
[1136]237###############################################################
[1755]238# handle case when provided path to fcm was given as a relative
239# path (from makelmdz_fcm script directory) and not an absolute path
240if [[ ${fcm_path:0:1} != "/" ]] ; then
241  # prepend with makelmdz_fcm location
242  fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path}
243fi
[783]244
[1757]245# add fcm_path to PATH
246export PATH=${fcm_path}:${PATH}
247
[1755]248echo "Path to fcm:"
249echo ${fcm_path}
[1136]250
[783]251###############################################################
[2098]252# lecture des chemins propres \`a l'architecture de la machine #
[783]253###############################################################
[1279]254rm -f .void_file
255echo > .void_file
[1327]256rm -rf .void_dir
257mkdir .void_dir
[783]258
[2743]259if [[ "$arch_defined" == "TRUE" ]]
260then
261  rm -f arch.path
262  rm -f arch.fcm
263  rm -f arch.env
264
265  if test -f $arch_path/arch-${arch}.path
266  then
267    ln -s $arch_path/arch-${arch}.path arch.path
268  elif test -f $arch_default_path/arch-${arch}.path
269  then
270    ln -s $arch_default_path/arch-${arch}.path arch.path
271  fi
272       
273  if test -f $arch_path/arch-${arch}.fcm
274  then
275    ln -s $arch_path/arch-${arch}.fcm arch.fcm
276  elif test -f $arch_default_path/arch-${arch}.fcm
277  then
278    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
279  fi
280
281  if test -f $arch_path/arch-${arch}.env
282  then
283    ln -s $arch_path/arch-${arch}.env arch.env
284  elif test -f $arch_default_path/arch-${arch}.env
285  then
286    ln -s $arch_default_path/arch-${arch}.env arch.env
287  else
288    ln -s .void_file arch.env
289  fi
290  # source architecture PATH and ENV files
291  source arch.env
292  source arch.path
293else
294  echo "You must define a target architecture"
295  exit 1
296fi
297
[783]298########################################################################
299# Definition des clefs CPP, des chemins des includes et modules
300#  et des libraries
301########################################################################
302
[1279]303if [[ "$compil_mod" == "prod" ]]
304then
305  COMPIL_FFLAGS="%PROD_FFLAGS"
306elif [[ "$compil_mod" == "dev" ]]
307then
308  COMPIL_FFLAGS="%DEV_FFLAGS"
309elif [[ "$compil_mod" == "debug" ]]
310then
311  COMPIL_FFLAGS="%DEBUG_FFLAGS"
312fi
[783]313
[2250]314phys_root=$physique
315if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
316if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
317if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
318if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
319if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
320if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi
321if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
322
[1279]323if [[ "$physique" != "nophys" ]]
324then
[1615]325   #We'll use some physics
326   CPP_KEY="$CPP_KEY CPP_PHYS"
[2250]327   if [[ "${phys_root}" == "lmd" ]]
[1615]328   then
329   #For lmd physics, default planet type is Earth
[1279]330   CPP_KEY="$CPP_KEY CPP_EARTH"
[1615]331   fi
[2326]332   # set physics common utilities path
333   PHY_COMMON_PATH="${LIBFGCM}/phy_common"
[2239]334   # set the dyn/phys interface path
[2417]335   DYN_PHYS_PATH="${LIBFGCM}/dynphy_lonlat"
336   DYN_PHYS_SUB_PATH="${LIBFGCM}/dynphy_lonlat/phy${phys_root}"
[1279]337fi
[783]338
[2239]339if [[ "$filtre" == "filtrez" ]]
340then
341   FILTRE_PATH=${LIBFGCM}/$filtre
342fi
343
[1279]344if [[ "$chimie" == "INCA" ]]
345then
346   CPP_KEY="$CPP_KEY INCA"
347   INCLUDE="$INCLUDE -I${INCA_INCDIR}"
348   LIB="$LIB -L${INCA_LIBDIR} -lchimie"
349fi
[783]350
[1279]351if [[ "$couple" != "false" ]]
352then
[1965]353    if [[ "$couple" == "MPI1" ]]
354    then
355        CPP_KEY="$CPP_KEY CPP_COUPLE"
356        export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1
357        export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib
358        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
359        LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io"
360    else
361        CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT"
362        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
363        LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu"
364    fi
[1279]365fi
[783]366
[1279]367if [[ "$parallel" == "mpi" ]]
368then
369   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
370   PARA_FFLAGS="%MPI_FFLAGS"
371   PARA_LD="%MPI_LD"
372elif [[ "$parallel" == "omp" ]]
373then
374   CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
375   PARA_FFLAGS="%OMP_FFLAGS"
376   PARA_LD="%OMP_LD"
377elif [[ "$parallel" == "mpi_omp" ]]
378then
379   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
380   PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
381   PARA_LD="%MPI_LD %OMP_LD"
382fi
[783]383
[1279]384if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \
385   && "$compil_mod" == "debug" ]]
386then
387    echo "Usually, parallelization with OpenMP requires some optimization."
388    echo "We suggest switching to \"-dev\"."
389fi
[783]390
[3435]391if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" -o "$veget" = "orchidee2.1" ]
[1279]392then
[1811]393#NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
394#    For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
395#    option orchidee1.9 : Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
[1279]396   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
[1772]397   CPP_KEY="$CPP_KEY CPP_VEGET"
[1811]398# temporary, for Orchidee versions 1.9.* (before openmp activation)
399   if [[ "$veget" == "orchidee1.9" ]] ; then
400      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
401   fi
402   if [[ "$veget" == "orchidee2.0" ]] ; then
[1854]403      orch_libs="sechiba parameters stomate parallel orglob orchidee"
[3435]404      CPP_KEY="$CPP_KEY ORCHIDEE_NOUNSTRUCT"
405   elif [[ "$veget" == "orchidee2.1" ]] ; then
406      orch_libs="sechiba parameters stomate parallel orglob orchidee"
[1811]407   else
408      orch_libs="sechiba parameters stomate parallel orglob"
409   fi
410   LIB="${LIB} -L${ORCH_LIBDIR}"
411   for lib in ${orch_libs} ; do
412      if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then
413         LIB="${LIB} -l${LIBPREFIX}$lib "
414      fi
415   done
416elif [[ "$veget" != "false" ]] ; then
[1772]417   echo "Option -v $veget does not exist"
418   echo "Use ./makelmdz_fcm -h for more information"
419   exit 
[1279]420fi
[783]421
[1865]422if [[ "$sisvat" == "true" ]]
423then
424   CPP_KEY="$CPP_KEY CPP_SISVAT"
[2084]425   SISVAT_PATH="$LIBFGCM/%PHYS/sisvat"
[1865]426fi
427
[3793]428if [[ "$inlandsis" == "true" ]]
429then
430   CPP_KEY="$CPP_KEY CPP_INLANDSIS"
[3794]431   INLANDSIS_PATH="$LIBFGCM/%PHYS/inlandsis"
[3793]432fi
433
434
[1990]435if [[ "$rrtm" == "true" ]]
436then
437   CPP_KEY="$CPP_KEY CPP_RRTM"
[2084]438   RRTM_PATH="$LIBFGCM/%PHYS/rrtm"
[1990]439fi
440
[3880]441if [[ "$ecrad" == "true" ]]
442then
443   CPP_KEY="$CPP_KEY CPP_ECRAD"
444   ECRAD_PATH="$LIBFGCM/%PHYS/ecrad"
445fi
446
447
[2631]448if [[ "$dust" == "true" ]]
449then
450   CPP_KEY="$CPP_KEY CPP_Dust"
451   DUST_PATH="$LIBFGCM/%PHYS/Dust"
452fi
453
[2690]454if [[ "$strataer" == "true" ]]
455then
456   CPP_KEY="$CPP_KEY CPP_StratAer"
457   STRATAER_PATH="$LIBFGCM/%PHYS/StratAer"
458fi
459
[1279]460if [[ $io == ioipsl ]]
461then
462   CPP_KEY="$CPP_KEY CPP_IOIPSL"
463   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}"
464   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl"
[2097]465elif [[ $io == mix ]]
[1897]466then
467   # For now, xios implies also using ioipsl
468   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
469   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
[3075]470   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
[2097]471elif [[ $io == xios ]]
472then
473   # For now, xios implies also using ioipsl
474   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
475   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
[3075]476   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
[1279]477fi
[1897]478
[1279]479if [[ "$cosp" == "true" ]]
480then
481   CPP_KEY="$CPP_KEY CPP_COSP"
[2239]482   COSP_PATH="$LIBFGCM/phylmd/cosp"
[1279]483#   LIB="${LIB} -l${LIBPREFIX}cosp"
484fi
[783]485
[3358]486if [[ "$cosp2" == "true" ]]
487then
488   CPP_KEY="$CPP_KEY CPP_COSP2"
489   COSP_PATH="$LIBFGCM/phylmd/cosp2"
490#   LIB="${LIB} -l${LIBPREFIX}cosp2"
491fi
492
[3491]493if [[ "$cospv2" == "true" ]]
494then
495   CPP_KEY="$CPP_KEY CPP_COSPV2"
496   COSP_PATH="$LIBFGCM/phylmd/cospv2"
497#   LIB="${LIB} -l${LIBPREFIX}cosp2"
498fi
[3358]499
[3491]500
501
[1551]502INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
503LIB="$LIB ${NETCDF_LIBDIR}"
504
[783]505########################################################################
506# calcul du nombre de dimensions
507########################################################################
508
509
[1279]510dim_full=$dim
511dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
512set $dim
513dimc=$#
[783]514echo calcul de la dimension
515echo dim $dim
516echo dimc $dimc
517
518
519########################################################################
520# Gestion des dimensions du modele.
[1114]521# on cree ou remplace le fichier des dimensions
[783]522########################################################################
523
[1695]524cd $LIBFGCM/grid
525if [[ -f dimensions.h ]]
526then
527  echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
528  echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
529  echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
530  echo  vous pouvez continuer en repondant oui.
531  echo "Voulez-vous vraiment continuer?"
[1755]532  echo ""
533  echo "WARNING: you are probably already compiling the model somewhere else."
534  echo "Wait until the first compilation is finished before launching this one."
535  echo "If you are sure that you are not compiling elsewhere, just answer "
536  echo "yes (or 'oui') to the question below to proceed."
537  echo "Do you wish to continue?"
[1695]538  read reponse
[1755]539  if [[ $reponse == "oui" || $reponse == "yes" ]]
[1695]540  then
[1696]541    \rm -f $LIBFGCM/grid/dimensions.h
[1695]542  else
543    exit
544  fi
545fi
546
547
[783]548cd $LIBFGCM/grid/dimension
[1114]549./makdim $dim
[783]550cat $LIBFGCM/grid/dimensions.h
551cd $LMDGCM
552
553
554########################################################################
555# Differentes dynamiques (3d, 2d, 1d)
556########################################################################
557
[1279]558dimension=`echo $dim | wc -w`
[783]559echo dimension $dimension
560
[1279]561if (( $dimension == 3 ))
562then
[783]563  cd $LIBFGCM/grid
564  \rm fxyprim.h
565  cp -p fxy_${grille}.h fxyprim.h
[2239]566#else
567#  echo "Probleme dans les dimensions de la dynamique !!"
568#  echo "Non reactive pour l'instant !!!"
[1279]569fi
[783]570
[2239]571if (( $dimension == 1 ))
572then
573  CPP_KEY="$CPP_KEY CPP_1D"
574##in 1D, add dyn3d to include path (because main prog is in physics)
575  INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common"
576## no filtre in 1d:
577  FILTRE_PATH=$LMDGCM/.void_dir
578## no need to compile all routines in dyn3d_common either:
579  DYN_COMMON_PATH=$LMDGCM/.void_dir
580## no need to compile all routines in dynlmdz_phy... ;
581## (because key ones are included in 1D main program)
582  DYN_PHYS_PATH=$LMDGCM/.void_dir
[2242]583  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
[2239]584fi
585
[783]586######################################################################
587#   Traitement special pour le nouveau rayonnement de Laurent Li.
588#   ---> YM desactive pour le traitemement en parallele
589######################################################################
590
[1279]591#if [[ -f $libf/phy$physique/raddim.h ]]
592#then
593# if [[ -f $libf/phy$physique/raddim.$dimh.h ]]
594#then
[783]595#  \rm -f $libf/phy$physique/raddim.h
596#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
597#  echo $libf/phy$physique/raddim.$dimh.h
598#  cat $libf/phy$physique/raddim.h
599# else
600#  echo On peut diminuer la taille de l executable en creant
601#  echo le fichier $libf/phy$physique/raddim.$dimh.h
602#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
[1279]603# fi
604#fi
[783]605
606######################################################################
607# Gestion du filtre qui n'existe qu'en 3d.
608######################################################################
609
[1279]610if (( `expr $dimc \> 2` == 1 ))
611then
612   filtre="FILTRE=$filtre"
[783]613else
[1279]614   filtre="FILTRE= L_FILTRE= "
615fi
[783]616echo MACRO FILTRE $filtre
617
618echo $dimc
619
620
621
622######################################################################
623# Creation du suffixe de la configuration
624######################################################################
625
626
[1279]627SUFF_NAME=_${dim_full}
628SUFF_NAME=${SUFF_NAME}_phy${physique}
[783]629
[1279]630if [[ "$parallel" != "none" ]]
631then
632  SUFF_NAME=${SUFF_NAME}_para
[1680]633  DYN=dyn${dimc}d${paramem}
634  if [[ "$paramem" == "mem" ]]
635  then
[2202]636      SUFF_NAME=${SUFF_NAME}_${paramem}
637  else
638      echo "The version of the dynamics in dyn3dpar is no longer updated."
639      echo "You should use option \"-mem\"."
640      exit 1
[1680]641  fi
[783]642else
[1279]643  SUFF_NAME=${SUFF_NAME}_seq
[2239]644  if (( $dimension == 1 ))
645  then
646    # dynamics-related routines in"dyn1d" subdirectory of phy${physique}
647    DYN=phy${physique}/dyn1d
648  else
649    DYN=dyn${dimc}d
650  fi
[1279]651fi
[783]652
[1772]653if [[ $veget != "false" ]]
[1279]654then
655  SUFF_NAME=${SUFF_NAME}_orch
656fi
[783]657
[3804]658if [[ $dust == "true" ]]
659then
660  SUFF_NAME=${SUFF_NAME}_spla
661fi
662
[1279]663if [[ $couple != "false" ]]
664then
665  SUFF_NAME=${SUFF_NAME}_couple
666fi
[783]667
[1279]668if [[ $chimie == "INCA" ]]
669then
670  SUFF_NAME=${SUFF_NAME}_inca
671fi
[783]672
[2358]673if [[ $libphy == "true" ]]
674then
675  # special case where we compile only the physics
676  DYN=$LMDGCM/.void_dir
677  DYN_COMMON_PATH=$LMDGCM/.void_dir
678  FILTRE_PATH=$LMDGCM/.void_dir
679  DYN_PHYS_PATH=$LMDGCM/.void_dir
680  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
681  #and there is no main program to generate
682  code=""
683  SUFF_NAME=""
684else
685  SUFF_NAME=${SUFF_NAME}.e
686fi
687
[783]688cd $LMDGCM
[1279]689config_fcm="config.fcm"
[783]690rm -f $config_fcm
691touch $config_fcm
692rm -f bin/${code}${SUFF_NAME}.e
693rm -f arch.fcm
[1279]694rm -f arch.opt
[783]695
696echo "%ARCH          $arch"          >> $config_fcm
697echo "%INCDIR        $INCLUDE"       >> $config_fcm 
698echo "%LIB           $LIB"           >> $config_fcm
699echo "%ROOT_PATH     $PWD"           >> $config_fcm
700echo "%LIBF          $LIBFGCM"       >> $config_fcm
701echo "%LIBO          $LIBOGCM"       >> $config_fcm
702echo "%DYN           $DYN"           >> $config_fcm
[2239]703echo "%DYN_COMMON    $DYN_COMMON_PATH" >> $config_fcm
[2326]704echo "%PHY_COMMON    $PHY_COMMON_PATH" >> $config_fcm
[2239]705echo "%FILTRE        $FILTRE_PATH"   >> $config_fcm
[783]706echo "%PHYS          phy${physique}" >> $config_fcm
[2239]707echo "%DYN_PHYS      $DYN_PHYS_PATH" >> $config_fcm
[2242]708echo "%DYN_PHYS_SUB  $DYN_PHYS_SUB_PATH" >> $config_fcm
[2084]709echo "%RRTM          $RRTM_PATH"     >> $config_fcm
[3880]710echo "%ECRAD         $ECRAD_PATH"    >> $config_fcm
[2631]711echo "%DUST          $DUST_PATH"     >> $config_fcm
[2690]712echo "%STRATAER      $STRATAER_PATH" >> $config_fcm
[2084]713echo "%SISVAT        $SISVAT_PATH"   >> $config_fcm
[3793]714echo "%INLANDSIS     $INLANDSIS_PATH" >> $config_fcm
[1327]715echo "%COSP          $COSP_PATH"     >> $config_fcm
[783]716echo "%CPP_KEY       $CPP_KEY"       >> $config_fcm
717echo "%EXEC          $code"          >> $config_fcm
718echo "%SUFF_NAME     $SUFF_NAME"     >> $config_fcm
[1002]719echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm
720echo "%PARA_FFLAGS   $PARA_FFLAGS"   >> $config_fcm
721echo "%PARA_LD       $PARA_LD"       >> $config_fcm
[1279]722echo "%EXT_SRC       $EXT_SRC"       >> $config_fcm
[783]723
[1002]724
725
[1137]726ln -s arch/arch-${arch}.fcm arch.fcm
[1279]727if test -f arch/arch-${arch}.opt &&  [ $compil_mod = "prod" ]
728  then
729  ln -s arch/arch-${arch}.opt arch.opt
730else
731  ln -s .void_file arch.opt
732fi
733
[1002]734rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
[1802]735./build_gcm ${fcm_path} -j $job $full
[783]736
[3647]737err=$?
738# Check error message from fcm build
739if [ $err != 0 ] ; then
740  exit 1
741fi
742
[1279]743rm -rf tmp_src
744rm -rf config
[783]745ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config
[2358]746ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src
[1695]747
[1869]748
[1696]749if [[ -r $LIBFGCM/grid/dimensions.h ]]
[1695]750then
751  # Cleanup: remove dimension.h file
[1696]752  \rm -f $LIBFGCM/grid/dimensions.h
[1695]753fi
Note: See TracBrowser for help on using the repository browser.