source: LMDZ6/trunk/makelmdz_fcm @ 4247

Last change on this file since 4247 was 4247, checked in by tlurton, 20 months ago

Add-ons in oasis.F90, bld.cfg and makelmdz_fcm to support coupling of species between PISCES and INCA in the IPSLESM/CO2AER configuration.

  • 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.2 KB
Line 
1#!/bin/bash
2# $Id: makelmdz_fcm 4247 2022-09-15 07:54:51Z tlurton $
3# This is a script in Bash.
4
5# FH : on ne cr\'ee plus le fichier arch.mk qui est suppos\'e exister par
6# FH : ailleurs.
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.
12#
13##set -x
14set -e
15########################################################################
16# options par defaut pour la commande make
17########################################################################
18
19dim="96x72x19"
20physique=lmd
21filtre=filtrez
22grille=reg
23couple=false
24veget=false
25inlandsis=false
26rrtm=false
27rad="oldrad"
28dust=false
29strataer=false
30chimie=false
31parallel=none
32paramem="mem"
33compil_mod=prod
34io=ioipsl
35LIBPREFIX=""
36cosp=false
37cosp2=false
38cospv2=false
39job=1
40full=''
41libphy=false
42isotopes=false
43isoverif=false
44diagiso=false
45isotrac=false
46force_compile=false
47cplocninca=false
48
49arch_defined="FALSE"
50arch_path="arch"
51arch_default_path="arch"
52
53LMDGCM=`/bin/pwd`
54LIBOGCM=$LMDGCM/libo
55LIBFGCM=$LMDGCM/libf
56DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
57# path for optional packages, but default set to ".void_dir"
58FILTRE_PATH=$LMDGCM/.void_dir
59DYN_PHYS_PATH=$LMDGCM/.void_dir
60DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
61PHY_COMMON_PATH=$LMDGCM/.void_dir
62RAD_PATH=$LMDGCM/.void_dir
63INLANDSIS_PATH=$LMDGCM/.void_dir
64DUST_PATH=$LMDGCM/.void_dir
65STRATAER_PATH=$LMDGCM/.void_dir
66COSP_PATH=$LMDGCM/.void_dir
67fcm_path=$LMDGCM/tools/fcm/bin
68
69########################################################################
70#  Quelques initialisations de variables du shell.
71########################################################################
72
73CPP_KEY="IN_LMDZ" 
74INCLUDE=""
75LIB=""
76adjnt=""
77COMPIL_FFLAGS="%PROD_FFLAGS"
78PARA_FFLAGS=""
79PARA_LD=""
80EXT_SRC=""
81
82########################################################################
83# lecture des options de mymake
84########################################################################
85
86while (($# > 0))
87  do
88  case $1 in
89      "-h") cat <<fin
90Usage :
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
96[-c false/MPI1/OMCT]       : coupling with ocean model : MPI1/OMCT/false (default: false)
97[-v false/orchidee2.0/orchidee1.9/true] : version of the vegetation model to include (default: false)
98          false       : no vegetation model
99          orchidee2.1 : compile using ORCHIDEE 2.1 (or more recent version)
100          orchidee2.0 : compile using ORCHIDEE 2.0
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)
104[-cplocninca ]        : allow transfer of species from PISCES to INCA (default: false)
105[-cosp true/false]    : compile with/without cosp package (default: false)
106[-cosp2 true/false]    : compile with/without cosp2 package (default: false)
107[-cospv2 true/false]    : compile with/without cospv2 package (default: false)
108[-inlandsis true/false]  : compile with/without inlandsis package (default: false)
109[-rrtm true/false]    : compile with/without rrtm package (default: false)
110[-rad oldrad/rrtm/ecrad]    : compile with oldrad/rrtm/ecrad radiatif code (default: oldrad)
111[-dust true/false]    : compile with/without the dust package by Boucher and co (default: false)
112[-strataer true/false]    : compile with/without the strat aer package by Boucher and co (default: false)
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
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)
119[-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
120[-include INCLUDES]        : extra include path to add
121[-cpp CPP_KEY]             : additional preprocessing definitions
122[-adjnt]                   : adjoint model, not operational ...
123[-mem]                     : reduced memory dynamics (obsolete flag; always on in parallel mode)
124[-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
125[-link LINKS]              : additional links with other libraries
126[-j n]                     : active parallel compiling on ntask
127[-full]                    : full recompiling
128[-libphy]                  : only compile physics package (no dynamics or main program)
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
131[-arch_path path]          : path to architecture files (default: $arch_default_path)
132[-force_compile]           : recompile although there seems to be an on-going compilation
133 -arch nom_arch            : target architecture
134 exec                      : executable to build
135fin
136          exit;;
137
138      "-d")
139          dim=$2 ; shift ; shift ;;
140     
141      "-p")
142          physique="$2" ;  shift ; shift ;;
143
144      "-g")
145          grille="$2" ; shift ; shift ;;
146
147      "-c")
148          couple="$2" ; shift ; shift ;;
149
150      "-prod")
151          compil_mod="prod" ; shift ;;
152
153      "-dev")
154          compil_mod="dev" ; shift ;;
155
156      "-debug")
157          compil_mod="debug" ; shift ;;
158
159      "-io")
160          io="$2" ; shift ; shift ;;
161
162      "-v")
163          veget="$2" ; shift ; shift ;;
164
165      "-inlandsis")
166          inlandsis="$2" ; shift ; shift ;;
167
168      "-rrtm")
169          rrtm="$2" ; if [ "$2" = "false" ] ; then rad="oldrad" ; else rad="rrtm" ; fi ; shift ; shift ;;
170
171      "-rad")
172          rad="$2" ; shift ; shift ;;
173
174      "-dust")
175          dust="$2" ; shift ; shift ;;
176
177      "-strataer")
178          strataer="$2" ; shift ; shift ;;
179
180      "-chimie")
181          chimie="$2" ; shift ; shift ;;
182
183     "-cplocninca")
184          cplocninca=TRUE ; shift ;;
185
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
198      "-parallel")
199          parallel="$2" ; shift ; shift ;;
200     
201      "-include")
202          INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
203
204      "-cpp")
205          CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
206
207      "-adjnt")
208          echo "not operational ... work to be done here ";exit
209          opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d "
210          optim="$optim -Dadj" ; shift ;;
211
212      "-cosp")
213          cosp="$2" ; shift ; shift ;;
214
215      "-cosp2")
216          cosp2="$2" ; shift ; shift ;;
217
218      "-cospv2")
219          cospv2="$2" ; shift ; shift ;;
220     
221      "-mem")
222          echo "option -mem is obsolete (now always on in parallel)"
223          paramem="mem" ; shift ;;
224
225      "-filtre")
226          filtre=$2 ; shift ; shift ;;
227
228      "-link")
229          LIB="$LIB $2" ; shift ; shift ;;
230
231      "-fcm_path")
232          fcm_path=$2 ; shift ; shift ;;
233
234      "-ext_src")
235          EXT_SRC=$2 ; shift ; shift ;;
236
237      "-j")
238          job=$2 ; shift ; shift ;;
239
240      "-full")
241          full="-full" ; shift ;;
242
243      "-libphy")
244          libphy="true" ; shift ;;
245
246      "-arch")
247          arch=$2 ; arch_defined="TRUE" ; shift ; shift ;;
248
249      "-arch_path")
250          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
251
252      "-force_compile")
253          force_compile=true ; shift ;;
254
255      *)
256          code="$1" ; shift ;;
257  esac
258done
259
260###############################################################
261# path to fcm
262###############################################################
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
269
270# add fcm_path to PATH
271export PATH=${fcm_path}:${PATH}
272
273echo "Path to fcm:"
274echo ${fcm_path}
275
276###############################################################
277# lecture des chemins propres \`a l'architecture de la machine #
278###############################################################
279rm -f .void_file
280echo > .void_file
281rm -rf .void_dir
282mkdir .void_dir
283
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
323########################################################################
324# Definition des clefs CPP, des chemins des includes et modules
325#  et des libraries
326########################################################################
327
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
338
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
347if [[ "$physique" != "nophys" ]]
348then
349   #We'll use some physics
350   CPP_KEY="$CPP_KEY CPP_PHYS"
351   if [[ "${phys_root}" == "lmd" ]]
352   then
353   #For lmd physics, default planet type is Earth
354   CPP_KEY="$CPP_KEY CPP_EARTH"
355   fi
356   # set physics common utilities path
357   PHY_COMMON_PATH="${LIBFGCM}/phy_common"
358   # set the dyn/phys interface path
359   DYN_PHYS_PATH="${LIBFGCM}/dynphy_lonlat"
360   DYN_PHYS_SUB_PATH="${LIBFGCM}/dynphy_lonlat/phy${phys_root}"
361fi
362
363if [[ "$filtre" == "filtrez" ]]
364then
365   FILTRE_PATH=${LIBFGCM}/$filtre
366fi
367
368if [[ "$chimie" == "INCA" ]]
369then
370   CPP_KEY="$CPP_KEY INCA"
371   INCLUDE="$INCLUDE -I${INCA_INCDIR}"
372   LIB="$LIB -L${INCA_LIBDIR} -lchimie"
373fi
374
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
395if [[ "$couple" != "false" ]]
396then
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
409fi
410
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
427
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
434
435if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" -o "$veget" = "orchidee2.1" ]
436then
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
440   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
441   CPP_KEY="$CPP_KEY CPP_VEGET"
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
447      orch_libs="sechiba parameters stomate parallel orglob orchidee"
448      CPP_KEY="$CPP_KEY ORCHIDEE_NOUNSTRUCT"
449   elif [[ "$veget" == "orchidee2.1" ]] ; then
450      orch_libs="sechiba parameters stomate parallel orglob orchidee"
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
461   echo "Option -v $veget does not exist"
462   echo "Use ./makelmdz_fcm -h for more information"
463   exit 
464fi
465
466if [[ "$inlandsis" == "true" ]]
467then
468   CPP_KEY="$CPP_KEY CPP_INLANDSIS"
469   INLANDSIS_PATH="$LIBFGCM/%PHYS/inlandsis"
470fi
471
472
473if [[ "$rad" == "rrtm" ]]
474then
475   CPP_KEY="$CPP_KEY CPP_RRTM"
476   RAD_PATH="$LIBFGCM/%PHYS/rrtm"
477fi
478if [[ "$rad" == "ecrad" ]]
479then
480   CPP_KEY="$CPP_KEY CPP_ECRAD"
481   RAD_PATH="$LIBFGCM/%PHYS/ecrad"
482fi
483
484if [[ "$dust" == "true" ]]
485then
486   CPP_KEY="$CPP_KEY CPP_Dust"
487   DUST_PATH="$LIBFGCM/%PHYS/Dust"
488fi
489
490if [[ "$strataer" == "true" ]]
491then
492   CPP_KEY="$CPP_KEY CPP_StratAer"
493   STRATAER_PATH="$LIBFGCM/%PHYS/StratAer"
494fi
495
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"
501elif [[ $io == mix ]]
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}"
506   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
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}"
512   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
513fi
514
515if [[ "$cosp" == "true" ]]
516then
517   CPP_KEY="$CPP_KEY CPP_COSP"
518   COSP_PATH="$LIBFGCM/phylmd/cosp"
519#   LIB="${LIB} -l${LIBPREFIX}cosp"
520fi
521
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
529if [[ "$cospv2" == "true" ]]
530then
531   CPP_KEY="$CPP_KEY CPP_COSPV2"
532   COSP_PATH="$LIBFGCM/phylmd/cospv2"
533#   LIB="${LIB} -l${LIBPREFIX}cosp2"
534fi
535
536if [[ "$cplocninca" == "TRUE" ]]
537then
538    CPP_KEY="${CPP_KEY} CPP_CPLOCNINCA"
539fi
540
541
542INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
543LIB="$LIB ${NETCDF_LIBDIR}"
544
545########################################################################
546# calcul du nombre de dimensions
547########################################################################
548
549
550dim_full=$dim
551dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
552set $dim
553dimc=$#
554echo calcul de la dimension
555echo dim $dim
556echo dimc $dimc
557
558
559########################################################################
560# Gestion des dimensions du modele.
561# on cree ou remplace le fichier des dimensions
562########################################################################
563
564cd $LIBFGCM/grid
565if [[ -f dimensions.h ]]
566then
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
577fi
578
579
580cd $LIBFGCM/grid/dimension
581./makdim $dim
582cat $LIBFGCM/grid/dimensions.h
583cd $LMDGCM
584
585
586########################################################################
587# Differentes dynamiques (3d, 2d, 1d)
588########################################################################
589
590dimension=`echo $dim | wc -w`
591echo dimension $dimension
592
593if (( $dimension == 3 ))
594then
595  cd $LIBFGCM/grid
596  \rm fxyprim.h
597  cp -p fxy_${grille}.h fxyprim.h
598#else
599#  echo "Probleme dans les dimensions de la dynamique !!"
600#  echo "Non reactive pour l'instant !!!"
601fi
602
603if (( $dimension == 1 ))
604then
605  CPP_KEY="$CPP_KEY CPP_1D"
606##in 1D, add dyn3d to include path (because main prog is in physics)
607  INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common"
608## no filtre in 1d:
609  FILTRE_PATH=$LMDGCM/.void_dir
610## no need to compile all routines in dyn3d_common either:
611  DYN_COMMON_PATH=$LMDGCM/.void_dir
612## no need to compile all routines in dynlmdz_phy... ;
613## (because key ones are included in 1D main program)
614  DYN_PHYS_PATH=$LMDGCM/.void_dir
615  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
616fi
617
618######################################################################
619#   Traitement special pour le nouveau rayonnement de Laurent Li.
620#   ---> YM desactive pour le traitemement en parallele
621######################################################################
622
623#if [[ -f $libf/phy$physique/raddim.h ]]
624#then
625# if [[ -f $libf/phy$physique/raddim.$dimh.h ]]
626#then
627#  \rm -f $libf/phy$physique/raddim.h
628#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
629#  echo $libf/phy$physique/raddim.$dimh.h
630#  cat $libf/phy$physique/raddim.h
631# else
632#  echo On peut diminuer la taille de l executable en creant
633#  echo le fichier $libf/phy$physique/raddim.$dimh.h
634#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
635# fi
636#fi
637
638######################################################################
639# Gestion du filtre qui n'existe qu'en 3d.
640######################################################################
641
642if (( `expr $dimc \> 2` == 1 ))
643then
644   filtre="FILTRE=$filtre"
645else
646   filtre="FILTRE= L_FILTRE= "
647fi
648echo MACRO FILTRE $filtre
649
650echo $dimc
651
652
653
654######################################################################
655# Creation du suffixe de la configuration
656######################################################################
657
658
659SUFF_NAME=_${dim_full}
660SUFF_NAME=${SUFF_NAME}_phy${physique}_${rad}
661
662if [[ "$parallel" != "none" ]]
663then
664  SUFF_NAME=${SUFF_NAME}_para
665  DYN=dyn${dimc}d${paramem}
666  if [[ "$paramem" == "mem" ]]
667  then
668      SUFF_NAME=${SUFF_NAME}_${paramem}
669  else
670      echo "The version of the dynamics in dyn3dpar is no longer updated."
671      echo "You should use option \"-mem\"."
672      exit 1
673  fi
674else
675  SUFF_NAME=${SUFF_NAME}_seq
676  if (( $dimension == 1 ))
677  then
678    # dynamics-related routines in"dyn1d" subdirectory of phy${physique}
679    DYN=phy${physique}/dyn1d
680  else
681    DYN=dyn${dimc}d
682  fi
683fi
684
685if [[ $veget != "false" ]]
686then
687  SUFF_NAME=${SUFF_NAME}_orch
688fi
689
690if [[ $dust == "true" ]]
691then
692  SUFF_NAME=${SUFF_NAME}_spla
693fi
694
695if [[ $couple != "false" ]]
696then
697  SUFF_NAME=${SUFF_NAME}_couple
698fi
699
700if [[ $chimie == "INCA" ]]
701then
702  SUFF_NAME=${SUFF_NAME}_inca
703fi
704
705if [[ "$isotopes" == "true" ]]
706then
707  SUFF_NAME=${SUFF_NAME}_iso
708fi
709if [[ "$isoverif" == "true" ]]
710then
711  SUFF_NAME=${SUFF_NAME}_isoverif
712fi
713if [[ "$isotrac" == "true" ]]
714then
715  SUFF_NAME=${SUFF_NAME}_isotrac
716fi
717if [[ "$diagiso" == "true" ]]
718then
719  SUFF_NAME=${SUFF_NAME}_diagiso
720fi
721
722if [[ $libphy == "true" ]]
723then
724  # special case where we compile only the physics
725  DYN=$LMDGCM/.void_dir
726  DYN_COMMON_PATH=$LMDGCM/.void_dir
727  FILTRE_PATH=$LMDGCM/.void_dir
728  DYN_PHYS_PATH=$LMDGCM/.void_dir
729  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
730  #and there is no main program to generate
731  code=""
732  SUFF_NAME=""
733else
734  SUFF_NAME=${SUFF_NAME}.e
735fi
736
737cd $LMDGCM
738config_fcm="config.fcm"
739rm -f $config_fcm
740touch $config_fcm
741rm -f bin/${code}${SUFF_NAME}.e
742rm -f arch.fcm
743rm -f arch.opt
744
745echo "%ARCH          $arch"          >> $config_fcm
746echo "%INCDIR        $INCLUDE"       >> $config_fcm 
747echo "%LIB           $LIB"           >> $config_fcm
748echo "%ROOT_PATH     $PWD"           >> $config_fcm
749echo "%LIBF          $LIBFGCM"       >> $config_fcm
750echo "%LIBO          $LIBOGCM"       >> $config_fcm
751echo "%DYN           $DYN"           >> $config_fcm
752echo "%DYN_COMMON    $DYN_COMMON_PATH" >> $config_fcm
753echo "%PHY_COMMON    $PHY_COMMON_PATH" >> $config_fcm
754echo "%FILTRE        $FILTRE_PATH"   >> $config_fcm
755echo "%PHYS          phy${physique}" >> $config_fcm
756echo "%DYN_PHYS      $DYN_PHYS_PATH" >> $config_fcm
757echo "%DYN_PHYS_SUB  $DYN_PHYS_SUB_PATH" >> $config_fcm
758echo "%RAD           $RAD_PATH"     >> $config_fcm
759echo "%DUST          $DUST_PATH"     >> $config_fcm
760echo "%STRATAER      $STRATAER_PATH" >> $config_fcm
761echo "%INLANDSIS     $INLANDSIS_PATH" >> $config_fcm
762echo "%COSP          $COSP_PATH"     >> $config_fcm
763echo "%CPP_KEY       $CPP_KEY"       >> $config_fcm
764echo "%EXEC          $code"          >> $config_fcm
765echo "%SUFF_NAME     $SUFF_NAME"     >> $config_fcm
766echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm
767echo "%PARA_FFLAGS   $PARA_FFLAGS"   >> $config_fcm
768echo "%PARA_LD       $PARA_LD"       >> $config_fcm
769echo "%EXT_SRC       $EXT_SRC"       >> $config_fcm
770
771
772
773ln -s arch/arch-${arch}.fcm arch.fcm
774if test -f arch/arch-${arch}.opt &&  [ $compil_mod = "prod" ]
775  then
776  ln -s arch/arch-${arch}.opt arch.opt
777else
778  ln -s .void_file arch.opt
779fi
780
781set +e
782
783rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
784./build_gcm ${fcm_path} -j $job $full
785build_status=$?
786
787err=$?
788# Check error message from fcm build
789if [ $err != 0 ] ; then
790  exit 1
791fi
792
793rm -rf tmp_src
794rm -rf config
795ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config
796ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src
797
798
799if [[ -r $LIBFGCM/grid/dimensions.h ]]
800then
801  # Cleanup: remove dimension.h file
802  \rm -f $LIBFGCM/grid/dimensions.h
803fi
804
805exit $build_status
Note: See TracBrowser for help on using the repository browser.