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