source: LMDZ6/branches/compilation_2/makelmdz_fcm @ 5738

Last change on this file since 5738 was 5738, checked in by lguez, 5 months ago

Allow CONFIG_NAME to be defined on command line

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