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