source: LMDZ4/branches/LMDZ4V5.0-dev/makegcm @ 3982

Last change on this file since 3982 was 1300, checked in by Laurent Fairhead, 14 years ago

Work on the config files (*.def):

  • the parameters used by default are those of a reference simulation adjusted for radiative equilibrium for the 96x94x39 resolution (CLOUD09)
  • information on the coupling used (ocean and land) is transferred from the physiq.def file to the run.def file to ease the transfer of parameters files between forced and coupled simulations

Travail sur les fichiers de configuration (les*.def):

  • on prend les paramètres d'une simulation de référence ajusté pour un équilibre radiatif (CLOUD09) par défaut
  • les informations sur la configuration du couplage (océan et végétation) sont déplacées de physiq.def à run.def (pour un échange plus aisé des fichiers de paramétrisations entre les configurations forcées et couplées)
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 32.7 KB
Line 
1#!/bin/csh
2#
3# $Id: makegcm 1300 2010-01-20 15:31:14Z fairhead $
4#
5#set verbose echo
6########################################################################
7# options par defaut pour la commande make
8########################################################################
9set dim="96x71x19"
10set physique=lmd
11set phys="PHYS=$physique"
12set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I$(LIBF)/filtrez -I. '
13set filtre=filtrez
14set grille=reg
15set couple=false
16set veget=false
17set chimie=false
18set psmile=true
19set parallel=false
20set vampir=false
21set OPT_STACK='-Wf,-init stack=nan'
22set OPT_STACK=' '
23set OPTIMI='-C debug -eC '
24set OPTIMI=' -ftrace '
25set OPT_LINUX='-O3'
26set OPT_LINUX="-i4 -r8 -O3"
27set io=ioipsl
28set cosp=false
29
30set FC_LINUX=g95
31set FC_LINUX=gfortran
32#set FC_LINUX=pgf90
33if ( $FC_LINUX == g95 ) then
34   set OPT_LINUX="-O3"
35   set OPT_LINUX="-O3"
36else if ( $FC_LINUX == gfortran ) then
37   set OPT_LINUX="-fdefault-real-8 -O3"
38#   set OPT_LINUX="-O3 -fno-second-underscore"
39   set OPT_LINUX="-O3 "
40else
41   # pgf90 options
42   set OPT_LINUX="-i4 -r8 -O2 -Munroll -Mnoframe -Mautoinline -Mcache_align"
43endif
44
45########################################################################
46# path a changer contenant les sources et les objets du modele
47########################################################################
48
49###### VERSION LMDZ.4
50#set LMDGCM=/workdir/p86cozic/INCA_dev/LMDZ4
51#setenv LIBOGCM $LMDGCM/libo
52set INCALIB=../INCA3/config/lib
53set LMDGCM="`pwd`"
54setenv LIBOGCM $LMDGCM/libo
55#set LMDGCM=/d4/fairhead/V4/
56#setenv LIBOGCM $LMDGCM/libo
57#
58#
59#setenv NCDFINC /tmpdir/fairhead/1P1bis/netcdf-3.6.1/include
60#setenv NCDFLIB /tmpdir/fairhead/1P1bis/netcdf-3.6.1/lib
61#setenv IOIPSLDIR /tmpdir/fairhead/IOIPSL/modipsl/lib
62#setenv MODIPSLDIR /tmpdir/fairhead/IOIPSL/modipsl/lib
63setenv IOIPSLDIR /d4/fairhead/gfortran/ioispl-v2_1_9
64setenv MODIPSLDIR /d4/fairhead/gfortran/ioispl-v2_1_9
65setenv NCDFINC /d4/fairhead/gfortran/netcdf-4.0.1/include
66setenv NCDFLIB /d4/fairhead/gfortran/netcdf-4.0.1/lib
67
68
69
70
71setenv localdir "`pwd`"
72set MODIPSL=0
73echo $localdir | grep modipsl >& /dev/null
74if ( ! $status ) then
75  set MODIPSL=1
76  setenv LMDGCM $localdir
77  cd ../..
78  setenv LIBOGCM "`pwd`/lib"
79  setenv IOIPSLDIR $LIBOGCM
80  setenv MODIPSLDIR $LIBOGCM
81  cd $localdir
82  if ( `hostname` == rhodes ) then
83    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
84    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
85  else
86    if ( `hostname` == nymphea0 ) then
87      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
88      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
89    else if ( `hostname` == mercure ) then
90      set NCDFINC=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
91      set NCDFLIB=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
92    else  if ( `hostname` == brodie ) then
93      set NCDFINC=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
94      set NCDFLIB=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
95    else
96      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
97    endif
98  endif
99else
100  if ( ! $?LMDGCM ) then
101    echo You must initialize the variable LMDGCM in your environnement
102    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
103    exit
104  endif
105  if ( ! $?LIBOGCM ) then
106    set LIBOGCM=$LMDGCM/libo
107  endif
108  if ( ! $?IOIPSLDIR ) then
109    echo You must initialize the variable IOIPSLDIR in your environnement
110    echo for instance: "setenv IOIPSLDIR /usr/myself/ioipsl" in .cshrc
111    exit
112  else
113      setenv MODIPSLDIR $IOIPSLDIR
114  endif
115  if ( ! $?NCDFLIB ) then
116    echo You must initialize the variable NCDFLIB in your environnement
117    echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc
118    exit
119  endif
120  if ( ! $?NCDFINC ) then
121    echo You must initialize the variable NCDFINC in your environnement
122    echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc
123    exit
124  endif
125endif
126set model=$LMDGCM
127set libo=$LIBOGCM
128
129########################################################################
130#  Les differentes platformes reconnues
131########################################################################
132
133set HP=0
134set IBM=0
135set SUN=0
136set VPP=0
137set CRAY=0
138set DEC=0
139set LINUX=0
140set NEC=0
141set XNEC=0
142set X6NEC=0
143set X8BRODIE=0
144if ( `uname` == HP-UX ) then
145   set machine=HP
146   set HP=1
147else if (`uname` == UNIX_System_V ) then
148   set machine=VPP
149   set VPP=1
150else if (`uname` == SunOS ) then
151   set machine=SUN
152   set SUN=1
153else if ( `uname` == AIX ) then
154   set machine=IBM
155   set IBM=1
156else if ( `uname` == OSF1 ) then
157   set machine=ALPHA
158   set DEC=1
159else if ( `uname` == Linux && `hostname` != mercure  && `hostname` != brodie ) then
160   set machine=LINUX
161   set LINUX=1
162else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
163   set machine=CRAY
164   set CRAY=1
165else if ( `uname` == SUPER-UX ) then
166   set machine=NEC
167   set NEC=1
168else if ( `hostname` == rhodes) then
169   set machine=XNEC
170   set XNEC=1
171else if ( `hostname` == mercure) then
172   set machine=X6NEC
173   set X6NEC=1
174else if ( `hostname` == brodie) then
175   set machine=X8BRODIE
176   set X8BRODIE=1
177else
178   echo Vous travaillez sur une machine non prevue par le reglement
179   exit
180endif
181
182if ( ! -d $libo )  then
183   mkdir $libo
184endif
185
186
187if $VPP then
188set netcdf=netcdf_v
189else
190set netcdf=netcdf
191endif
192########################################################################
193#  Quelques initialisations de variables du shell.
194########################################################################
195
196set dyn=
197set opt_link=""
198set adjnt=""
199set lcosp=""
200set opt_dep=""
201set libchimie=""
202
203set optim=""
204set optimbis=""
205set optim90=""
206set oplink=""
207
208########################################################################
209#  Optimisations par defaut suivant les machines
210########################################################################
211
212echo "Optimisations par defaut suivant les machines"
213set libf=$model/libf
214#setenv localdir "LOCAL_DIR=`pwd`"
215#setenv localdir "`pwd`"
216cd $model
217#############
218if $CRAY then
219#############
220#   set optim="-Wf'-ei' -dp -Wf'-a static'"
221   set optimbis=" -DCRAY "
222   set optim90="-Wp'-P' -DCRAY -p$IOIPSLDIR "'-p$(LIBO) -eiv '
223   set optim="$optim90"
224   if ( $io == "ioipsl" ) then
225     set oplink="-Wl'-DSTACK=128 -f indef' -L$IOIPSLDIR -lioipsl  -L$NCDFLIB -lnetcdf "
226   else
227     set oplink="-Wl'-DSTACK=128 -f indef' -L$IOIPSLDIR -L$NCDFLIB -lnetcdf "
228   endif
229   set mod_loc_dir=" "
230   set mod_suffix=" "
231#################
232else if $SUN then
233#################
234   set optim=" -fast "
235   set optimbis=" "
236   set optim90=" -fast -fixed "
237   set optimtru90=" -fast -free "
238   if ( $io == "ioipsl" ) then
239     set opt_link="-lf77compat -L$MODIPSLDIR -lsechiba -lparameters -lstomate -lioipsl -L$NCDFLIB -lnetcdf "
240   else
241     set opt_link="-lf77compat -L$MODIPSLDIR -lsechiba -lparameters -lstomate -L$NCDFLIB -lnetcdf "
242   endif
243   set mod_loc_dir=$localdir
244   set mod_suffix=mod
245#################
246else if $HP then
247#################
248   set optim=" +U77 -O +E1 "
249   set optimbis=" "
250#################
251else if $IBM then
252#################
253   set optim=" -O3 -qtune=pwr2 -qarch=pwr2"
254   set optimbis=" "
255#################
256else if $VPP then
257#################
258#   set optim="-Dasuxm  -On, -g -Ad -Potilax -Eciplume -Si"
259#   set optimbis="  -Wv,-m3 -Wp,-DVPP -Z $LMDGCM/listage"
260   set optimbis=" -Wp,-DNC_DOUBLE -Ad -Z $LMDGCM/listage -X9"
261   set optim90="$optim $optimbis -X9 -w"
262   set mod_loc_dir=$MODIPSLDIR
263   set mod_suffix=mod
264#################
265else if $DEC then
266#################
267   set optim=" "
268   set optimbis=" "
269#################
270else if $LINUX then
271#################
272   if ( $FC_LINUX == pgf90 || $FC_LINUX == g95 || $FC_LINUX == gfortran ) then
273     set optim=" $OPT_LINUX "
274     set optim90=" $OPT_LINUX "
275     set optimtru90=" $OPT_LINUX "
276   else
277     echo 'compilateur linux non reconnu'
278     exit
279   endif
280   set mod_loc_dir=$MODIPSLDIR
281   set mod_suffix=mod
282#################
283else if $NEC then
284#################
285   set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
286   set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
287   set optim="$optim90"
288   set optimbis=" "
289   if ( $io == "ioipsl" ) then
290     set opt_link=" -C hopt -float0 -ew -P static -L$MODIPSLDIR -lioipsl  $NCDFLIB -lnetcdf_i8r8_v "
291   else
292     set opt_link=" -C hopt -float0 -ew -P static -L$MODIPSLDIR $NCDFLIB -lnetcdf_i8r8_v "
293   endif
294   set mod_loc_dir="."
295   set mod_suffix="mod"
296#################
297else if $XNEC then
298#################
299   set optdbl='-dw -Wf\"-A dbl4\"'
300   set optim90=' -clear -float0 -f3 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
301   set optimtru90=' -clear -f4 -float0 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"'
302   set optim="$optim90"
303   set optimbis=" "
304   set mod_suffix="mod"
305   set mod_loc_dir="./"
306#################
307else if $X6NEC then
308#################
309   set optdbl='-dw -Wf\"-A dbl4\"' 
310   set optim90=' -clear -float0 -size_t64 -P stack -Wf "-ptr byte -init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
311   set optimtru90=' -clear -f4 -float0 -size_t64 -P stack -Wf "-ptr byte -init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"'
312   set optim="$optim90"
313   set optimbis=" "
314   set mod_suffix="mod"
315   set mod_loc_dir="./"
316#################
317else if $X8BRODIE then
318##################
319   set optdbl='-dw -Wf\"-A dbl4\"' 
320#   set optim90='-P stack -Wf,-pvctl res=whole,-A dbl4,-init stack=nan,-init heap=nan,-ptr byte -EP -R5 -float0 -dw -Wf,"-pvctl loopcnt=999999 fullmsg noassume" -I/SX/usr/include'
321   set optim90='-C vopt -Wf,-pvctl res=whole,-A dbl4,-init stack=nan,-init heap=nan,-ptr byte -EP -DNC_DOUBLE -R5 -float0 -dw -Wf,"-pvctl loopcnt=999999 noassume" -I/SX/usr/include'
322#   set optim90='-C vsafe -P stack -Wf,-pvctl res=whole,-A dbl4,-ptr byte -EP -R5 -float0 -dw -Wf,"-pvctl loopcnt=999999 fullmsg noassume" -I/SX/usr/include'
323   set optimtru90="$optim90"
324   set optim90="$optim90"
325   set optim="$optim90"
326   set optimbis=" "
327   set mod_suffix="mod"
328   set mod_loc_dir="./"
329else
330   set optim=""
331   set optimbis=" "
332endif
333
334set nomlib=$machine
335
336########################################################################
337# lecture des options de mymake
338########################################################################
339
340top:
341if ($#argv > 0) then
342    switch ($1:q)
343
344    case -h:
345
346########################################################################
347# Manuel en ligne
348########################################################################
349more <<eod
350
351
352makegcm [Options] prog
353
354
355
356
357Par default, la commande makegcm:
358---------------------------------
359
3601. compile une serie de sous programmes se trouvant dans des sous-repertoires
361de $LMDGCM/libf.
362Les sous programmes sont ensuite stokes sur dans des librairies FORTRAN
363sur $LIBOGCM.
364
3652. Ensuite, makegcm compile le programme prog.f se trouvant par default sur
366$LMDGCM/libf/dyn3d et effectue le lien avec l ensemble des librairies.
367
368La variable '$LMDGCM' doit etre initialisee dans votre .cshrc ou en dur
369dans la comande makegcm.
370
371La commande makegcm est faite pour permettre de gerer en parallele des
372versions differentes du modele, compilees avec des options de compilation
373et des dimensions differentes sans avoir a chaque fois a recompiler tout
374le modele.
375
376Les librairies FORTRAN sont stoquees sur le directory $LIBOGCM.
377
378
379OPTIONS:
380--------
381
382Les options suivantes peuvent etre definies soit par defaut en editant le
383"script" makegcm, soit en interactif:
384
385-d imxjmxlm  ou im, jm, et lm sont resp. le nombre de longitudes, latitudes
386             et couches verticales.
387             L'effet des options -d est d'ecraser le fichier
388             $LMDGCM/libf/grid/dimensions.h
389             qui contient sous forme de 3 PARAMETER FORTRAN les 3 dimensions
390             de la grille horizontale im, jm et verticale lm, par un nouveu fichier
391             $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm
392             Si ce fichier n'existe pas encore, il est cree par le script
393             $LMDGCM/libf/grid/dimension/makdim
394
395-p PHYS    pour selectionner le jeu de parametrisations physiques avec
396           lequel on veut compiler le modele.
397           Le modele sera alors compile en prenant les sources des
398           parametrisations physiques dans le repertoire:
399            $LMDGCM/libf/phyPHYS
400
401-c false|true
402           pour selectionner le mode force (par defaut) ou couple
403
404-io ioipsl|noioipsl
405           pour selectionner le logiciel IO : IOIPSL par defaut
406
407-psmile false|true
408           pour selectionner le mode psmile ou non (par defaut)
409
410-parallel  false|true
411           pour selectionner le mode parallele ou non (false par defaut)
412
413-v true|false
414           pour selectionner la vegetation (par defaut) ou non
415
416-chimie INCA|false
417           pour selectionner ou non la chimie (par defaut sans)
418
419-g grille  selectionne le type de grille qu'on veut utiliser.
420           L'effet de cette option est d'ecraser le fichier
421           $LMDGCM/libf/grid/fxyprim.h
422           avec le fichier
423           $LMDGCM/libf/grid/fxy_grille.h
424           grille peut prendre les valeurs:
425           1. reg pour la grille reguliere
426           2. sin pour avoir des points equidistants en sinus de la latitude
427           3. new pour pouvoir zoomer sur une partie du globe
428
429-O "optimisation fortran" ou les optimisations fortran sont les options de la
430            commande f77
431
432-include path
433           Dans le cas ou on a dans des sous programmes des fichiers
434           #include (cpp) qui se trouve sur des repertoires non references
435           par defaut
436
437-adjnt     Pour compiler la l'adjoint du code dynamique
438
439-cosp true|false     
440           Pour compiler avec cosp
441
442-filtre  filtre
443           Pour choisir le filtre en longitude dans les regions polaires.
444           "filtre" correspond au nom d'un repertoire se trouvant sur
445           $LMDGCM/libf. Le filtre standard du modele est "filtrez" qui peut
446           etre utilise aussi bien pour une grille reguliere que pour une
447           grille zoomee en longitude.
448
449-link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
450          Pour rajouter un lien avec les librairies FORTRAN
451          libfile1.a, libfile2.a ... se trouvant respectivement sur les
452          repertoires dir1, dir2 ...
453          Si dirn est un repertoire dont le chemin est automatique (comme
454          par exemple /usr/lib ...) il n'est pas besoin de specifier -Ldirn.
455
456Auteur: Frederic Hourdin  (hourdin@lmd.jussieu.fr)
457eod
458exit
459
460########################################################################
461# Lecture des differentes options
462########################################################################
463
464    case -d:
465        set dim=$2 ; shift ; shift ; goto top
466                       
467    case -O:
468        set optim="$2" ; shift ; shift ; goto top
469
470     case -p
471        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
472
473     case -g
474        set grille="$2" ; shift ; shift ; goto top
475
476     case -c
477        set couple="$2" ; shift ; shift ; goto top
478
479     case -io
480        set io="$2" ; shift ; shift ; goto top
481
482     case -v
483        set veget="$2" ; shift ; shift ; goto top
484
485     case -chimie
486        set chimie="$2" ; shift ; shift ; goto top
487
488     case -parallel
489        set parallel="$2" ; shift ; shift ; goto top
490 
491     case -include
492        set include="$include -I$2" ; shift ; shift ; goto top
493
494     case -adjnt
495        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
496        set optim="$optim -Dadj" ; shift ; goto top
497
498     case -cosp
499        set cosp="$2"; shift ; shift ; goto top
500
501     case -filtre
502        set filtre=$2 ; shift ; shift ; goto top
503
504     case -link
505        set opt_link="$opt_link $2" ; shift ; shift ; goto top
506
507     case -debug
508        if $HP then
509           set optim=" -g "
510        else if $SUN then
511           setenv PARALLEL 2
512# Il faut rajouter l'option -dalign a -g pour pouvoir editer les liens
513# avec des programmes compiles avec -fast
514           set optim=" -g -dalign "
515           set optim90=" -fixed -g "
516           set optimtru90=" -free -g -C -dalign "
517        else if $CRAY then
518           set optim="$optim"" -g "
519           set optim90="$optim90"" -G1 "
520        else if $LINUX then
521           if ( $FC_LINUX == "pgf90" ) then
522             set optim="$optim"" -g -C -Mbounds "
523             set optim90="$optim90"" -g -C -Mbounds "
524             set optimtru90="$optimtru90"" -g -C -Mbounds "
525           else if ( $FC_LINUX == 'g95' ) then
526             set optim="$optim"" -g -fbounds-check "
527             set optim90="$optim90"" -g -fbounds-check "
528             set optimtru90="$optimtru90"" -g -fbounds-check "
529           else
530             echo 'compilateur linux non reconnu'
531             exit
532           endif
533        else
534           echo pas d option debug predefinie pour cette machine
535           exit
536        endif
537        shift ; goto top
538
539     default
540        set code="$1" ; shift ; goto top
541
542   endsw
543endif
544
545########################################################################
546# Definition des clefs CPP
547########################################################################
548
549set cppflags=''
550
551if $X8BRODIE then
552  set cppflags="$cppflags -DNC_DOUBLE -DBLAS -DSGEMV=DGEMV -DSGEMM=DGEMM"
553endif
554
555if ( $io == ioipsl ) then
556   set cppflags="$cppflags -DCPP_IOIPSL"
557endif
558
559if ( "$cosp" == 'true' ) then
560    set cppflags="$cppflags -DCPP_COSP"
561    set include="$include"' -I$(LIBF)/cosp '
562    set opt_dep="$opt_dep cosp"
563#    set lcosp="-lcosp -lphy$physique "
564     set lcosp="-lcosp "
565   if ( $XNEC || $X8BRODIE || $X6NEC) then
566#    set lcosp="-lsxcosp -lsxphy$physique "
567     set lcosp="-lsxcosp "
568   endif
569endif
570
571if ( "$physique" == 'nophys' ) then
572   set phys="L_PHY= LIBPHY="
573else
574   #Default planet type is Earth
575   set cppflags="$cppflags -DCPP_EARTH"
576endif
577
578set link_veget=" "
579if ( "$veget" == 'true' ) then
580   set cppflags="$cppflags -DCPP_VEGET"
581#   set link_veget=" -lsechiba -lparameters -lstomate -lorglob -lparallel"
582   set link_veget=" -lsechiba -lparameters -lstomate"
583   if ( $XNEC || $X8BRODIE || $X6NEC) then
584#      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate -lsxorglob -lsxparallel"
585      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate "
586   endif
587endif
588
589if ( "$chimie" == 'INCA' ) then
590    set cppflags="$cppflags -DINCA" 
591    set libchimie=" -L$INCALIB -lchimie"
592    set opt_link="$opt_link  -L$INCALIB -lchimie"
593endif
594   
595if ( "$couple" == 'true' ) then
596   set cppflags="$cppflags -DCPP_COUPLE"
597endif
598
599set FLAG_PARA=''
600if ( "$parallel" == 'true' ) then
601   set cppflags="$cppflags -DCPP_PARA"
602   set FLAG_PARA='par'
603endif
604
605set optim="$optim $cppflags"
606set optim90="$optim90 $cppflags"
607set optimtru90="$optimtru90 $cppflags"
608
609
610########################################################################
611# cas special sans physique
612########################################################################
613if ( "$physique" == 'nophys' ) then
614   set phys="L_PHY= LIBPHY="
615endif
616
617########################################################################
618#subtilites sur le nom de la librairie
619########################################################################
620
621\rm -f tmp ; touch tmp
622\rm -f tmp90 ; touch tmp90
623foreach i ( $optim )
624   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g'  >> tmp
625end
626set suf=
627foreach i ( `sort tmp | uniq ` )
628   set suf=$suf$i
629end
630if ( ! $IBM ) then
631   set nomlib="$nomlib$suf"
632endif
633if ( $DEC ) then
634   set nomlib=DEC
635endif
636if ( $IBM ) then
637   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
638   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
639else if ( $SUN ) then
640   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
641   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
642else
643   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
644   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
645endif
646set nomlib=${nomlib}${physique}_${dim_}_$grille
647## M-A-F nomlib trop long sur CRAY pour ar
648if ( $CRAY ) then
649    set nomlib=F90_${dim_}
650endif
651if ( $NEC || $XNEC || $X6NEC || $X8BRODIE ) then
652    set nomlib=F90_${dim_}_'phy'${physique}${FLAG_PARA}
653endif
654echo calcul de la dimension
655set dimc=`echo $dim | wc -w`
656
657if ( "$dimc" == "2" ) then
658set include="$include "'-I$(LIBF)/dyn2d '
659set dimh=$dim
660else
661set include="$include "'-I$(LIBF)/dyn3d${FLAG_PARA} '
662set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
663endif
664echo $dimc
665
666########################################################################
667# path pour les #include
668########################################################################
669
670if ( $XNEC ) then
671  set include="$include -I$NCDFINC -I$IOIPSLDIR"
672else
673  set include="$include -I$NCDFINC -I$IOIPSLDIR"
674endif
675echo $include
676
677########################################################################
678# Gestion des dimensions du modele.
679# on cree ou remplace le fichier des dimensions
680########################################################################
681
682cd $libf/grid
683if ( -f dimensions.h ) then
684echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
685echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
686echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
687echo  vous pouvez continuer en repondant oui.
688echo "Voulez-vous vraiment continuer?"
689if ( $< == "oui" ) then
690\rm -f $libf/grid/dimensions.h
691else
692exit
693endif
694endif
695
696cd dimension
697./makdim $dim
698cat $libf/grid/dimensions.h
699
700cd $LMDGCM
701set libo=$libo/$nomlib
702if ( ! -d $libo )  then
703   mkdir $libo
704   cd $model
705endif
706
707########################################################################
708# Differentes dynamiques (3d, 2d, 1d)
709########################################################################
710
711set dimension=`echo $dim | wc -w`
712echo dimension $dimension
713if ( $dimension == 1 ) then
714echo pas de dynamique
715set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique "
716endif
717endif
718cd $model
719if ( $dimension == 3 ) then
720cd libf/grid
721\rm fxyprim.h
722cp -p fxy_${grille}.h fxyprim.h
723endif
724
725######################################################################
726#   Traitement special pour le nouveau rayonnement de Laurent Li.
727######################################################################
728
729#if ( -f $libf/phy$physique/raddim.h ) then
730# if ( -f $libf/phy$physique/raddim.$dimh.h ) then
731#  \rm -f $libf/phy$physique/raddim.h
732#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
733#  echo $libf/phy$physique/raddim.$dimh.h
734#  cat $libf/phy$physique/raddim.$dimh.h
735#  cat $libf/phy$physique/raddim.h
736# else
737#  echo On peut diminuer la taille de l executable en creant
738#  echo le fichier $libf/phy$physique/raddim.$dimh.h
739#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
740# endif
741#endif
742
743######################################################################
744# Gestion du filtre qui n'existe qu'en 3d.
745######################################################################
746
747if ( `expr $dimc \> 2` == 1 ) then
748   set filtre="FILTRE=$filtre"
749else
750   set filtre="FILTRE= L_FILTRE= "
751endif
752echo MACRO FILTRE $filtre
753
754echo $dimc
755
756########################################################################
757#  Avant de lancer le make, on recree le makefile si necessaire
758########################################################################
759########################################################################
760# c'est a dire dans 3 cas:
761# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
762#    derniere creation du makefile
763# 2. si le fichier contenant cette liste "liste_des_sources"
764#    n'existe pas.
765# 3. Si le makefile n'existe pas.
766########################################################################
767##########################################
768# On adapte d'abord certains include à F90
769##########################################
770##########################################
771cd $model
772find libf -name '*.[Fh]' -print >! tmp77
773find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
774find libf -name '*.[Fh]90' -print >> tmp90
775
776if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
777     || `diff tmp90 liste_des_sources_f90 | wc -w` \
778     || ! -f makefile \
779     || ! -f liste_des_sources_f90 \
780     || ! -f liste_des_sources_f77 ) then
781        echo les fichiers suivants ont ete crees ou detruits
782        echo ou les fichiers suivants sont passes ou ne sont plus en Fortran 90
783        diff liste_des_sources_f77 tmp77
784        diff liste_des_sources_f90 tmp90
785        \cp tmp77 liste_des_sources_f77
786        \cp tmp90 liste_des_sources_f90
787        echo On recree le makefile
788        ./create_make_gcm >! tmp
789        \mv tmp makefile
790        echo Nouveau makefile cree.
791endif
792
793########################################################################
794#  Execution de la comande make
795########################################################################
796
797echo PHYSIQUE $phys
798echo dynamique $dyn $dimension
799echo OPTIM="$optim" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
800echo PATH pour les fichiers INCLUDE $include
801echo OPLINK="$oplink"
802
803#################
804if $HP then
805#################
806   set f77='fort77 +OP'
807   set f90='jensaisrien'
808   set opt_link="$opt_link -lm"
809#################
810else  if $VPP then
811#################
812   set f77=frt
813   set f90=$f77
814   if ($couple == true) then
815     set opt_link="-Wg,-c $MODIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a -L$MODIPSLDIR -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
816     set oplink="-Wl,-t,-P,-dy "
817   else
818     set opt_link="-Wg,-c -L$MODIPSLDIR -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
819     set oplink="-Wl,-t,-dy "
820   endif
821   if ($veget == true) then
822     set opt_link="$opt_link $link_veget -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
823   endif
824#################
825else if $CRAY then
826#################
827   set f77=f90
828   set f90=f90
829#################
830else if $LINUX then
831#################
832#   set f77=pgf90
833#   set f90=pgf90
834   set f77=$FC_LINUX
835   set f90=$FC_LINUX
836   if ( $FC_LINUX == 'pgf90' ) then
837     if ( $io == "ioipsl" ) then
838       set opt_link=" -L$MODIPSLDIR $link_veget -L$NCDFLIB -lioipsl -lnetcdf "
839     else
840       set opt_link=" -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf "
841     endif
842   else if ($FC_LINUX == 'g95' || $FC_LINUX == 'gfortran' ) then
843     if ( $io == "ioipsl" ) then
844       set opt_link="-L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf -lioipsl -lnetcdf "
845     else
846       set opt_link="-L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf -lnetcdf "
847     endif
848   else
849     set opt_link=" "
850   endif
851#################
852else if $SUN then
853#################
854   set f77=f90
855   set f90=f90
856   if ( $io == "ioipsl" ) then
857     set opt_link="-lf77compat -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf "
858   else
859     set opt_link="-lf77compat -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf "
860   endif
861#################
862else if $NEC then
863#################
864   set f77=f90 -ftrace
865   set f90=f90 -ftrace
866   set opt_link="-L$MODIPSLDIR"
867   if ($veget == true) then
868     set opt_link="$opt_link $link_veget"
869   endif
870   if ($couple == true) then
871     set opt_link="$opt_link -lioipsl -loasis2.4_mpi2 -float0 -ew -P static $NCDFLIB "
872   else
873     set opt_link="$opt_link -L$MODIPSLDIR -lioipsl -float0 -ew -P static $NCDFLIB "
874   endif
875   set mod_loc_dir="./"
876#################
877else if $XNEC then
878#################
879   set f77="sxmpif90 -ftrace"
880   set f90="sxmpif90 -ftrace"
881   if $MODIPSL then
882     set opt_link="-L$MODIPSLDIR"
883     if ($veget == true) then
884       set opt_link="$opt_link $link_veget"
885     endif
886     if ($couple == true) then
887       if ($psmile == true) then
888       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
889       else
890       set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
891       endif
892     else
893       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
894     endif
895   else
896     if ($couple == true) then
897       set opt_link="-L$MODIPSLDIR"
898       set opt_link="$opt_link $link_veget -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
899     else
900       set opt_link=" -C hopt -float0 $optdbl -P static -L$MODIPSLDIR $link_veget -lsxioipsl $NCDFLIB "
901     endif
902   endif
903   set mod_loc_dir="./"
904##################
905else if $X6NEC then
906##################
907   set f77=sxmpif90
908   set f90=sxmpif90
909   if $MODIPSL then
910     set opt_link="$opt_link -L$MODIPSLDIR"
911     if ($veget == true) then
912       set opt_link="$opt_link $link_veget"
913     endif
914     if ($couple == true) then
915        if ($psmile == true) then
916        set opt_link="$opt_link -lsxioipsl -float0 -size_t64 $optdbl -P static $NCDFLIB "
917        else
918        set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 -size_t64 $optdbl -P static $NCDFLIB "
919        endif
920     else
921       set opt_link="$opt_link -lsxioipsl -float0 -size_t64 $optdbl -P static $NCDFLIB "
922     endif
923   else
924#     set opt_link=" -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
925     set opt_link=" $opt_link -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB "
926
927   endif
928   set mod_loc_dir="./"
929##################
930else if $X8BRODIE then
931##################
932   set f77=sxmpif90
933   set f90=sxmpif90
934   if $MODIPSL then
935     set opt_link="$opt_link -float0 -Wf,-A dbl4 -L$MODIPSLDIR -lblas"
936     if ($veget == true) then
937       set opt_link="$opt_link $link_veget"
938     endif
939     if ($couple == true) then
940       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
941     else
942       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
943     endif
944   else
945#     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
946     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB -lblas"
947
948   endif
949   set mod_loc_dir="./"
950#################
951else
952#################
953   set f77=f77
954   set f90=f90
955endif
956
957cd $model
958
959if $VPP then
960set make="gmake RANLIB=ls"
961else if $CRAY then
962set make="make RANLIB=ls"
963else if $NEC then
964set make="make RANLIB=ls"
965else if $LINUX then
966set make="make -k RANLIB=ranlib"
967else if $XNEC then
968set make="gmake RANLIB=ls"
969else if $X6NEC then
970set make="gmake RANLIB=ls"
971else if $X8BRODIE then
972set make="gmake RANLIB=ls"
973else
974set make="make RANLIB=ranlib"
975endif
976
977
978
979
980#
981# etat0_netcdf a besoin d'info de la physique
982# A revoir
983set include="$include"' -I$(LIBF)/phy'"$physique"
984#
985# le programme principal create_limit a besoin de l'info du module
986# startvar: on met donc libo dans les include pour Nec
987set include="$include"' -I$(LIBO)'
988
989
990#################################################################
991# Execution de la comande make... ENFIN!
992#################################################################
993
994if $VPP then
995  set optim90=" $optim90 -Am -M$libo"
996  set optimtru90="$optim90"
997 \cp $IOIPSLDIR/*.mod $libo
998else if $SUN then
999 set optim90=" $optim90 -M$libo -M$MODIPSLDIR "
1000 set optimtru90=" $optimtru90 -M$libo -M$MODIPSLDIR "
1001 set optim="$optim90"
1002 \cp $IOIPSLDIR/*.mod $libo
1003else if $NEC then
1004 set optim90=" $optim90 -I$libo "
1005else if $XNEC then
1006 set optim90=" $optim90 -I$libo "
1007 set optimtru90=" $optimtru90 -I$libo "
1008else if $X6NEC then
1009 set optim90=" $optim90 -I$libo "
1010 set optimtru90=" $optimtru90 -I$libo "
1011else if $X8BRODIE then
1012 set optim90=" $optim90 -I$libo "
1013 set optimtru90=" $optimtru90 -I$libo "
1014else if $LINUX then
1015 if ( $FC_LINUX == "pgf90" ) then
1016   set optimtru90=" $optimtru90 -module $libo "
1017   set optim90=" $optim90 -module $libo "
1018 else if ( $FC_LINUX == 'g95' ) then
1019   set optimtru90=" $optimtru90 -fmod=$libo  "
1020   set optim90=" $optim90 -fmod=$libo  "
1021 else if ( $FC_LINUX == 'gfortran' ) then
1022   set optimtru90=" $optimtru90 -M $libo  "
1023   set optim90=" $optim90 -M $libo  "
1024 endif
1025 set optim="$optim90"
1026 set mod_loc_dir=$libo
1027# \cp /d3/fairhead/sechiba/ioipsl/*.mod $libo
1028# \cp $IOIPSLDIR/*.mod $libo
1029endif
1030
1031set link="$f90 $optim90"
1032
1033set ar=ar
1034
1035if $XNEC then
1036  set link="sxld $opt_link"
1037  set link="$f90 "
1038#  set ar=sxar
1039else if $X6NEC then
1040  set link="sxld $opt_link"
1041  set link="$f90 -Wl,-hlib_cyclic "
1042else if $X8BRODIE then
1043  set link="sxld $opt_link"
1044  set link="$f90 -Wl,-hlib_cyclic "
1045endif
1046
1047
1048cd $localdir
1049
1050echo $make -f $LMDGCM/makefile \
1051OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
1052OPTIM90="$optim90" \
1053OPTIMTRU90="$optimtru90" \
1054OPTIM="$optim$optimbis" \
1055INCLUDE="$include" \
1056$filtre \
1057LIBO=$libo \
1058$dyn \
1059$phys \
1060DIM=$dimc \
1061FLAG_PARA="$FLAG_PARA"\
1062L_ADJNT="$adjnt" \
1063L_COSP="$lcosp" \
1064L_CHIMIE="$libchimie" \
1065LOCAL_DIR="$localdir"  \
1066F77="$f77" \
1067F90="$f90" \
1068OPLINK="$oplink" \
1069LINK="$link" \
1070GCM="$LMDGCM" \
1071MOD_LOC_DIR=$mod_loc_dir \
1072MOD_SUFFIX=$mod_suffix \
1073AR=$ar \
1074PROG=$code
1075
1076$make -f $LMDGCM/makefile \
1077OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
1078OPTIM90="$optim90" \
1079OPTIMTRU90="$optimtru90" \
1080OPTIM="$optim$optimbis" \
1081INCLUDE="$include" \
1082$filtre \
1083LIBO=$libo \
1084$dyn \
1085$phys \
1086DIM=$dimc \
1087FLAG_PARA="$FLAG_PARA"\
1088L_ADJNT="$adjnt" \
1089L_COSP="$lcosp" \
1090L_CHIMIE="$libchimie" \
1091LOCAL_DIR="$localdir"  \
1092F77="$f77" \
1093F90="$f90" \
1094OPLINK="$oplink" \
1095LINK="$link" \
1096GCM="$LMDGCM" \
1097MOD_LOC_DIR=$mod_loc_dir \
1098MOD_SUFFIX=$mod_suffix \
1099AR=$ar \
1100PROG=$code
1101
1102\rm -f $libf/grid/dimensions.h
Note: See TracBrowser for help on using the repository browser.