source: trunk/LMDZ.COMMON/makelmdz_fcm @ 1818

Last change on this file since 1818 was 1793, checked in by jvatant, 8 years ago

Making Titan's hazy again, part I
+ Added the source folder libf/muphytitan which contains

YAMMS ( Titan's microphysical model ) from J. Burgalat

+ Modif. compilation files linked to this change
JVO

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