source: trunk/LMDZ.MARS/makegcm_ifort @ 1521

Last change on this file since 1521 was 1521, checked in by emillour, 9 years ago

All GCMs: Updates to make planetary codes (+Earth) setups converge.

  • Made a "phy_common" directory in libf, to contain routines common (wrt structural nature of underlying code/grid) to all LMDZ-related physics packages.
  • moved all "mod_phys_*" and "mod_grid_phy_lmdz" files from dynlonlat_phylonlat to "phy_common"
  • moved "ioipsl_getincom_p.F90 from "misc" to "phy_common" and modified it to match Earth GCM version and renamed it ioipsl_getin_p_mod.F90
  • added an "abort_physics" (as in Earth GCM) in "phy_common"
  • added a "print_control_mod.F90 (as in Earth GCM) in phy_common
  • made similar changes in LMDZ.GENERIC and LMDZ.MARS

EM

  • Property svn:executable set to *
File size: 26.1 KB
RevLine 
[38]1#!/bin/csh -f
2# $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $
3#set verbose echo
4########################################################################
5# options par defaut pour la commande make
6########################################################################
7set dim="64x48x32"
8set physique=mars
9set phys="PHYS=$physique"
[1403]10set include='-I$(LIBF)/grid -I$(LIBF)/misc -I. -I$(LIBF)/dynlonlat_phylonlat'
[1499]11set cpp_def=''
[38]12set ntrac = 1
13set filtre=filtrez
14set grille=reg
15set dyntype="dyn"
[1085]16set full=""
[1403]17#src_dirs: directories containing source files
18set src_dirs="grid misc" 
19
[38]20########################################################################
21# path a changer contenant les sources et les objets du modele
22########################################################################
23
24#### If you want you can set environment variables here (instead of
25####  relying on the C-shell environment variables)
26# default LMDGCM to where makegcm script is located:
[519]27set scriptdir=`dirname $0`
28setenv LMDGCM `readlink -f $scriptdir`
[38]29# You may set LIBOGCM to something else; otherwise we default to:
[164]30setenv LIBOGCM $LMDGCM/libo
[38]31
[1110]32### NetCDF librairies. some presets for LMD people.
33hostname | grep 'lmd.jussieu.fr' > /dev/null
34if ( $? == 0 ) then
35   echo "*** NETCDF preset *** LMD machines"
36   setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_ifort/lib
37   setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_ifort/include
38endif
39hostname | grep 'n201' > /dev/null
40if ( $? == 0 ) then
41   echo "*** NETCDF preset *** GNOME cluster"
42   setenv NCDFLIB /usr/local/lib
43   setenv NCDFINC /usr/local/include
44endif
45hostname | grep 'ciclad' > /dev/null
46if ( $? == 0 ) then
47   echo "*** NETCDF preset *** CICLAD cluster"
[1354]48   setenv NCDFLIB /opt/netcdf3/ifort/lib
49   setenv NCDFINC /opt/netcdf3/ifort/include
[1110]50endif
[1416]51hostname | grep 'ada' > /dev/null
52if ( $? == 0 ) then
[1499]53   echo "*** NETCDF preset *** Ada cluster"
[1416]54   setenv NCDFLIB /smplocal/pub/NetCDF/4.1.3/seq/lib
55   setenv NCDFINC /smplocal/pub/NetCDF/4.1.3/seq/include
56endif
[1110]57### end NetCDF presets
58
[38]59setenv localdir "`pwd`"
60set MODIPSL=0
61echo $localdir | grep modipsl >& /dev/null
62if ( ! $status ) then
63  set MODIPSL=1
64  setenv LMDGCM $localdir
65  cd ../..
66  setenv LIBOGCM "`pwd`/lib"
67  cd $localdir
68  if ( `hostname` == rhodes ) then
69    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
70    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
71  else
72    if ( `hostname` == nymphea0 ) then
73      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
74      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
75    else
76      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
77    endif
78  endif
79else
80  if ( ! $?LMDGCM ) then
81    echo You must initialize the variable LMDGCM in your environnement
82    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
83    exit
84  endif
85  if ( ! $?LIBOGCM ) then
86    set LIBOGCM=$LMDGCM/libo
87  endif
88  if ( ! $?NCDFLIB ) then
89    echo You must initialize the variable NCDFLIB in your environnement
90    echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc
91    exit
92  endif
93  if ( ! $?NCDFINC ) then
94    echo You must initialize the variable NCDFINC in your environnement
95    echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc
96    exit
97  endif
98endif
99set model=$LMDGCM
100set libo=$LIBOGCM
101
102########################################################################
103#  Les differentes platformes reconnues
104########################################################################
105
106set HP=0
107set IBM=0
108set SUN=0
109set VPP=0
110set CRAY=0
111set DEC=0
112set LINUX=0
113set NEC=0
114set XNEC=0
115if ( `uname` == HP-UX ) then
116   set machine=HP
117   set HP=1
118else if (`uname` == UNIX_System_V ) then
119   set machine=VPP
120   set VPP=1
121else if (`uname` == SunOS ) then
122   set machine=SUN
123   set SUN=1
124else if ( `uname` == AIX ) then
125   set machine=IBM
126   set IBM=1
127else if ( `uname` == OSF1 ) then
128   set machine=ALPHA
129   set DEC=1
130else if ( `uname` == Linux ) then
131   set machine=LINUX
132   set LINUX=1
133else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
134   set machine=CRAY
135   set CRAY=1
136else if ( `uname` == SUPER-UX ) then
137   set machine=NEC
138   set NEC=1
139else if ( `hostname` == rhodes) then
140   set machine=XNEC
141   set XNEC=1
142else
143   echo Vous travaillez sur une machine non prevue par le reglement
144   exit
145endif
146
147# create $libo directory if it doesn't exist
148if ( ! -d $libo )  then
149   mkdir $libo
150endif
151
152if $VPP then
153set netcdf=netcdf_v
154else
155set netcdf=netcdf
156endif
157########################################################################
158#  Quelques initialisations de variables du shell.
159########################################################################
160
161set dyn=
162set opt_link=""
163set adjnt=""
164set opt_dep=""
165
166set optim90=""
167set oplink=""
168
[1499]169hostname | grep 'n201' > /dev/null
170if ( $? == 0 ) then
171   #on Gnome Lapack & Blas available via ifort's MKL
172   set cpp_def="$cpp_def -DBLAS -DLAPACK"
173endif
174hostname | grep 'ada' > /dev/null
175if ( $? == 0 ) then
176   #on Ada Lapack & Blas available via ifort's MKL
177   set cpp_def="$cpp_def -DBLAS -DLAPACK"
178endif
179
[38]180########################################################################
181#  Optimisations par defaut suivant les machines
182########################################################################
183
184echo "Optimisations par defaut suivant les machines"
185set libf=$model/libf
186#setenv localdir "LOCAL_DIR=`pwd`"
187#setenv localdir "`pwd`"
188cd $model
189if $CRAY then
190   set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv '
191   set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf "
192   set mod_loc_dir=" "
193   set mod_suffix=" "
194else if $SUN then
195   set optim90=" -fast"
196   set optimtru90=" -fast -free"
197   set opt_link="-L$NCDFLIB -lnetcdf"
198   set mod_loc_dir=$localdir
199   set mod_suffix=mod
200else if $HP then
201else if $IBM then
202else if $VPP then
203   set optim90="$optim -X9 -w"
204   if $COUPLE then
205     set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
206     set oplink="-Wl,-t,-P,-dy "
207   else
208     set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
209     set oplink="-Wl,-t,-dy "
210   endif
211   set mod_loc_dir=$IOIPSLDIR
212   set mod_suffix=mod
213else if $DEC then
214else if $LINUX then
215# Ehouarn 'ifort' compiler
216   #NB: on gnome -O3 ==> NaNs ...
[1036]217   set optim="-auto -O2 -fp-model precise -ip -mkl=sequential -align all "
218   set optim90="-auto -O2 -fp-model precise -ip -mkl=sequential -align all "
219   set optimtru90="-auto -O2 -fp-model precise -ip -mkl=sequential -align all "
[38]220#   set opt_link=" -Mfree -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$NCDFLIB -lnetcdf -Bstatic "
[164]221#   set mod_loc_dir=$LIBOGCM
222# ifort puts mod files in local directory
223   set mod_loc_dir="."
[38]224   set mod_suffix=mod
225else if $NEC then
226   set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
227   set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
228###   set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl  -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v "
229   set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib  -lnetcdf_i8r8 "
230   set mod_loc_dir="."
231   set mod_suffix="mod"
232else if $XNEC then
233   set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
234   set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
235   if $MODIPSL then
236     if $COUPLE then
237       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB "
238     else
239       set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB "
240     endif
241     set mod_loc_dir="./"
242   else
243####     set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lsxioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8"
244     set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8"
245     set mod_loc_dir="."
246   endif
247   set mod_suffix="mod"
248
249endif
250
251# Ehouarn: add 'g9fortran' string to pathname
252set nomlib=${machine}
253
254# Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64)
255if (`uname` == Linux && `uname -m` == "x86_64") then
256  set nomlib=${machine}64
257endif
258
259########################################################################
260# lecture des options de mymake
261########################################################################
262
263top:
264if ($#argv > 0) then
265    switch ($1:q)
266
267    case -h:
268
269########################################################################
270# Manuel en ligne
271########################################################################
272more <<eod
273
274
275makegcm [Options] prog
276
277
278The makegcm script:
279-------------------
280
2811. compiles a series of subroutines located in the $LMDGCM/libf
282 sub-directories.
283 The objects are then stored in the libraries in $LIBOGCM.
284
2852. then, makegcm compiles program prog.f located by default in
286$LMDGCM/libf/dyn3d and makes the link with the libraries.
287
288Environment Variables '$LMDGCM' and '$LIBOGCM'
289 must be set as environment variables or directly
290 in the makegcm file.
291
292The makegcm command is used to control the different versions of the model
293 in parallel, compiled using the compilation options
294 and the various dimensions, without having to recompile the whole model.
295
296The FORTRAN libraries are stored in directory $LIBOGCM.
297
298
299OPTIONS:
300--------
301
302The following options can either be defined by default by editing the
303makegcm "script", or in interactive mode:
304
305-d imxjmxlm  where im, jm, and lm are the number of longitudes,
306             latitudes and vertical layers respectively.
307
308-t ntrac   Selects the number of tracers present in the model
309
310             Options -d and -t overwrite file
311             $LMDGCM/libf/grid/dimensions.h
312             which contains the 3 dimensions of the
313             horizontal grid
314             im, jm, lm plus the number of tracers passively advected
315             by the dynamics ntrac,
316             in 4 PARAMETER FORTRAN format
317             with a new file:
318             $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac
319             If the file does not exist already
320             it is created by the script
321             $LMDGCM/libf/grid/dimension/makdim
322
323-p PHYS    Selects the set of physical parameterizations
324           you want to compile the model with.
325           The model is then compiled using the physical
326           parameterization sources in directory:
327            $LMDGCM/libf/phyPHYS
328
329-g grille  Selects the grid type.
330           This option overwrites file
331           $LMDGCM/libf/grid/fxyprim.h
332           with file
333           $LMDGCM/libf/grid/fxy_grille.h
334           the grid can take the following values:
335           1. reg - the regular grid
336           2. sin - to obtain equidistant points in terms of sin(latitude)
337           3. new - to zoom into a part of the globe
338
339-O "compilation options" set of fortran compilation options to use
340
341-include path
342           Used if the subroutines contain #include files (ccp) that
343           are located in directories that are not referenced by default.
344
[1499]345-cpp FLAG  Add preprocessing definition of FLAG
346
[38]347-adjnt     Compiles the adjoint model to the dynamical code.
348
349-olddyn    To compile GCM with "old dynamics"
350
351-filtre  filter
352           To select the longitudinal filter in the polar regions.
353           "filter" corresponds to the name of a directory located in
354           $LMDGCM/libf. The standard filter for the model is "filtrez"
355           which can be used for a regular grid and for a 
356           grid with longitudinal zoom.
357
358-link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
359           Adds a link to FORTRAN libraries
360           libfile1.a, libfile2.a ...
361           located in directories dir1, dir2 ...respectively
362           If dirn is a directory with an automatic path
363           (/usr/lib ... for example)
364           there is no need to specify  -Ldirn.
365
[1085]366-full      Full (re)compilation (from scratch)
367
[38]368eod
369exit
370
371########################################################################
372# Lecture des differentes options
373########################################################################
374
375    case -d:
376        set dim=$2 ; shift ; shift ; goto top
377                       
378    case -O:
379        set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top
380
381     case -p
382        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
383
384     case -g
385        set grille="$2" ; shift ; shift ; goto top
386
387     case -t
388        set ntrac=$2 ; shift ; shift ; goto top
389
390     case -include
391        set include="$include -I$2" ; shift ; shift ; goto top
392
[1499]393     case -cpp
394        set cpp_def="$cpp_def -D$2" ; shift ; shift ; goto top
395
[38]396     case -adjnt
397        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
398
399     case -olddyn
400        set dyntype="olddyn" ; shift; goto top
401
[1085]402     case -full
403        set full="full" ; shift ; goto top
404
[38]405     case -filtre
406        set filtre=$2 ; shift ; shift ; goto top
407
408     case -link
409        set opt_link="$opt_link $2" ; shift ; shift ; goto top
410
411     case -debug
412        if $HP then
413           set optim90=" -g "
414        else if $SUN then
415           setenv PARALLEL 4
416           set optim90=" -g -C "
417           set optimtru90=" -g -C "
418        else if $CRAY then
419           set optim90="$optim90"" -G1 "
420        else if $LINUX then
421           ## for ifort
[1035]422             set optim=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
423             set optim90=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
424             set optimtru90=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
[38]425        else
426           echo "pas d option debug predefinie pour cette machine"
427           exit
428        endif
429        shift ; goto top
430
431     default
432        set code="$1" ; shift ; goto top
433
434   endsw
435endif
436
437echo "apres les opts dim $dim"
438
439########################################################################
440# cas special sans physique
441########################################################################
442if ( "$physique" == 'nophys' ) then
443   set phys="L_PHY= LIBPHY="
[1403]444else
[1521]445   set src_dirs="$src_dirs phy_common aerono$physique phy$physique"
446   set include="$include "'-I$(LIBF)/phy_common -I$(LIBF)/aerono'"$physique"' -I$(LIBF)/phy'"$physique"
447   set LIBPHY_COMMON='$(LIBO)/libphy_common.a'
[38]448endif
[1403]449set libdyn_phy=""
450set LIBDYN_PHYS=""
[38]451########################################################################
452# choix du nombre de traceur par defaut si il n'a pas ete choisi,
453# suivant la physique
454########################################################################
455
456if ( $ntrac == 0  ) then
457    if ( "$physique" == 'nophys' ) then
458        set ntrac=1
459    else if ( "$physique" == 'lmd' ) then
460        set ntrac=2
461    else if ( "$physique" == 'lmd_test_li' ) then
462        set ntrac=2
463    else if ( "$physique" == 'ec' ) then
464        set ntrac=1
465    else
466        set ntrac = 1
467    endif
468endif
469
470########################################################################
471#subtilites sur le nom de la librairie
472########################################################################
473
474\rm tmp ; touch tmp
475\rm tmp90 ; touch tmp90
476foreach i ( $optim90 )
477   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp
478end
479set suf=
480foreach i ( `sort tmp | uniq ` )
481   set suf=$suf$i
482end
483if ( ! $IBM ) then
484   set nomlib="$nomlib$suf"
485endif
486if ( $DEC ) then
487   set nomlib=DEC
488endif
489
490# dimension
491
492echo "dimension avant sed $dim"
493if ( $IBM ) then
494   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
495   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
496else if ( $SUN || $XNEC ) then
497   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
498   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
499else
500#   set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'`
501#   set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'`
502     set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
503     set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
504endif
505
506# build final name of libraries directory:
507if ( "$dyntype" == "olddyn" ) then
[1246]508  set nomlib=${nomlib}_${dim_}_t${ntrac}_${grille}_olddyn
[38]509else
[1246]510  set nomlib=${nomlib}_${dim_}_t${ntrac}_${grille}
[38]511endif
512
513# Append 'physique' type, if it is not mars, to nomlib
514if ( "$physique" != "mars" ) then
515  set nomlib=${nomlib}_${physique}
516endif
517
518## M-A-F nomlib trop long sur CRAY pour ar
519if ( $CRAY ) then
520    set nomlib=F90_${dim_}_t${ntrac}
521endif
522if ( $NEC || $XNEC ) then
523    set nomlib=F90_${dim_}_t${ntrac}
524endif
525
526echo "calcul de la dimension"
527set dimc=`echo $dim | wc -w`
528
529if ( "$dimc" == "2" ) then
530  set include="$include "'-I$(LIBF)/dyn2d '
531  set dimh=$dim
[1403]532endif
533if ( "$dimc" == "3" ) then
[38]534  if ( "$dyntype" == "olddyn" ) then
535    set include="$include "'-I$(LIBF)/olddyn3d '
[1403]536    set src_dirs="$src_dirs olddyn3d dynlonlat_phylonlat dynlonlat_phylonlat/phy$physique"
[38]537  else
538    set include="$include "'-I$(LIBF)/dyn3d '
[1403]539    set src_dirs="$src_dirs dyn3d dynlonlat_phylonlat dynlonlat_phylonlat/phy$physique"
[38]540  endif
[1403]541  set libdyn_phy="-ldynlonlat_phylonlat"
542  set LIBDYN_PHYS='$(LIBO)/libdynlonlat_phylonlat.a'
[38]543  set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
544endif
545echo "dimc is $dimc"
546
547########################################################################
548# path pour les #include
549########################################################################
550
551set include="$include -I$NCDFINC "
552echo $include
553
554########################################################################
555# Gestion des dimensions du modele.
556# on cree ou remplace le fichier des dimensions/nombre de traceur
557########################################################################
558
559cd $libf/grid
560if ( -f dimensions.h ) then
[148]561  echo "WARNING: you are probably already compiling the model (perhaps"
562  echo " elsewhere). Wait until the first compilation ends before "
563  echo " compiling a different configuration."
564  echo "If you are sure that you are not already compiling, then you"
565  echo " may continue this compilation by answering yes."
566  echo "Do you want to continue?"
567  if ( $< == "yes" ) then
[38]568    #remove old dimensions.h file
569    \rm -f $libf/grid/dimensions.h
570  else
571    exit
572  endif
573endif
574
575# Build the appropriate 'dimensions.h' file
576cd dimension
[1036]577./makdim $dim
[38]578# echo contents of dimensions.h to standard output
579cat $libf/grid/dimensions.h
580
581cd $LMDGCM
582# set path to objects directory
583set libo=$libo/$nomlib
584# create objects directory, if it doesn't exist
585if ( ! -d $libo )  then
586   mkdir $libo
587   cd $model
588endif
589
590########################################################################
591# Differentes dynamiques (3d, 2d, 1d)
592########################################################################
593
594set dimension=`echo $dim | wc -w`
595echo dimension $dimension dim $dim
596if ( $dimension == 1 ) then
[1036]597  echo "No dynamics"
598##  set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique "
599## NB: we still need to have L_DYN=libdyn3d to reach routines and module
600## objects which are located in dyn3d
[1403]601  set dyntype=""
602  set filtre="L_DYN= DYN= FILTRE= L_FILTRE= "
603  set dyn="L_DYN= DYN= L_FILTRE= "
604  set dirmain="phy$physique/dyn1d"
605  set src_dirs="$src_dirs phy$physique/dyn1d "
606  set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d'
[38]607endif
608endif
609
610cd $model
611if ( $dimension == 3 ) then
612  cd libf/grid
613  \rm fxyprim.h
614  cp -p fxy_${grille}.h fxyprim.h
615endif
616
617######################################################################
618#   Traitement special pour le nouveau rayonnement de Laurent Li.
619######################################################################
620
621if ( -f $libf/phy$physique/raddim.h ) then
622  if ( -f $libf/phy$physique/raddim.$dimh.h ) then
623    \rm $libf/phy$physique/raddim.h
624    cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
625    echo $libf/phy$physique/raddim.$dimh.h
626    cat $libf/phy$physique/raddim.$dimh.h
627    cat $libf/phy$physique/raddim.h
628  else
629    echo On peut diminuer la taille de l executable en creant
630    echo le fichier $libf/phy$physique/raddim.$dimh.h
631    \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
632  endif
633endif
634
635######################################################################
636# Gestion du filtre qui n'existe qu'en 3d.
637######################################################################
638
639# set filtre to 'oldfiltrez' if using -olddyn option
640if ( "$dyntype" == "olddyn" ) then
641  set filtre="oldfiltrez"
642endif
643
644if ( `expr $dimc \> 2` == 1 ) then
645   set filtre="FILTRE=$filtre"
[1403]646   if ( "$dyntype" == "olddyn" ) then
647     set src_dirs="$src_dirs oldfiltrez"
648   else
649     set src_dirs="$src_dirs filtrez"
650   endif
[38]651else
[1403]652   set filtre="FILTRE= L_FILTRE= L_DYN= "
[38]653endif
654echo "MACRO FILTRE $filtre"
655
656echo "dimc $dimc"
657
[1085]658#cleanup for a full recompilation, if requested
659if ("$full" == "full") then
660# remove makefile and $libo
661  cd $model
662  \rm -f makefile
663  \rm -rf $libo/*
664endif
665
[38]666########################################################################
667#  Avant de lancer le make, on recree le makefile si necessaire
668########################################################################
669# c'est a dire dans 3 cas:
670# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
671#    derniere creation du makefile
672# 2. si le fichier contenant cette liste "liste_des_sources"
673#    n'existe pas.
674# 3. Si le makefile n'existe pas.
675########################################################################
676
677cd $model
[646]678find libf -name '*.[Fh]' -print | sort >! tmp77
[38]679#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
[646]680find libf -name '*.[Fh]90' -print | sort >> tmp90
[38]681
682if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
683     || `diff tmp90 liste_des_sources_f90 | wc -w` \
684     || ! -f makefile \
685     || ! -f liste_des_sources_f90 \
686     || ! -f liste_des_sources_f77 ) then
687        echo "les fichiers suivants ont ete crees ou detruits"
688        echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
689        diff liste_des_sources_f77 tmp77
690        diff liste_des_sources_f90 tmp90
691        \cp tmp77 liste_des_sources_f77
692        \cp tmp90 liste_des_sources_f90
693        echo "On recree le makefile"
[1403]694        echo "src_dirs: $src_dirs"
[1416]695        ./create_make_gcm $src_dirs >! tmp
[38]696        \mv tmp makefile
697        echo "Nouveau makefile cree."
698endif
699
700########################################################################
701#  Execution de la comande make
702########################################################################
703
704echo PHYSIQUE $phys
705echo dynamique $dyn $dimension
706echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
707echo PATH pour les fichiers INCLUDE $include
708echo OPLINK="$oplink"
709
710if $HP then
711   set f77='fort77 +OP'
712   set f90='jensaisrien'
713   set opt_link="$opt_link -lm"
714else  if $VPP then
715   set f77=frt
716   set f90=$f77
717else if $CRAY then
718   set f77=f90
719   set f90=f90
720else if $LINUX then
[1244]721   set f77=ifort
722   set f90=ifort
[38]723   set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf "
724else if $SUN then
725   set f77=f90
726   set f90=f90
727else if $NEC then
728   set f77=f90
729   set f90=f90
730else if $XNEC then
731   set f77=sxmpif90
732   set f90=sxmpif90
733else
734   set f77=f77
735   set f90=f90
736endif
737
738cd $model
739
740if $VPP then
741  set make="gmake RANLIB=ls"
742else if $CRAY then
743  set make="make RANLIB=ls"
744else if $NEC then
745  set make="make RANLIB=ls"
746else if $LINUX then
747  set make="make -k RANLIB=ranlib"
748else if $XNEC then
749  set make="/usr/local/bin/gmake RANLIB=ls"
750  set make="/usr/freeware/bin/gmake RANLIB=ls"
751else
752  set make="make RANLIB=ranlib"
753endif
754
755set include="$include"" -I$libf/phy$physique"
756
757
758#################################################################
759# Execution de la comande make... ENFIN!
760#################################################################
761
762if $VPP then
763  set optim90=" $optim90 -Am -M$libo"
764  set optimtru90="$optim90"
765else if $SUN then
766 set optim90=" $optim90 -M$libo"
767 set optimtru90=" $optimtru90 "
768else if $NEC then
769 set optim90=" $optim90 -I$libo "
770else if $XNEC then
771 set optim90=" $optim90 -I$libo "
772 set optimtru90=" $optimtru90 -I$libo "
773else if $LINUX then
774# Ehouarn : adapt to gfortran
[1499]775 set optim="$optim -I${libo} $cpp_def"
776 set optim90="$optim90 -I${libo} $cpp_def"
777 set optimtru90="$optimtru90 -I${libo} $cpp_def"
[38]778# Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above)
779# set mod_loc_dir=$libo
780endif
781
782set link="$f90 $optim90"
783
784set ar=ar
785
786if $XNEC then
787  set link="sxld $opt_link"
788  set link="$f90 "
789#  set ar=sxar
790endif
791
792
793cd $localdir
794
[1403]795## locate main program (could be in dyn3d or dynlonlat_phylonlat/phy$physique
796##  or phy$physique/dyn1d   and could be .F or .F90)
[519]797set source_code=${code}.F
[1403]798set dirmain=dyn${dimc}d
[519]799if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then
800  set source_code=${code}.F90
801endif
[1403]802if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then
803  set dirmain=phy${physique}/dyn1d
[519]804  set source_code=${code}.F
805endif
[1403]806if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then
807  set dirmain=phy${physique}/dyn1d
[519]808  set source_code=${code}.F90
809endif
[1403]810if ( -f $LMDGCM/libf/dynlonlat_phylonlat/phy${physique}/${code}.F ) then
811  set dirmain=dynlonlat_phylonlat/phy${physique}
812  set source_code=${code}.F
[519]813endif
[1403]814if ( -f $LMDGCM/libf/dynlonlat_phylonlat/phy${physique}/${code}.F90 ) then
815  set dirmain=dynlonlat_phylonlat/phy${physique}
816  set source_code=${code}.F90
817endif
[519]818
[38]819echo $make -f $LMDGCM/makefile \
820OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
821OPTIM="$optim" \
822OPTIM90="$optim90" \
823OPTIMTRU90="$optimtru90" \
824INCLUDE="$include" \
825$filtre \
826LIBO=$libo \
827$phys \
[1521]828LIBPHY_COMMON=${LIBPHY_COMMON} \
[1403]829LIBDYN_PHYS=${LIBDYN_PHYS} \
[38]830DIM=$dimc \
831DYNTYPE="$dyntype" \
[1403]832L_DYN_PHY="$libdyn_phy" \
[38]833L_ADJNT="$adjnt" \
834LOCAL_DIR="$localdir"  \
835F77="$f77" \
836F90="$f90" \
837OPLINK="$oplink" \
838LINK="$link" \
839GCM="$LMDGCM" \
840MOD_LOC_DIR=$mod_loc_dir \
841MOD_SUFFIX=$mod_suffix \
842AR=$ar \
[1403]843DIRMAIN=$dirmain \
[519]844SOURCE=$source_code \
[38]845PROG=$code
846
847
848$make -f $LMDGCM/makefile \
849OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
850OPTIM="$optim" \
851OPTIM90="$optim90" \
852OPTIMTRU90="$optimtru90" \
853INCLUDE="$include" \
854$filtre \
855LIBO=$libo \
856$phys \
[1521]857LIBPHY_COMMON=${LIBPHY_COMMON} \
[1403]858LIBDYN_PHYS=${LIBDYN_PHYS} \
[38]859DIM=$dimc \
860DYNTYPE="$dyntype" \
[1403]861L_DYN_PHY="$libdyn_phy" \
[38]862L_ADJNT="$adjnt" \
863LOCAL_DIR="$localdir"  \
864F77="$f77" \
865F90="$f90" \
866OPLINK="$oplink" \
867LINK="$link" \
868GCM="$LMDGCM" \
869MOD_LOC_DIR=$mod_loc_dir \
870MOD_SUFFIX=$mod_suffix \
871AR=$ar \
[1403]872DIRMAIN=$dirmain \
[519]873SOURCE=$source_code \
[38]874PROG=$code
875
[1403]876# cleanup, remove dimensions.h
[148]877\rm -f $libf/grid/dimensions.h
Note: See TracBrowser for help on using the repository browser.