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