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