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