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