source: LMDZ6/trunk/makelmdz_fcm @ 3911

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

Correction: removal of the compilation option "ecrad=true/false" (option to use: "-rad ecrad")

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