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