source: LMDZ6/trunk/makelmdz_fcm @ 5935

Last change on this file since 5935 was 5925, checked in by evignon, 2 months ago

petite modif de makelmdz_fcm pour compiler le 1D avec orchidee

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