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_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 | -s nscat Number of radiatively active scatterers |
---|
295 | |
---|
296 | -p PHYS Selects the set of physical parameterizations |
---|
297 | you want to compile the model with. |
---|
298 | The model is then compiled using the physical |
---|
299 | parameterization sources in directory: |
---|
300 | $LMDGCM/libf/phyPHYS |
---|
301 | |
---|
302 | -g grille Selects the grid type. |
---|
303 | This option overwrites file |
---|
304 | $LMDGCM/libf/grid/fxyprim.h |
---|
305 | with file |
---|
306 | $LMDGCM/libf/grid/fxy_grille.h |
---|
307 | the grid can take the following values: |
---|
308 | 1. reg - the regular grid |
---|
309 | 2. sin - to obtain equidistant points in terms of sin(latitude) |
---|
310 | 3. new - to zoom into a part of the globe |
---|
311 | |
---|
312 | -O "compilation options" set of fortran compilation options to use |
---|
313 | |
---|
314 | -include path |
---|
315 | Used if the subroutines contain #include files (ccp) that |
---|
316 | are located in directories that are not referenced by default. |
---|
317 | |
---|
318 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
319 | |
---|
320 | -olddyn To compile GCM with "old dynamics" |
---|
321 | |
---|
322 | -filtre filter |
---|
323 | To select the longitudinal filter in the polar regions. |
---|
324 | "filter" corresponds to the name of a directory located in |
---|
325 | $LMDGCM/libf. The standard filter for the model is "filtrez" |
---|
326 | which can be used for a regular grid and for a |
---|
327 | grid with longitudinal zoom. |
---|
328 | |
---|
329 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
330 | Adds a link to FORTRAN libraries |
---|
331 | libfile1.a, libfile2.a ... |
---|
332 | located in directories dir1, dir2 ...respectively |
---|
333 | If dirn is a directory with an automatic path |
---|
334 | (/usr/lib ... for example) |
---|
335 | there is no need to specify -Ldirn. |
---|
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 -s |
---|
354 | set scatterers="$2" ; shift ; goto top |
---|
355 | |
---|
356 | case -g |
---|
357 | set grille="$2" ; shift ; shift ; goto top |
---|
358 | |
---|
359 | case -t |
---|
360 | set ntrac=$2 ; shift ; shift ; goto top |
---|
361 | |
---|
362 | case -include |
---|
363 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
364 | |
---|
365 | case -adjnt |
---|
366 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
367 | |
---|
368 | case -olddyn |
---|
369 | set dyntype="olddyn" ; 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}_s${scatterers}_${grille}_olddyn |
---|
469 | else |
---|
470 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${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 | #remove old scatterers.h file |
---|
526 | \rm -f $libf/phymars/scatterers.h |
---|
527 | else |
---|
528 | exit |
---|
529 | endif |
---|
530 | endif |
---|
531 | |
---|
532 | # Build the appropriate 'dimensions.h' file |
---|
533 | cd dimension |
---|
534 | ./makdim $ntrac $dim |
---|
535 | # echo contents of dimensions.h to standard output |
---|
536 | cat $libf/grid/dimensions.h |
---|
537 | |
---|
538 | cd $libf/phymars/scatterers |
---|
539 | # Build the appropriate 'scatterers.h' file |
---|
540 | ./make_scatterers $scatterers |
---|
541 | # echo contents of scatterers.h to standard output |
---|
542 | cat $libf/phymars/scatterers.h |
---|
543 | |
---|
544 | cd $LMDGCM |
---|
545 | # set path to objects directory |
---|
546 | set libo=$libo/$nomlib |
---|
547 | # create objects directory, if it doesn't exist |
---|
548 | if ( ! -d $libo ) then |
---|
549 | mkdir $libo |
---|
550 | cd $model |
---|
551 | endif |
---|
552 | |
---|
553 | ######################################################################## |
---|
554 | # Differentes dynamiques (3d, 2d, 1d) |
---|
555 | ######################################################################## |
---|
556 | |
---|
557 | set dimension=`echo $dim | wc -w` |
---|
558 | echo dimension $dimension dim $dim |
---|
559 | if ( $dimension == 1 ) then |
---|
560 | echo pas de dynamique |
---|
561 | set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
562 | endif |
---|
563 | endif |
---|
564 | |
---|
565 | cd $model |
---|
566 | if ( $dimension == 3 ) then |
---|
567 | cd libf/grid |
---|
568 | \rm fxyprim.h |
---|
569 | cp -p fxy_${grille}.h fxyprim.h |
---|
570 | endif |
---|
571 | |
---|
572 | ###################################################################### |
---|
573 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
574 | ###################################################################### |
---|
575 | |
---|
576 | if ( -f $libf/phy$physique/raddim.h ) then |
---|
577 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
---|
578 | \rm $libf/phy$physique/raddim.h |
---|
579 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
580 | echo $libf/phy$physique/raddim.$dimh.h |
---|
581 | cat $libf/phy$physique/raddim.$dimh.h |
---|
582 | cat $libf/phy$physique/raddim.h |
---|
583 | else |
---|
584 | echo On peut diminuer la taille de l executable en creant |
---|
585 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
586 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
587 | endif |
---|
588 | endif |
---|
589 | |
---|
590 | ###################################################################### |
---|
591 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
592 | ###################################################################### |
---|
593 | |
---|
594 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
595 | if ( "$dyntype" == "olddyn" ) then |
---|
596 | set filtre="oldfiltrez" |
---|
597 | endif |
---|
598 | |
---|
599 | if ( `expr $dimc \> 2` == 1 ) then |
---|
600 | set filtre="FILTRE=$filtre" |
---|
601 | else |
---|
602 | set filtre="FILTRE= L_FILTRE= " |
---|
603 | endif |
---|
604 | echo "MACRO FILTRE $filtre" |
---|
605 | |
---|
606 | echo "dimc $dimc" |
---|
607 | |
---|
608 | ######################################################################## |
---|
609 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
610 | ######################################################################## |
---|
611 | # c'est a dire dans 3 cas: |
---|
612 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
613 | # derniere creation du makefile |
---|
614 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
615 | # n'existe pas. |
---|
616 | # 3. Si le makefile n'existe pas. |
---|
617 | ######################################################################## |
---|
618 | |
---|
619 | cd $model |
---|
620 | find libf -name '*.[Fh]' -print >! tmp77 |
---|
621 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
622 | find libf -name '*.[Fh]90' -print >> tmp90 |
---|
623 | |
---|
624 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
625 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
626 | || ! -f makefile \ |
---|
627 | || ! -f liste_des_sources_f90 \ |
---|
628 | || ! -f liste_des_sources_f77 ) then |
---|
629 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
630 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
631 | diff liste_des_sources_f77 tmp77 |
---|
632 | diff liste_des_sources_f90 tmp90 |
---|
633 | \cp tmp77 liste_des_sources_f77 |
---|
634 | \cp tmp90 liste_des_sources_f90 |
---|
635 | echo "On recree le makefile" |
---|
636 | if ("$dyntype" == "olddyn") then |
---|
637 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
638 | else |
---|
639 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
640 | endif |
---|
641 | \mv tmp makefile |
---|
642 | echo "Nouveau makefile cree." |
---|
643 | endif |
---|
644 | |
---|
645 | ######################################################################## |
---|
646 | # Execution de la comande make |
---|
647 | ######################################################################## |
---|
648 | |
---|
649 | echo PHYSIQUE $phys |
---|
650 | echo dynamique $dyn $dimension |
---|
651 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
652 | echo PATH pour les fichiers INCLUDE $include |
---|
653 | echo OPLINK="$oplink" |
---|
654 | |
---|
655 | if $HP then |
---|
656 | set f77='fort77 +OP' |
---|
657 | set f90='jensaisrien' |
---|
658 | set opt_link="$opt_link -lm" |
---|
659 | else if $VPP then |
---|
660 | set f77=frt |
---|
661 | set f90=$f77 |
---|
662 | else if $CRAY then |
---|
663 | set f77=f90 |
---|
664 | set f90=f90 |
---|
665 | else if $LINUX then |
---|
666 | set f77=pgf95 |
---|
667 | set f90=pgf95 |
---|
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 | set optim="$optim -module $libo" |
---|
719 | set optim90="$optim90 -module $libo" |
---|
720 | set optimtru90="$optimtru90 -module $libo" |
---|
721 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
722 | # set mod_loc_dir=$libo |
---|
723 | endif |
---|
724 | |
---|
725 | set link="$f90 $optim90" |
---|
726 | |
---|
727 | set ar=ar |
---|
728 | |
---|
729 | if $XNEC then |
---|
730 | set link="sxld $opt_link" |
---|
731 | set link="$f90 " |
---|
732 | # set ar=sxar |
---|
733 | endif |
---|
734 | |
---|
735 | |
---|
736 | cd $localdir |
---|
737 | |
---|
738 | ## locate main program (could be in dyn3d or phy$physique |
---|
739 | ## and could be .F or .F90) |
---|
740 | set source_code=${code}.F |
---|
741 | if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then |
---|
742 | set source_code=${code}.F90 |
---|
743 | endif |
---|
744 | if ( -f $LMDGCM/libf/phy${physique}/${code}.F ) then |
---|
745 | set source_code=${code}.F |
---|
746 | endif |
---|
747 | if ( -f $LMDGCM/libf/phy${physique}/${code}.F90 ) then |
---|
748 | set source_code=${code}.F90 |
---|
749 | endif |
---|
750 | |
---|
751 | ## locate directory where main program is located |
---|
752 | if ( $dimension == 3 ) then |
---|
753 | if ( -f $LMDGCM/libf/dyn3d/${source_code} ) then |
---|
754 | set dyn="DIRMAIN=dyn3d " |
---|
755 | endif |
---|
756 | if ( -f $LMDGCM/libf/phy${physique}/${source_code} ) then |
---|
757 | set dyn="DIRMAIN=phy${physique} " |
---|
758 | endif |
---|
759 | endif |
---|
760 | |
---|
761 | echo $make -f $LMDGCM/makefile \ |
---|
762 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
763 | OPTIM="$optim" \ |
---|
764 | OPTIM90="$optim90" \ |
---|
765 | OPTIMTRU90="$optimtru90" \ |
---|
766 | INCLUDE="$include" \ |
---|
767 | $filtre \ |
---|
768 | LIBO=$libo \ |
---|
769 | $dyn \ |
---|
770 | $phys \ |
---|
771 | DIM=$dimc \ |
---|
772 | DYNTYPE="$dyntype" \ |
---|
773 | L_ADJNT="$adjnt" \ |
---|
774 | LOCAL_DIR="$localdir" \ |
---|
775 | F77="$f77" \ |
---|
776 | F90="$f90" \ |
---|
777 | OPLINK="$oplink" \ |
---|
778 | LINK="$link" \ |
---|
779 | GCM="$LMDGCM" \ |
---|
780 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
781 | MOD_SUFFIX=$mod_suffix \ |
---|
782 | AR=$ar \ |
---|
783 | SOURCE=$source_code \ |
---|
784 | PROG=$code |
---|
785 | |
---|
786 | |
---|
787 | $make -f $LMDGCM/makefile \ |
---|
788 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
789 | OPTIM="$optim" \ |
---|
790 | OPTIM90="$optim90" \ |
---|
791 | OPTIMTRU90="$optimtru90" \ |
---|
792 | INCLUDE="$include" \ |
---|
793 | $filtre \ |
---|
794 | LIBO=$libo \ |
---|
795 | $dyn \ |
---|
796 | $phys \ |
---|
797 | DIM=$dimc \ |
---|
798 | DYNTYPE="$dyntype" \ |
---|
799 | L_ADJNT="$adjnt" \ |
---|
800 | LOCAL_DIR="$localdir" \ |
---|
801 | F77="$f77" \ |
---|
802 | F90="$f90" \ |
---|
803 | OPLINK="$oplink" \ |
---|
804 | LINK="$link" \ |
---|
805 | GCM="$LMDGCM" \ |
---|
806 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
807 | MOD_SUFFIX=$mod_suffix \ |
---|
808 | AR=$ar \ |
---|
809 | SOURCE=$source_code \ |
---|
810 | PROG=$code |
---|
811 | |
---|
812 | # cleanup, remove dimensions.h and scatterers.h |
---|
813 | \rm -f $libf/grid/dimensions.h |
---|
814 | \rm -f $libf/phymars/scatterers.h |
---|