source: LMDZ6/trunk/makelmdz_fcm @ 4292

Last change on this file since 4292 was 4283, checked in by jghattas, 2 years ago

Added landice_opt=2 : Treat continental land ice fractions in ORCHIDEE => pctsrf(:,is_lic) = 0.0 in LMDZ.

For this option, some more variables are needed from ORCHIDEE. Therfor change in the interface LMDZ-ORCHIDEE in surf_land_orchidee_mod is done. Previous interface is moved to surf_land_orchidee_nolic_mod.f90. To compile with previous interface, cpp key ORCHIDEE_NOLIC is added. Previous interface is compiled with argument orchidee2.1 in makelmdz and makelmdz_fcm.

At the same time, when the interface was changed, the variable yrmu0(coszang) was added in the call to intersurf_initialize_gathered. This is needed in ORCHIDEE to better initialize the model.

Modifications done by Etienne Vignon and Josefine Ghattas

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