source: trunk/LMDZ.COMMON/makelmdz_fcm @ 1782

Last change on this file since 1782 was 1695, checked in by emillour, 8 years ago

Common dynamics/framework:
Removed some obsolete arch files.
Reorganization of the way paths to external libraries are handles by makelmdz_fcm and makelmdz. This will ease interfacing with Dynamico which follows simillar rules with respect to a given external library ,e.g. for SOMELIBRARY, in the arch.path file:
SOMELIBRARY_LIBDIR="-L/path/to/the/library/libdir -L/possible/other/required/path"
SOMELIBRARY_LIB"-lsomelib -lsomeotherrequiredlib"
SOMELIBRARY_INCDIR"-I/path/to/the/library/incdir -I/possible/other/required/include/path"
EM

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