source: trunk/LMDZ.COMMON/makelmdz_fcm @ 1650

Last change on this file since 1650 was 1650, checked in by emillour, 8 years ago

Dynamical core: Further adaptations to stick with LMDZ5 (up to rev r2750)

  • libf
  • makelmdz[_fcm] : added Earth-specific "dust" and "strataer" cases and

-arch_path option

  • bld.cfg : added dust and strataer cases
  • dyn3d[par]
  • conf_gcm.F90 : added read_orop parameter (Earth-related) for

loading subgrid orography parameters.

  • guide[_p]_mod.F90: added output of nudging coefficients for winds

and temperature

  • temps_mod.F90 : cosmetics/comments
  • logic_mod.F90 : cosmetics/comments
  • dyn3d_common
  • comconst_mod.F90 : cosmetics/comments + added year_day module variable
  • conf_planete.F90 : added year_day from comconst_mod as done in LMDZ5
  • comvert_mod.F90 : cosmetics/comments
  • infotrac.F90 : added "startAer" case to follow up with LMDZ5
  • misc
  • wxios.F90 : follow up on changes in LMDZ5

EM

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