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