source: trunk/LMDZ.COMMON/makelmdz_fcm @ 2339

Last change on this file since 2339 was 2339, checked in by emillour, 4 years ago

Common dynamics:
Some cleanup in makelmdz_fcm. Note that arch.env and arch.path files may be shared with other models and can be in a remote directory (e.g. ../ARCH) but arch.fcm and arch.opt are local to the model and always to be found in the "arch" subdirectory.
EM

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