1 | #!/bin/bash |
---|
2 | # $Id: makelmdz_fcm 1615 2012-02-10 15:42:26Z emillour $ |
---|
3 | # This is a script in Bash. |
---|
4 | |
---|
5 | # FH : on ne crée plus le fichier arch.mk qui est supposé exister par |
---|
6 | # FH : ailleurs. |
---|
7 | # FH : ulterieurement, ce fichier sera pré-existant pour une série |
---|
8 | # FH : de configurations en versions optimisées et debug qui seront |
---|
9 | # FH : liés (ln -s) avec arch.mk en fonction de l'architecture. |
---|
10 | # FH : Pour le moment, cette version est en test et on peut créer les |
---|
11 | # FH : arch.mk en lançant une première fois makegcm. |
---|
12 | # |
---|
13 | ##set -x |
---|
14 | ######################################################################## |
---|
15 | # options par defaut pour la commande make |
---|
16 | ######################################################################## |
---|
17 | |
---|
18 | dim="96x72x19" |
---|
19 | physique=lmd |
---|
20 | filtre=filtrez |
---|
21 | grille=reg |
---|
22 | couple=false |
---|
23 | veget=false |
---|
24 | sisvat=false |
---|
25 | rrtm=false |
---|
26 | chimie=false |
---|
27 | chemistry=false |
---|
28 | parallel=none |
---|
29 | paramem="par" |
---|
30 | compil_mod=prod |
---|
31 | io=ioipsl |
---|
32 | LIBPREFIX="" |
---|
33 | cosp=false |
---|
34 | bands="" |
---|
35 | scatterers="" |
---|
36 | job=1 |
---|
37 | full='' |
---|
38 | |
---|
39 | LMDGCM=`/bin/pwd` |
---|
40 | LIBOGCM=$LMDGCM/libo |
---|
41 | LIBFGCM=$LMDGCM/libf |
---|
42 | # path for optional packages, but default set to ".void_dir" |
---|
43 | RRTM_PATH=$LMDGCM/.void_dir |
---|
44 | SISVAT_PATH=$LMDGCM/.void_dir |
---|
45 | COSP_PATH=$LMDGCM/.void_dir |
---|
46 | CHEM_PATH=$LMDGCM/.void_dir |
---|
47 | AERONO_PATH=$LMDGCM/.void_dir |
---|
48 | # Path to fcm utility: |
---|
49 | ##fcm_path=$LMDGCM/tools/fcm/bin |
---|
50 | fcm_path=$(dirname $(which fcm)) |
---|
51 | |
---|
52 | ######################################################################## |
---|
53 | # Quelques initialisations de variables du shell. |
---|
54 | ######################################################################## |
---|
55 | |
---|
56 | CPP_KEY="" |
---|
57 | INCLUDE="" |
---|
58 | LIB="" |
---|
59 | adjnt="" |
---|
60 | COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
61 | PARA_FFLAGS="" |
---|
62 | PARA_LD="" |
---|
63 | EXT_SRC="" |
---|
64 | |
---|
65 | ######################################################################## |
---|
66 | # lecture des options de mymake |
---|
67 | ######################################################################## |
---|
68 | |
---|
69 | while (($# > 0)) |
---|
70 | do |
---|
71 | case $1 in |
---|
72 | "-h") cat <<fin |
---|
73 | Usage : |
---|
74 | makegcm [options] -arch arch exec |
---|
75 | [-h] : brief help |
---|
76 | [-d [[IMx]JMx]LM] : IM, JM, LM are the dimensions in x, y, z (default: $dim) |
---|
77 | [-s nscat] : (Generic) Number of radiatively active scatterers |
---|
78 | [-b IRxVIS] : (Generic) Number of infrared (IR) and visible (VIS) bands for radiative transfer |
---|
79 | [-p PHYS] : set of physical parametrizations (in libf/phyPHYS), (default: lmd) |
---|
80 | [-prod / -dev / -debug] : compilation mode production (default) / developement / debug . |
---|
81 | [-c false/MPI1/OMCT] : coupling with ocean model : MPI1/OMCT/false (default: false) |
---|
82 | [-v false/orchidee2.0/orchidee1.9/true] : version of the vegetation model to include (default: false) |
---|
83 | false : no vegetation model |
---|
84 | orchidee2.0 : compile using ORCHIDEE 2.0 (or more recent version) |
---|
85 | orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
---|
86 | true : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6 |
---|
87 | [-chimie INCA/false] : (Earth) with INCA chemistry model or without (default: false) |
---|
88 | [-cosp cosp/false] : (Earth) add the cosp model (default: false) |
---|
89 | [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp |
---|
90 | [-g GRI] : grid configuration in dyn3d/GRI_xy.h (default: reg, inclues a zoom) |
---|
91 | [-io IO] : Input/Output library (default: ioipsl) |
---|
92 | [-include INCLUDES] : extra include path to add |
---|
93 | [-cpp CPP_KEY] : additional preprocessing definitions |
---|
94 | [-adjnt] : adjoint model, not operational ... |
---|
95 | [-mem] : reduced memory dynamics (if in parallel mode) |
---|
96 | [-filtre NOMFILTRE] : use filtre from libf/NOMFILTRE (default: filtrez) |
---|
97 | [-link LINKS] : additional links with other libraries |
---|
98 | [-j n] : active parallel compiling on ntask |
---|
99 | [-full] : full (re-)compilation (from scratch) |
---|
100 | [-fcm_path path] : path to the fcm tool (default: tools/fcm/bin) |
---|
101 | [-ext_src path] : path to an additional set of routines to compile with the model |
---|
102 | -arch arch : target architecture |
---|
103 | exec : executable to build |
---|
104 | fin |
---|
105 | exit;; |
---|
106 | |
---|
107 | "-d") |
---|
108 | dim=$2 ; shift ; shift ;; |
---|
109 | |
---|
110 | "-p") |
---|
111 | physique="$2" ; shift ; shift ;; |
---|
112 | |
---|
113 | "-s") |
---|
114 | scatterers=$2 ; shift ; shift ;; |
---|
115 | |
---|
116 | "-b") |
---|
117 | bands=$2 ; shift ; shift ;; |
---|
118 | |
---|
119 | "-g") |
---|
120 | grille="$2" ; shift ; shift ;; |
---|
121 | |
---|
122 | "-c") |
---|
123 | couple="$2" ; shift ; shift ;; |
---|
124 | |
---|
125 | "-prod") |
---|
126 | compil_mod="prod" ; shift ;; |
---|
127 | |
---|
128 | "-dev") |
---|
129 | compil_mod="dev" ; shift ;; |
---|
130 | |
---|
131 | "-debug") |
---|
132 | compil_mod="debug" ; shift ;; |
---|
133 | |
---|
134 | "-io") |
---|
135 | io="$2" ; shift ; shift ;; |
---|
136 | |
---|
137 | "-v") |
---|
138 | veget="$2" ; shift ; shift ;; |
---|
139 | |
---|
140 | "-sisvat") |
---|
141 | sisvat="$2" ; shift ; shift ;; |
---|
142 | |
---|
143 | "-rrtm") |
---|
144 | rrtm="$2" ; shift ; shift ;; |
---|
145 | |
---|
146 | "-chimie") |
---|
147 | chimie="$2" ; shift ; shift ;; |
---|
148 | |
---|
149 | "-parallel") |
---|
150 | parallel="$2" ; shift ; shift ;; |
---|
151 | |
---|
152 | "-include") |
---|
153 | INCLUDE="$INCLUDE -I$2" ; shift ; shift ;; |
---|
154 | |
---|
155 | "-cpp") |
---|
156 | CPP_KEY="$CPP_KEY $2" ; shift ; shift ;; |
---|
157 | |
---|
158 | "-adjnt") |
---|
159 | echo "not operational ... work to be done here ";exit |
---|
160 | opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d " |
---|
161 | optim="$optim -Dadj" ; shift ;; |
---|
162 | |
---|
163 | "-cosp") |
---|
164 | cosp="$2" ; shift ; shift ;; |
---|
165 | |
---|
166 | "-mem") |
---|
167 | paramem="mem" ; shift ;; |
---|
168 | |
---|
169 | "-filtre") |
---|
170 | filtre=$2 ; shift ; shift ;; |
---|
171 | |
---|
172 | "-link") |
---|
173 | LIB="$LIB $2" ; shift ; shift ;; |
---|
174 | |
---|
175 | "-fcm_path") |
---|
176 | fcm_path=$2 ; shift ; shift ;; |
---|
177 | |
---|
178 | "-ext_src") |
---|
179 | EXT_SRC=$2 ; shift ; shift ;; |
---|
180 | |
---|
181 | "-j") |
---|
182 | job=$2 ; shift ; shift ;; |
---|
183 | |
---|
184 | "-full") |
---|
185 | full="-full" ; shift ;; |
---|
186 | |
---|
187 | "-arch") |
---|
188 | arch=$2 ; shift ; shift ;; |
---|
189 | |
---|
190 | *) |
---|
191 | code="$1" ; shift ;; |
---|
192 | esac |
---|
193 | done |
---|
194 | |
---|
195 | ############################################################### |
---|
196 | # path to fcm |
---|
197 | ############################################################### |
---|
198 | # handle case when provided path to fcm was given as a relative |
---|
199 | # path (from makelmdz_fcm script directory) and not an absolute path |
---|
200 | if [[ ${fcm_path:0:1} != "/" ]] ; then |
---|
201 | # prepend with makelmdz_fcm location |
---|
202 | fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path} |
---|
203 | fi |
---|
204 | |
---|
205 | # add fcm_path to PATH |
---|
206 | export PATH=${fcm_path}:${PATH} |
---|
207 | |
---|
208 | echo "Path to fcm:" |
---|
209 | echo ${fcm_path} |
---|
210 | |
---|
211 | ############################################################### |
---|
212 | # lecture des chemins propres à l'architecture de la machine # |
---|
213 | ############################################################### |
---|
214 | rm -f .void_file |
---|
215 | echo > .void_file |
---|
216 | rm -rf .void_dir |
---|
217 | mkdir .void_dir |
---|
218 | rm -f arch.path |
---|
219 | ln -s arch/arch-${arch}.path ./arch.path |
---|
220 | source arch.path |
---|
221 | |
---|
222 | ######################################################################## |
---|
223 | # Definition des clefs CPP, des chemins des includes et modules |
---|
224 | # et des libraries |
---|
225 | ######################################################################## |
---|
226 | |
---|
227 | if [[ "$compil_mod" == "prod" ]] |
---|
228 | then |
---|
229 | COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
230 | elif [[ "$compil_mod" == "dev" ]] |
---|
231 | then |
---|
232 | COMPIL_FFLAGS="%DEV_FFLAGS" |
---|
233 | elif [[ "$compil_mod" == "debug" ]] |
---|
234 | then |
---|
235 | COMPIL_FFLAGS="%DEBUG_FFLAGS" |
---|
236 | fi |
---|
237 | |
---|
238 | if [[ "$physique" != "nophys" ]] |
---|
239 | then |
---|
240 | #We'll use some physics |
---|
241 | CPP_KEY="$CPP_KEY CPP_PHYS" |
---|
242 | if [[ "${physique:0:3}" == "lmd" ]] |
---|
243 | then |
---|
244 | #For lmd physics, default planet type is Earth |
---|
245 | CPP_KEY="$CPP_KEY CPP_EARTH" |
---|
246 | fi |
---|
247 | fi |
---|
248 | |
---|
249 | if [[ "$chimie" == "INCA" ]] |
---|
250 | then |
---|
251 | CPP_KEY="$CPP_KEY INCA" |
---|
252 | INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
---|
253 | LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
---|
254 | fi |
---|
255 | |
---|
256 | if [[ "$couple" != "false" ]] |
---|
257 | then |
---|
258 | if [[ "$couple" == "MPI1" ]] |
---|
259 | then |
---|
260 | CPP_KEY="$CPP_KEY CPP_COUPLE" |
---|
261 | export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1 |
---|
262 | export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib |
---|
263 | INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
---|
264 | LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io" |
---|
265 | else |
---|
266 | CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT" |
---|
267 | INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
---|
268 | LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu" |
---|
269 | fi |
---|
270 | fi |
---|
271 | |
---|
272 | if [[ "$parallel" == "mpi" ]] |
---|
273 | then |
---|
274 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI" |
---|
275 | PARA_FFLAGS="%MPI_FFLAGS" |
---|
276 | PARA_LD="%MPI_LD" |
---|
277 | elif [[ "$parallel" == "omp" ]] |
---|
278 | then |
---|
279 | CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP" |
---|
280 | PARA_FFLAGS="%OMP_FFLAGS" |
---|
281 | PARA_LD="%OMP_LD" |
---|
282 | elif [[ "$parallel" == "mpi_omp" ]] |
---|
283 | then |
---|
284 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP" |
---|
285 | PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS" |
---|
286 | PARA_LD="%MPI_LD %OMP_LD" |
---|
287 | fi |
---|
288 | |
---|
289 | if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \ |
---|
290 | && "$compil_mod" == "debug" ]] |
---|
291 | then |
---|
292 | echo "Usually, parallelization with OpenMP requires some optimization." |
---|
293 | echo "We suggest switching to \"-dev\"." |
---|
294 | fi |
---|
295 | |
---|
296 | if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ] |
---|
297 | then |
---|
298 | #NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6 |
---|
299 | # For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments |
---|
300 | # option orchidee1.9 : Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
---|
301 | INCLUDE="${INCLUDE} -I${ORCH_INCDIR}" |
---|
302 | CPP_KEY="$CPP_KEY CPP_VEGET" |
---|
303 | # temporary, for Orchidee versions 1.9.* (before openmp activation) |
---|
304 | if [[ "$veget" == "orchidee1.9" ]] ; then |
---|
305 | CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP" |
---|
306 | fi |
---|
307 | if [[ "$veget" == "orchidee2.0" ]] ; then |
---|
308 | orch_libs="sechiba parameters stomate parallel orglob orchidee" |
---|
309 | else |
---|
310 | orch_libs="sechiba parameters stomate parallel orglob" |
---|
311 | fi |
---|
312 | LIB="${LIB} -L${ORCH_LIBDIR}" |
---|
313 | for lib in ${orch_libs} ; do |
---|
314 | if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then |
---|
315 | LIB="${LIB} -l${LIBPREFIX}$lib " |
---|
316 | fi |
---|
317 | done |
---|
318 | elif [[ "$veget" != "false" ]] ; then |
---|
319 | echo "Option -v $veget does not exist" |
---|
320 | echo "Use ./makelmdz_fcm -h for more information" |
---|
321 | exit |
---|
322 | fi |
---|
323 | |
---|
324 | if [[ "$sisvat" == "true" ]] |
---|
325 | then |
---|
326 | CPP_KEY="$CPP_KEY CPP_SISVAT" |
---|
327 | SISVAT_PATH="$LIBFGCM/%PHYS/sisvat" |
---|
328 | #sed -e 's/^#src::sisvat/src::sisvat/' bld.cfg > bld.tmp |
---|
329 | #mv bld.tmp bld.cfg |
---|
330 | fi |
---|
331 | |
---|
332 | if [[ "$rrtm" == "true" ]] |
---|
333 | then |
---|
334 | CPP_KEY="$CPP_KEY CPP_RRTM" |
---|
335 | RRTM_PATH="$LIBFGCM/%PHYS/rrtm" |
---|
336 | #sed -e 's/^#src::rrtm/src::rrtm/' bld.cfg > bld.tmp |
---|
337 | #mv bld.tmp bld.cfg |
---|
338 | fi |
---|
339 | |
---|
340 | if [[ $io == ioipsl ]] |
---|
341 | then |
---|
342 | CPP_KEY="$CPP_KEY CPP_IOIPSL" |
---|
343 | INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}" |
---|
344 | LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl" |
---|
345 | elif [[ $io == xios ]] |
---|
346 | then |
---|
347 | # For now, xios implies also using ioipsl |
---|
348 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS" |
---|
349 | INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}" |
---|
350 | LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios" |
---|
351 | fi |
---|
352 | |
---|
353 | if [[ "$cosp" == "true" ]] |
---|
354 | then |
---|
355 | CPP_KEY="$CPP_KEY CPP_COSP" |
---|
356 | COSP_PATH="$LIBFGCM/cosp" |
---|
357 | # LIB="${LIB} -l${LIBPREFIX}cosp" |
---|
358 | fi |
---|
359 | |
---|
360 | if [[ "$physique" == "titan" ]] |
---|
361 | then |
---|
362 | CHEM_PATH="${LIBFGCM}/chim${physique}" |
---|
363 | INCLUDE="$INCLUDE -I${LIBFGCM}/chim${physique}" |
---|
364 | fi |
---|
365 | |
---|
366 | # for Mars (but could be used by others as well), there is also "aeronomars" |
---|
367 | if [[ -d ${LIBFGCM}/aerono${physique} ]] |
---|
368 | then |
---|
369 | AERONO_PATH="${LIBFGCM}/aerono${physique}" |
---|
370 | INCLUDE="$INCLUDE -I${LIBFGCM}/aerono${physique}" |
---|
371 | fi |
---|
372 | |
---|
373 | INCLUDE="$INCLUDE ${NETCDF_INCDIR}" |
---|
374 | LIB="$LIB ${NETCDF_LIBDIR}" |
---|
375 | |
---|
376 | ######################################################################## |
---|
377 | # calcul du nombre de dimensions |
---|
378 | ######################################################################## |
---|
379 | |
---|
380 | |
---|
381 | dim_full=$dim |
---|
382 | dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
383 | set $dim |
---|
384 | dimc=$# |
---|
385 | echo calcul de la dimension |
---|
386 | echo dim $dim |
---|
387 | echo dimc $dimc |
---|
388 | |
---|
389 | |
---|
390 | ######################################################################## |
---|
391 | # Gestion des dimensions du modele. |
---|
392 | # on cree ou remplace le fichier des dimensions |
---|
393 | ######################################################################## |
---|
394 | |
---|
395 | cd $LIBFGCM/grid |
---|
396 | if [[ -f dimensions.h ]] |
---|
397 | then |
---|
398 | echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs' |
---|
399 | echo "Attendez que la premiere compilation soit terminee pour relancer la suivante." |
---|
400 | echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs," |
---|
401 | echo vous pouvez continuer en repondant oui. |
---|
402 | echo "Voulez-vous vraiment continuer?" |
---|
403 | echo "" |
---|
404 | echo "WARNING: you are probably already compiling the model somewhere else." |
---|
405 | echo "Wait until the first compilation is finished before launching this one." |
---|
406 | echo "If you are sure that you are not compiling elsewhere, just answer " |
---|
407 | echo "yes (or 'oui') to the question below to proceed." |
---|
408 | echo "Do you wish to continue?" |
---|
409 | read reponse |
---|
410 | if [[ $reponse == "oui" || $reponse == "yes" ]] |
---|
411 | then |
---|
412 | \rm -f $LIBFGCM/grid/dimensions.h |
---|
413 | else |
---|
414 | exit |
---|
415 | fi |
---|
416 | fi |
---|
417 | |
---|
418 | |
---|
419 | cd $LIBFGCM/grid/dimension |
---|
420 | ./makdim $dim |
---|
421 | cat $LIBFGCM/grid/dimensions.h |
---|
422 | cd $LMDGCM |
---|
423 | |
---|
424 | if [[ "$bands" != "" ]] |
---|
425 | then |
---|
426 | # Generic model, recreate bands.h (IR & VIS bands for radiative transfer) |
---|
427 | bands=$(echo $bands | sed -e 's/[^0-9]/ /g') |
---|
428 | cd $LIBFGCM/phy$physique/bands |
---|
429 | ./makbands $bands |
---|
430 | cat $LIBFGCM/phy$physique/bands.h |
---|
431 | cd $LMDGCM |
---|
432 | fi |
---|
433 | |
---|
434 | if [[ "$scatterers" != "" ]] |
---|
435 | then |
---|
436 | # Generic model, recreate scatterers.h |
---|
437 | cd $LIBFGCM/phy$physique/scatterers |
---|
438 | ./make_scatterers $scatterers |
---|
439 | cat $LIBFGCM/phy$physique/scatterers.h |
---|
440 | cd $LMDGCM |
---|
441 | fi |
---|
442 | |
---|
443 | |
---|
444 | ######################################################################## |
---|
445 | # Differentes dynamiques (3d, 2d, 1d) |
---|
446 | ######################################################################## |
---|
447 | |
---|
448 | dimension=`echo $dim | wc -w` |
---|
449 | echo dimension $dimension |
---|
450 | |
---|
451 | if (( $dimension == 3 )) |
---|
452 | then |
---|
453 | cd $LIBFGCM/grid |
---|
454 | \rm fxyprim.h |
---|
455 | cp -p fxy_${grille}.h fxyprim.h |
---|
456 | #else |
---|
457 | # echo "Probleme dans les dimensions de la dynamique !!" |
---|
458 | # echo "Non reactive pour l'instant !!!" |
---|
459 | fi |
---|
460 | |
---|
461 | if (( $dimension == 1 )) |
---|
462 | then |
---|
463 | ##in 1D, add dyn3d to include path (because main prog is in physics) |
---|
464 | INCLUDE="$INCLUDE -Ilibf/dyn3d" |
---|
465 | # echo pas de dynamique |
---|
466 | # dyn="DYN= L_DYN=-ldyn3d " |
---|
467 | fi |
---|
468 | |
---|
469 | ###################################################################### |
---|
470 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
471 | # ---> YM desactive pour le traitemement en parallele |
---|
472 | ###################################################################### |
---|
473 | |
---|
474 | #if [[ -f $libf/phy$physique/raddim.h ]] |
---|
475 | #then |
---|
476 | # if [[ -f $libf/phy$physique/raddim.$dimh.h ]] |
---|
477 | #then |
---|
478 | # \rm -f $libf/phy$physique/raddim.h |
---|
479 | # cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
480 | # echo $libf/phy$physique/raddim.$dimh.h |
---|
481 | # cat $libf/phy$physique/raddim.h |
---|
482 | # else |
---|
483 | # echo On peut diminuer la taille de l executable en creant |
---|
484 | # echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
485 | # \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
486 | # fi |
---|
487 | #fi |
---|
488 | |
---|
489 | ###################################################################### |
---|
490 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
491 | ###################################################################### |
---|
492 | |
---|
493 | if (( `expr $dimc \> 2` == 1 )) |
---|
494 | then |
---|
495 | filtre="FILTRE=$filtre" |
---|
496 | else |
---|
497 | filtre="FILTRE= L_FILTRE= " |
---|
498 | fi |
---|
499 | echo MACRO FILTRE $filtre |
---|
500 | |
---|
501 | echo $dimc |
---|
502 | |
---|
503 | |
---|
504 | |
---|
505 | ###################################################################### |
---|
506 | # Creation du suffixe de la configuration |
---|
507 | ###################################################################### |
---|
508 | |
---|
509 | |
---|
510 | SUFF_NAME=_${dim_full} |
---|
511 | SUFF_NAME=${SUFF_NAME}_phy${physique} |
---|
512 | |
---|
513 | if [[ "$parallel" != "none" ]] |
---|
514 | then |
---|
515 | SUFF_NAME=${SUFF_NAME}_para |
---|
516 | DYN=dyn${dimc}d${paramem} |
---|
517 | if [[ "$paramem" == "mem" ]] |
---|
518 | then |
---|
519 | SUFF_NAME=${SUFF_NAME}_${paramem} |
---|
520 | fi |
---|
521 | else |
---|
522 | SUFF_NAME=${SUFF_NAME}_seq |
---|
523 | DYN=dyn${dimc}d |
---|
524 | ## specific stuff for 1D model (needs includes which are in dyn3d) |
---|
525 | if (( $dimension == 1 )) ; then |
---|
526 | SUFF_NAME=${SUFF_NAME} |
---|
527 | DYN=dyn3d |
---|
528 | fi |
---|
529 | fi |
---|
530 | |
---|
531 | if [[ $veget != "false" ]] |
---|
532 | then |
---|
533 | SUFF_NAME=${SUFF_NAME}_orch |
---|
534 | fi |
---|
535 | |
---|
536 | if [[ $couple != "false" ]] |
---|
537 | then |
---|
538 | SUFF_NAME=${SUFF_NAME}_couple |
---|
539 | fi |
---|
540 | |
---|
541 | if [[ $chimie == "INCA" ]] |
---|
542 | then |
---|
543 | SUFF_NAME=${SUFF_NAME}_inca |
---|
544 | fi |
---|
545 | |
---|
546 | cd $LMDGCM |
---|
547 | config_fcm="config.fcm" |
---|
548 | rm -f $config_fcm |
---|
549 | touch $config_fcm |
---|
550 | rm -f bin/${code}${SUFF_NAME}.e |
---|
551 | rm -f arch.fcm |
---|
552 | rm -f arch.opt |
---|
553 | |
---|
554 | echo "%ARCH $arch" >> $config_fcm |
---|
555 | echo "%INCDIR $INCLUDE" >> $config_fcm |
---|
556 | echo "%LIB $LIB" >> $config_fcm |
---|
557 | echo "%ROOT_PATH $PWD" >> $config_fcm |
---|
558 | echo "%LIBF $LIBFGCM" >> $config_fcm |
---|
559 | echo "%LIBO $LIBOGCM" >> $config_fcm |
---|
560 | echo "%DYN $DYN" >> $config_fcm |
---|
561 | echo "%PHYS phy${physique}" >> $config_fcm |
---|
562 | echo "%RRTM $RRTM_PATH" >> $config_fcm |
---|
563 | echo "%SISVAT $SISVAT_PATH" >> $config_fcm |
---|
564 | echo "%COSP $COSP_PATH" >> $config_fcm |
---|
565 | echo "%CHEM $CHEM_PATH" >> $config_fcm |
---|
566 | echo "%AERONO $AERONO_PATH" >> $config_fcm |
---|
567 | echo "%CPP_KEY $CPP_KEY" >> $config_fcm |
---|
568 | echo "%EXEC $code" >> $config_fcm |
---|
569 | echo "%SUFF_NAME $SUFF_NAME" >> $config_fcm |
---|
570 | echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm |
---|
571 | echo "%PARA_FFLAGS $PARA_FFLAGS" >> $config_fcm |
---|
572 | echo "%PARA_LD $PARA_LD" >> $config_fcm |
---|
573 | echo "%EXT_SRC $EXT_SRC" >> $config_fcm |
---|
574 | |
---|
575 | |
---|
576 | |
---|
577 | ln -s arch/arch-${arch}.fcm arch.fcm |
---|
578 | if test -f arch/arch-${arch}.opt && [ $compil_mod = "prod" ] |
---|
579 | then |
---|
580 | ln -s arch/arch-${arch}.opt arch.opt |
---|
581 | else |
---|
582 | ln -s .void_file arch.opt |
---|
583 | fi |
---|
584 | |
---|
585 | |
---|
586 | rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock |
---|
587 | ./build_gcm ${fcm_path} -j $job $full |
---|
588 | |
---|
589 | rm -rf tmp_src |
---|
590 | rm -rf config |
---|
591 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config |
---|
592 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/tmp tmp_src |
---|
593 | |
---|
594 | #eventual cleanup for SISVAT |
---|
595 | #sed -e 's/^src::sisvat/#src::sisvat/' bld.cfg > bld.tmp |
---|
596 | #mv bld.tmp bld.cfg |
---|
597 | |
---|
598 | #eventual cleanup for RRTM |
---|
599 | #sed -e 's/^src::rrtm/#src::rrtm/' bld.cfg > bld.tmp |
---|
600 | #mv bld.tmp bld.cfg |
---|
601 | |
---|
602 | |
---|
603 | if [[ -r $LIBFGCM/grid/dimensions.h ]] |
---|
604 | then |
---|
605 | # Cleanup: remove dimension.h file |
---|
606 | \rm -f $LIBFGCM/grid/dimensions.h |
---|
607 | fi |
---|