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