source: LMDZ6/branches/Ocean_skin/makelmdz_fcm @ 3605

Last change on this file since 3605 was 3605, checked in by lguez, 4 years ago

Merge revisions 3427:3600 of trunk into branch Ocean_skin

  • 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.5 KB
Line 
1#!/bin/bash
2# $Id: makelmdz_fcm 3605 2019-11-21 15:43:45Z lguez $
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
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=$WORK/build/LMDZ_ocean_skin
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
56DUST_PATH=$LMDGCM/.void_dir
57STRATAER_PATH=$LMDGCM/.void_dir
58SISVAT_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[-sisvat true/false]  : compile with/without sisvat 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      "-sisvat")
152          sisvat="$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 [[ "$sisvat" == "true" ]]
412then
413   CPP_KEY="$CPP_KEY CPP_SISVAT"
414   SISVAT_PATH="$LIBFGCM/%PHYS/sisvat"
415fi
416
417if [[ "$rrtm" == "true" ]]
418then
419   CPP_KEY="$CPP_KEY CPP_RRTM"
420   RRTM_PATH="$LIBFGCM/%PHYS/rrtm"
421fi
422
423if [[ "$dust" == "true" ]]
424then
425   CPP_KEY="$CPP_KEY CPP_Dust"
426   DUST_PATH="$LIBFGCM/%PHYS/Dust"
427fi
428
429if [[ "$strataer" == "true" ]]
430then
431   CPP_KEY="$CPP_KEY CPP_StratAer"
432   STRATAER_PATH="$LIBFGCM/%PHYS/StratAer"
433fi
434
435if [[ $io == ioipsl ]]
436then
437   CPP_KEY="$CPP_KEY CPP_IOIPSL"
438   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}"
439   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl"
440elif [[ $io == mix ]]
441then
442   # For now, xios implies also using ioipsl
443   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
444   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
445   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
446elif [[ $io == xios ]]
447then
448   # For now, xios implies also using ioipsl
449   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
450   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
451   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
452fi
453
454if [[ "$cosp" == "true" ]]
455then
456   CPP_KEY="$CPP_KEY CPP_COSP"
457   COSP_PATH="$LIBFGCM/phylmd/cosp"
458#   LIB="${LIB} -l${LIBPREFIX}cosp"
459fi
460
461if [[ "$cosp2" == "true" ]]
462then
463   CPP_KEY="$CPP_KEY CPP_COSP2"
464   COSP_PATH="$LIBFGCM/phylmd/cosp2"
465#   LIB="${LIB} -l${LIBPREFIX}cosp2"
466fi
467
468if [[ "$cospv2" == "true" ]]
469then
470   CPP_KEY="$CPP_KEY CPP_COSPV2"
471   COSP_PATH="$LIBFGCM/phylmd/cospv2"
472#   LIB="${LIB} -l${LIBPREFIX}cosp2"
473fi
474
475
476
477INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
478LIB="$LIB ${NETCDF_LIBDIR}"
479
480########################################################################
481# calcul du nombre de dimensions
482########################################################################
483
484
485dim_full=$dim
486dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
487set $dim
488dimc=$#
489echo calcul de la dimension
490echo dim $dim
491echo dimc $dimc
492
493
494########################################################################
495# Gestion des dimensions du modele.
496# on cree ou remplace le fichier des dimensions
497########################################################################
498
499cd $LIBFGCM/grid
500if [[ -f dimensions.h ]]
501then
502  echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
503  echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
504  echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
505  echo  vous pouvez continuer en repondant oui.
506  echo "Voulez-vous vraiment continuer?"
507  echo ""
508  echo "WARNING: you are probably already compiling the model somewhere else."
509  echo "Wait until the first compilation is finished before launching this one."
510  echo "If you are sure that you are not compiling elsewhere, just answer "
511  echo "yes (or 'oui') to the question below to proceed."
512  echo "Do you wish to continue?"
513  read reponse
514  if [[ $reponse == "oui" || $reponse == "yes" ]]
515  then
516    \rm -f $LIBFGCM/grid/dimensions.h
517  else
518    exit
519  fi
520fi
521
522
523cd $LIBFGCM/grid/dimension
524./makdim $dim
525cat $LIBFGCM/grid/dimensions.h
526cd $LMDGCM
527
528
529########################################################################
530# Differentes dynamiques (3d, 2d, 1d)
531########################################################################
532
533dimension=`echo $dim | wc -w`
534echo dimension $dimension
535
536if (( $dimension == 3 ))
537then
538  cd $LIBFGCM/grid
539  \rm fxyprim.h
540  cp -p fxy_${grille}.h fxyprim.h
541#else
542#  echo "Probleme dans les dimensions de la dynamique !!"
543#  echo "Non reactive pour l'instant !!!"
544fi
545
546if (( $dimension == 1 ))
547then
548  CPP_KEY="$CPP_KEY CPP_1D"
549##in 1D, add dyn3d to include path (because main prog is in physics)
550  INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common"
551## no filtre in 1d:
552  FILTRE_PATH=$LMDGCM/.void_dir
553## no need to compile all routines in dyn3d_common either:
554  DYN_COMMON_PATH=$LMDGCM/.void_dir
555## no need to compile all routines in dynlmdz_phy... ;
556## (because key ones are included in 1D main program)
557  DYN_PHYS_PATH=$LMDGCM/.void_dir
558  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
559fi
560
561######################################################################
562#   Traitement special pour le nouveau rayonnement de Laurent Li.
563#   ---> YM desactive pour le traitemement en parallele
564######################################################################
565
566#if [[ -f $libf/phy$physique/raddim.h ]]
567#then
568# if [[ -f $libf/phy$physique/raddim.$dimh.h ]]
569#then
570#  \rm -f $libf/phy$physique/raddim.h
571#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
572#  echo $libf/phy$physique/raddim.$dimh.h
573#  cat $libf/phy$physique/raddim.h
574# else
575#  echo On peut diminuer la taille de l executable en creant
576#  echo le fichier $libf/phy$physique/raddim.$dimh.h
577#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
578# fi
579#fi
580
581######################################################################
582# Gestion du filtre qui n'existe qu'en 3d.
583######################################################################
584
585if (( `expr $dimc \> 2` == 1 ))
586then
587   filtre="FILTRE=$filtre"
588else
589   filtre="FILTRE= L_FILTRE= "
590fi
591echo MACRO FILTRE $filtre
592
593echo $dimc
594
595
596
597######################################################################
598# Creation du suffixe de la configuration
599######################################################################
600
601
602SUFF_NAME=_${dim_full}
603SUFF_NAME=${SUFF_NAME}_phy${physique}
604
605if [[ "$parallel" != "none" ]]
606then
607  SUFF_NAME=${SUFF_NAME}_para
608  DYN=dyn${dimc}d${paramem}
609  if [[ "$paramem" == "mem" ]]
610  then
611      SUFF_NAME=${SUFF_NAME}_${paramem}
612  else
613      echo "The version of the dynamics in dyn3dpar is no longer updated."
614      echo "You should use option \"-mem\"."
615      exit 1
616  fi
617else
618  SUFF_NAME=${SUFF_NAME}_seq
619  if (( $dimension == 1 ))
620  then
621    # dynamics-related routines in"dyn1d" subdirectory of phy${physique}
622    DYN=phy${physique}/dyn1d
623  else
624    DYN=dyn${dimc}d
625  fi
626fi
627
628if [[ $veget != "false" ]]
629then
630  SUFF_NAME=${SUFF_NAME}_orch
631fi
632
633if [[ $couple != "false" ]]
634then
635  SUFF_NAME=${SUFF_NAME}_couple
636fi
637
638if [[ $chimie == "INCA" ]]
639then
640  SUFF_NAME=${SUFF_NAME}_inca
641fi
642
643if [[ $libphy == "true" ]]
644then
645  # special case where we compile only the physics
646  DYN=$LMDGCM/.void_dir
647  DYN_COMMON_PATH=$LMDGCM/.void_dir
648  FILTRE_PATH=$LMDGCM/.void_dir
649  DYN_PHYS_PATH=$LMDGCM/.void_dir
650  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
651  #and there is no main program to generate
652  code=""
653  SUFF_NAME=""
654else
655  SUFF_NAME=${SUFF_NAME}.e
656fi
657
658cd $LMDGCM
659config_fcm="config.fcm"
660rm -f $config_fcm
661touch $config_fcm
662rm -f bin/${code}${SUFF_NAME}.e
663rm -f arch.fcm
664rm -f arch.opt
665
666echo "%ARCH          $arch"          >> $config_fcm
667echo "%INCDIR        $INCLUDE"       >> $config_fcm 
668echo "%LIB           $LIB"           >> $config_fcm
669echo "%ROOT_PATH     $PWD"           >> $config_fcm
670echo "%LIBF          $LIBFGCM"       >> $config_fcm
671echo "%LIBO          $LIBOGCM"       >> $config_fcm
672echo "%DYN           $DYN"           >> $config_fcm
673echo "%DYN_COMMON    $DYN_COMMON_PATH" >> $config_fcm
674echo "%PHY_COMMON    $PHY_COMMON_PATH" >> $config_fcm
675echo "%FILTRE        $FILTRE_PATH"   >> $config_fcm
676echo "%PHYS          phy${physique}" >> $config_fcm
677echo "%DYN_PHYS      $DYN_PHYS_PATH" >> $config_fcm
678echo "%DYN_PHYS_SUB  $DYN_PHYS_SUB_PATH" >> $config_fcm
679echo "%RRTM          $RRTM_PATH"     >> $config_fcm
680echo "%DUST          $DUST_PATH"     >> $config_fcm
681echo "%STRATAER      $STRATAER_PATH" >> $config_fcm
682echo "%SISVAT        $SISVAT_PATH"   >> $config_fcm
683echo "%COSP          $COSP_PATH"     >> $config_fcm
684echo "%CPP_KEY       $CPP_KEY"       >> $config_fcm
685echo "%EXEC          $code"          >> $config_fcm
686echo "%SUFF_NAME     $SUFF_NAME"     >> $config_fcm
687echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm
688echo "%PARA_FFLAGS   $PARA_FFLAGS"   >> $config_fcm
689echo "%PARA_LD       $PARA_LD"       >> $config_fcm
690echo "%EXT_SRC       $EXT_SRC"       >> $config_fcm
691
692
693
694ln -s arch/arch-${arch}.fcm arch.fcm
695if test -f arch/arch-${arch}.opt &&  [ $compil_mod = "prod" ]
696  then
697  ln -s arch/arch-${arch}.opt arch.opt
698else
699  ln -s .void_file arch.opt
700fi
701
702rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
703./build_gcm ${fcm_path} -j $job $full
704
705rm -rf tmp_src
706rm -rf config
707ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config
708ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src
709
710
711if [[ -r $LIBFGCM/grid/dimensions.h ]]
712then
713  # Cleanup: remove dimension.h file
714  \rm -f $LIBFGCM/grid/dimensions.h
715fi
Note: See TracBrowser for help on using the repository browser.