source: trunk/LMDZ.COMMON/makelmdz_fcm @ 1980

Last change on this file since 1980 was 1860, checked in by mturbet, 7 years ago

update LMD arch path file

File size: 22.2 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
61CLOUD_PATH=$LMDGCM/.void_dir
62MUPHY_PATH=$LMDGCM/.void_dir
63AERONO_PATH=$LMDGCM/.void_dir
64# Path to fcm utility:
65##fcm_path=$LMDGCM/tools/fcm/bin
66##fcm_path=/planeto/mturbet/planeto2-mturbet/FCM_V1.2/bin
67fcm_path=$(dirname $(which fcm))
68
69########################################################################
70#  Quelques initialisations de variables du shell.
71########################################################################
72
73CPP_KEY="" 
74INCLUDE=""
75LIB=""
76adjnt=""
77COMPIL_FFLAGS="%PROD_FFLAGS"
78PARA_FFLAGS=""
79PARA_LD=""
80EXT_SRC=""
81
82########################################################################
83# lecture des options de mymake
84########################################################################
85
86while (($# > 0))
87  do
88  case $1 in
89      "-h") cat <<fin
90Usage :
91makegcm [options] -arch arch exec
92[-h]                       : brief help
93[-d [[IMx]JMx]LM]          : IM, JM, LM are the dimensions in x, y, z (default: $dim)
94[-s nscat]                 : (Generic) Number of radiatively active scatterers
95[-b IRxVIS]                : (Generic) Number of infrared (IR) and visible (VIS) bands for radiative transfer
96[-p PHYS]                  : set of physical parametrizations (in libf/phyPHYS), (default: lmd)
97[-prod / -dev / -debug]    : compilation mode production (default) / developement / debug .
98[-c false/MPI1/OMCT]       : (Earth) coupling with ocean model : MPI1/OMCT/false (default: false)
99[-v false/orchidee2.0/orchidee1.9/true] : (Earth) version of the vegetation model to include (default: false)
100          false       : no vegetation model
101          orchidee2.0 : compile using ORCHIDEE 2.0 (or more recent version)
102          orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
103          true        : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6
104[-chimie INCA/false]       : (Earth) with INCA chemistry model or without (default: false)
105[-cosp cosp/false]         : (Earth) add the cosp model (default: false)
106[-sisvat true/false]  : (Earth) compile with/without sisvat package (default: false)
107[-rrtm true/false]    : (Earth) compile with/without rrtm package (default: false)
108[-dust true/false]    : (Earth) compile with/without the dust package by Boucher and co (default: false)
109[-strataer true/false]    : (Earth) compile with/without the strat aer package by Boucher and co (default: false)
110[-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
111[-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
112[-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
113[-include INCLUDES]        : extra include path to add
114[-cpp CPP_KEY]             : additional preprocessing definitions
115[-adjnt]                   : adjoint model, not operational ...
116[-mem]                     : reduced memory dynamics (if in parallel mode)
117[-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
118[-link LINKS]              : additional links with other libraries
119[-j n]                     : active parallel compiling on ntask
120[-full]                    : full (re-)compilation (from scratch)
121[-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
122[-ext_src path]            : path to an additional set of routines to compile with the model
123[-arch_path path]          : path to architecture files (default: $arch_default_path)
124 -arch arch                : target architecture
125 exec                      : executable to build
126fin
127          exit;;
128
129      "-d")
130          dim=$2 ; shift ; shift ;;
131     
132      "-p")
133          physique="$2" ;  shift ; shift ;;
134
135      "-s")
136          scatterers=$2 ; shift ; shift ;;
137
138      "-b")
139          bands=$2 ; shift ; shift ;;
140
141      "-g")
142          grille="$2" ; shift ; shift ;;
143
144      "-c")
145          couple="$2" ; shift ; shift ;;
146
147      "-prod")
148          compil_mod="prod" ; shift ;;
149
150      "-dev")
151          compil_mod="dev" ; shift ;;
152
153      "-debug")
154          compil_mod="debug" ; shift ;;
155
156      "-io")
157          io="$2" ; shift ; shift ;;
158
159      "-v")
160          veget="$2" ; shift ; shift ;;
161
162      "-sisvat")
163          sisvat="$2" ; shift ; shift ;;
164
165      "-rrtm")
166          rrtm="$2" ; shift ; shift ;;
167
168      "-dust")
169          dust="$2" ; shift ; shift ;;
170
171      "-strataer")
172          strataer="$2" ; shift ; shift ;;
173
174      "-chimie")
175          chimie="$2" ; shift ; shift ;;
176
177      "-parallel")
178          parallel="$2" ; shift ; shift ;;
179     
180      "-include")
181          INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
182
183      "-cpp")
184          CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
185
186      "-adjnt")
187          echo "not operational ... work to be done here ";exit
188          opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d "
189          optim="$optim -Dadj" ; shift ;;
190
191      "-cosp")
192          cosp="$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 à 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:3}" == "mar" ]] ; then phys_root=mar ; fi
311if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
312if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
313if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
314if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; 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} ${INCA_LIB}"
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} ${OASIS_LIB}"
354    else
355        CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT"
356        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
357        LIB="$LIB -L${OASIS_LIBDIR} ${OASIS_LIB}"
358    fi
359fi
360
361if [[ "$parallel" != "none" && \
362     ( "$code" == "newstart" || "$code" == "start2archive" ) ]]
363then
364    echo "newstart or start2archive utilities should be run in serial!"
365    echo " Compile without -parallel [mpi|omp|mpi_omp] option!"
366    exit
367fi
368
369if [[ "$parallel" == "mpi" ]]
370then
371   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
372   PARA_FFLAGS="%MPI_FFLAGS"
373   PARA_LD="%MPI_LD"
374elif [[ "$parallel" == "omp" ]]
375then
376   CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
377   PARA_FFLAGS="%OMP_FFLAGS"
378   PARA_LD="%OMP_LD"
379elif [[ "$parallel" == "mpi_omp" ]]
380then
381   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
382   PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
383   PARA_LD="%MPI_LD %OMP_LD"
384fi
385
386if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \
387   && "$compil_mod" == "debug" ]]
388then
389    echo "Usually, parallelization with OpenMP requires some optimization."
390    echo "We suggest switching to \"-dev\"."
391fi
392
393if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ]
394then
395#NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
396#    For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
397#    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
398   INCLUDE="${INCLUDE} ${ORCHIDEE_INCDIR}"
399   CPP_KEY="$CPP_KEY CPP_VEGET"
400# temporary, for Orchidee versions 1.9.* (before openmp activation)
401   if [[ "$veget" == "orchidee1.9" ]] ; then
402      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
403   fi
404   if [[ "$veget" == "orchidee2.0" ]] ; then
405      orch_libs="sechiba parameters stomate parallel orglob orchidee"
406   else
407      orch_libs="sechiba parameters stomate parallel orglob"
408   fi
409   LIB="${LIB} -L${ORCHIDEE_LIBDIR} ${ORCHIDEE_LIB}"
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 [[ "$sisvat" == "true" ]]
417then
418   CPP_KEY="$CPP_KEY CPP_SISVAT"
419   SISVAT_PATH="$LIBFGCM/%PHYS/sisvat"
420fi
421
422if [[ "$rrtm" == "true" ]]
423then
424   CPP_KEY="$CPP_KEY CPP_RRTM"
425   RRTM_PATH="$LIBFGCM/%PHYS/rrtm"
426fi
427
428if [[ "$dust" == "true" ]]
429then
430   CPP_KEY="$CPP_KEY CPP_Dust"
431   DUST_PATH="$LIBFGCM/%PHYS/Dust"
432fi
433
434if [[ "$strataer" == "true" ]]
435then
436   CPP_KEY="$CPP_KEY CPP_StratAer"
437   STRATAER_PATH="$LIBFGCM/%PHYS/StratAer"
438fi
439
440if [[ $io == ioipsl ]]
441then
442   CPP_KEY="$CPP_KEY CPP_IOIPSL"
443   INCLUDE="$INCLUDE ${IOIPSL_INCDIR}"
444   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB}"
445elif [[ $io == mix ]]
446then
447   # For now, xios implies also using ioipsl
448   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
449   INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
450   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
451elif [[ $io == xios ]]
452then
453   # For now, xios implies also using ioipsl
454   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
455   INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
456   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
457fi
458
459if [[ "$cosp" == "true" ]]
460then
461   CPP_KEY="$CPP_KEY CPP_COSP"
462   COSP_PATH="$LIBFGCM/cosp"
463#   LIB="${LIB} -l${LIBPREFIX}cosp"
464fi
465
466# for Titan (but could be used by others as well), there is also "chimtitan"
467if [[ -d ${LIBFGCM}/chim${physique} ]]
468then
469   CHEM_PATH="${LIBFGCM}/chim${physique}"
470   INCLUDE="$INCLUDE -I${LIBFGCM}/chim${physique}"
471fi
472
473# for Titan add microphysics dependencies
474if [[ -d ${LIBFGCM}/muphy${physique} ]] ; then
475
476  # add muphy{physique} to the list of files to compile.
477  MUPHY_PATH="${LIBFGCM}/muphy${physique}"
478  # For Titan as we embbed some libraries with CPP keys, we define them:
479  #   -DPREC={32|64|80} real kind precision (32: simple, 64: double, 80: extended double)
480  #   -DHAVE_NC_FTN=1 (mandatory: for support of NetCDF in lintnd).
481  CPP_KEY="$CPP_KEY PREC=64 HAVE_NC_FTN=1"
482  if [[ "${physique}" == "titan" ]] ; then
483    echo "Yaahh you're about to use YAMMS in a GCM..."
484  fi
485fi
486
487# for Venus (but could be used by others as well), there is also "phyvenus/cloudvenus"
488if [[ -d ${LIBFGCM}/phy${physique}/cloud${physique} ]]
489then
490   CLOUD_PATH="${LIBFGCM}/phy${physique}/cloud${physique}"
491   INCLUDE="$INCLUDE -I${LIBFGCM}/phy${physique}/cloud${physique}"
492fi
493
494# for Mars (but could be used by others as well), there is also "aeronomars"
495if [[ -d ${LIBFGCM}/aerono${physique} ]]
496then
497   AERONO_PATH="${LIBFGCM}/aerono${physique}"
498   INCLUDE="$INCLUDE -I${LIBFGCM}/aerono${physique}"
499fi
500
501# NETCDF library include/library paths
502INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
503LIB="$LIB ${NETCDF_LIBDIR} ${NETCDF_LIB}"
504
505########################################################################
506# calcul du nombre de dimensions
507########################################################################
508
509
510dim_full=$dim
511dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
512set $dim
513dimc=$#
514echo calcul de la dimension
515echo dim $dim
516echo dimc $dimc
517
518
519########################################################################
520# Gestion des dimensions du modele.
521# on cree ou remplace le fichier des dimensions
522########################################################################
523
524cd $LIBFGCM/grid
525if [[ -f dimensions.h ]]
526then
527  echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
528  echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
529  echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
530  echo  vous pouvez continuer en repondant oui.
531  echo "Voulez-vous vraiment continuer?"
532  echo ""
533  echo "WARNING: you are probably already compiling the model somewhere else."
534  echo "Wait until the first compilation is finished before launching this one."
535  echo "If you are sure that you are not compiling elsewhere, just answer "
536  echo "yes (or 'oui') to the question below to proceed."
537  echo "Do you wish to continue?"
538  read reponse
539  if [[ $reponse == "oui" || $reponse == "yes" ]]
540  then
541    \rm -f $LIBFGCM/grid/dimensions.h
542  else
543    exit
544  fi
545fi
546
547
548cd $LIBFGCM/grid/dimension
549./makdim $dim
550if (($? != 0))
551then
552    exit 1
553fi
554
555cat $LIBFGCM/grid/dimensions.h
556cd $LMDGCM
557
558if [[ "$bands" != "" ]]
559then
560  # Generic model, recreate bands.h (IR & VIS bands for radiative transfer)
561  bands=$(echo $bands | sed -e 's/[^0-9]/ /g')
562  cd $LIBFGCM/phy$physique/bands
563  ./makbands $bands
564  cat $LIBFGCM/phy$physique/bands.h
565  cd $LMDGCM
566fi
567
568if [[ "$scatterers" != "" ]]
569then
570  # Generic model, recreate scatterers.h
571  cd $LIBFGCM/phy$physique/scatterers
572  ./make_scatterers $scatterers
573  cat $LIBFGCM/phy$physique/scatterers.h
574  cd $LMDGCM
575fi
576
577
578########################################################################
579# Differentes dynamiques (3d, 2d, 1d)
580########################################################################
581
582dimension=`echo $dim | wc -w`
583echo dimension $dimension
584
585if (( $dimension == 3 ))
586then
587  cd $LIBFGCM/grid
588  \rm fxyprim.h
589  cp -p fxy_${grille}.h fxyprim.h
590#else
591#  echo "Probleme dans les dimensions de la dynamique !!"
592#  echo "Non reactive pour l'instant !!!"
593fi
594
595if (( $dimension == 1 ))
596then
597## Sanity check: 1D models should be used in serial
598  if [[ $parallel != "none" ]]
599  then
600    echo "Error: a 1D model should not be compiled with "
601    echo "       -parallel [mpi|omp|mpi_omp] option!"
602    exit
603  fi
604  CPP_KEY="$CPP_KEY CPP_1D"
605##in 1D, add dyn3d to include path (because main prog is in physics)
606  INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common"
607## no filtre in 1d:
608  FILTRE_PATH=$LMDGCM/.void_dir
609## no need to compile all routines in dyn3d_common either:
610  DYN_COMMON_PATH=$LMDGCM/.void_dir
611## no need to compile all routines in dynlmdz_phy... ;
612## (because key ones are included in 1D main program)
613  DYN_PHYS_PATH=$LMDGCM/.void_dir
614  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
615fi
616
617######################################################################
618#   Traitement special pour le nouveau rayonnement de Laurent Li.
619#   ---> YM desactive pour le traitemement en parallele
620######################################################################
621
622#if [[ -f $libf/phy$physique/raddim.h ]]
623#then
624# if [[ -f $libf/phy$physique/raddim.$dimh.h ]]
625#then
626#  \rm -f $libf/phy$physique/raddim.h
627#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
628#  echo $libf/phy$physique/raddim.$dimh.h
629#  cat $libf/phy$physique/raddim.h
630# else
631#  echo On peut diminuer la taille de l executable en creant
632#  echo le fichier $libf/phy$physique/raddim.$dimh.h
633#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
634# fi
635#fi
636
637######################################################################
638# Gestion du filtre qui n'existe qu'en 3d.
639######################################################################
640
641if (( `expr $dimc \> 2` == 1 ))
642then
643   filtre="FILTRE=$filtre"
644else
645   filtre="FILTRE= L_FILTRE= "
646fi
647echo MACRO FILTRE $filtre
648
649echo $dimc
650
651
652
653######################################################################
654# Creation du suffixe de la configuration
655######################################################################
656
657
658SUFF_NAME=_${dim_full}
659SUFF_NAME=${SUFF_NAME}_phy${physique}
660
661if [[ "$parallel" != "none" ]]
662then
663  SUFF_NAME=${SUFF_NAME}_para
664  DYN=dyn${dimc}d${paramem}
665  if [[ "$paramem" == "mem" ]]
666  then
667   SUFF_NAME=${SUFF_NAME}_${paramem}
668  fi
669else
670  SUFF_NAME=${SUFF_NAME}_seq
671  if (( $dimension == 1 ))
672  then
673    # dynamics-related routines in"dyn1d" subdirectory of phy${physique}
674    DYN=phy${physique}/dyn1d
675  else
676    DYN=dyn${dimc}d
677  fi
678fi
679
680if [[ $veget != "false" ]]
681then
682  SUFF_NAME=${SUFF_NAME}_orch
683fi
684
685if [[ $couple != "false" ]]
686then
687  SUFF_NAME=${SUFF_NAME}_couple
688fi
689
690if [[ $chimie == "INCA" ]]
691then
692  SUFF_NAME=${SUFF_NAME}_inca
693fi
694
695if [[ $libphy == "true" ]]
696then
697  # special case where we compile only the physics
698  DYN=$LMDGCM/.void_dir
699  DYN_COMMON_PATH=$LMDGCM/.void_dir
700  FILTRE_PATH=$LMDGCM/.void_dir
701  DYN_PHYS_PATH=$LMDGCM/.void_dir
702  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
703  #and there is no main program to generate
704  code=""
705  SUFF_NAME=""
706else
707  SUFF_NAME=${SUFF_NAME}.e
708fi
709
710cd $LMDGCM
711config_fcm="config.fcm"
712rm -f $config_fcm
713touch $config_fcm
714rm -f bin/${code}${SUFF_NAME}.e
715rm -f arch.fcm
716rm -f arch.opt
717
718echo "%ARCH          $arch"          >> $config_fcm
719echo "%INCDIR        $INCLUDE"       >> $config_fcm 
720echo "%LIB           $LIB"           >> $config_fcm
721echo "%ROOT_PATH     $PWD"           >> $config_fcm
722echo "%LIBF          $LIBFGCM"       >> $config_fcm
723echo "%LIBO          $LIBOGCM"       >> $config_fcm
724echo "%DYN           $DYN"           >> $config_fcm
725echo "%DYN_COMMON    $DYN_COMMON_PATH" >> $config_fcm
726echo "%PHY_COMMON    $PHY_COMMON_PATH" >> $config_fcm
727echo "%FILTRE        $FILTRE_PATH"   >> $config_fcm
728echo "%PHYS          phy${physique}" >> $config_fcm
729echo "%DYN_PHYS      $DYN_PHYS_PATH" >> $config_fcm
730echo "%DYN_PHYS_SUB  $DYN_PHYS_SUB_PATH" >> $config_fcm
731echo "%RRTM          $RRTM_PATH"     >> $config_fcm
732echo "%DUST          $DUST_PATH"     >> $config_fcm
733echo "%STRATAER      $STRATAER_PATH" >> $config_fcm
734echo "%SISVAT        $SISVAT_PATH"   >> $config_fcm
735echo "%COSP          $COSP_PATH"     >> $config_fcm
736echo "%CHEM          $CHEM_PATH"     >> $config_fcm
737echo "%CLOUD         $CLOUD_PATH"    >> $config_fcm
738echo "%MUPHY         $MUPHY_PATH"    >> $config_fcm
739echo "%AERONO        $AERONO_PATH"   >> $config_fcm
740echo "%CPP_KEY       $CPP_KEY"       >> $config_fcm
741echo "%EXEC          $code"          >> $config_fcm
742echo "%SUFF_NAME     $SUFF_NAME"     >> $config_fcm
743echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm
744echo "%PARA_FFLAGS   $PARA_FFLAGS"   >> $config_fcm
745echo "%PARA_LD       $PARA_LD"       >> $config_fcm
746echo "%EXT_SRC       $EXT_SRC"       >> $config_fcm
747
748
749
750ln -s arch/arch-${arch}.fcm arch.fcm
751if test -f arch/arch-${arch}.opt &&  [ $compil_mod = "prod" ]
752  then
753  ln -s arch/arch-${arch}.opt arch.opt
754else
755  ln -s .void_file arch.opt
756fi
757
758
759rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
760./build_gcm ${fcm_path} -j $job $full
761
762rm -rf tmp_src
763rm -rf config
764ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config
765ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src
766
767
768if [[ -r $LIBFGCM/grid/dimensions.h ]]
769then
770  # Cleanup: remove dimension.h file
771  \rm -f $LIBFGCM/grid/dimensions.h
772fi
Note: See TracBrowser for help on using the repository browser.