source: LMDZ6/branches/Amaury_posttrusting/makelmdz_fcm @ 5358

Last change on this file since 5358 was 5313, checked in by Laurent Fairhead, 6 weeks ago

EM justly pointed out that ce0l is compiled with makelmdz_gcm also

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