source: LMDZ6/trunk/makelmdz_fcm @ 3996

Last change on this file since 3996 was 3996, checked in by Ehouarn Millour, 4 years ago

Code cleanup. Remove obsolete "phymar" package and references thereto in the maklmdz[_fcm] scripts.
EM

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