source: LMDZ6/branches/contrails/makelmdz_fcm @ 5450

Last change on this file since 5450 was 5341, checked in by Laurent Fairhead, 5 weeks ago

Rollback, not needed

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