source: LMDZ6/trunk/makelmdz_fcm @ 3901

Last change on this file since 3901 was 3901, checked in by evignon, 3 years ago

Commission LMDZ-sisvat, deuxieme phase:

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