source: LMDZ6/branches/LMDZ-ECRAD/makelmdz_fcm @ 4092

Last change on this file since 4092 was 3880, checked in by idelkadi, 3 years ago

Online implementation of the radiative transfer code ECRAD in LMDZ.

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