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