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