source: LMDZ6/trunk/makelmdz_fcm @ 3455

Last change on this file since 3455 was 3435, checked in by Laurent Fairhead, 6 years ago

"Historic" :-) commit merging the physics branch used for DYNAMICO with the LMDZ trunk.
The same physics branch can now be used seamlessly with the traditional lon-lat LMDZ
dynamical core and DYNAMICO.
Testing consisted in running a lon-lat LMDZ bucket simulation with the NPv6.1 physics package
with the original trunk sources and the merged sources. Tests were succesful in the sense that
numeric continuity was preserved in the restart files from both simulation. Further tests
included running both versions of the physics codes for one year in a LMDZOR setting in which
the restart files also came out identical.

Caution:

  • as the physics package now manages unstructured grids, grid information needs to be transmitted

to the surface scheme ORCHIDEE. This means that the interface defined in surf_land_orchidee_mod.F90
is only compatible with ORCHIDEE version orchidee2.1 and later versions. If previous versions of
ORCHIDEE need to be used, the CPP key ORCHIDEE_NOUNSTRUCT needs to be set at compilation time.
This is done automatically if makelmdz/makelmdz_fcm are called with the veget orchidee2.0 switch

  • due to a limitation in XIOS, the time at which limit conditions will be read in by DYNAMICO will be

delayed by one physic timestep with respect to the time it is read in by the lon-lat model. This is caused
by the line

IF (MOD(itime-1, lmt_pas) == 0 .OR. (jour_lu /= jour .AND. grid_type /= unstructured)) THEN ! time to read

in limit_read_mod.F90

Work still needed on COSP integration and XML files for DYNAMICO

EM, YM, LF

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