source: LMDZ6/trunk/makelmdz_fcm @ 4276

Last change on this file since 4276 was 4276, checked in by lguez, 20 months ago

Remove useless include flags

These are paths to non-existent directories because FCM does not
compile from LMDZ top source directory.

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