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