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