source: LMDZ6/trunk/makelmdz_fcm @ 3908

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

Online implementation of the radiative transfer code ECRAD in the LMDZ model.

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