source: LMDZ6/branches/Ocean_skin/makelmdz_fcm @ 3555

Last change on this file since 3555 was 3434, checked in by lguez, 6 years ago

Forgot to include makelmdz_fcm in previous commit.

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