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