| 1 | #!/bin/bash |
|---|
| 2 | # $Id: makelmdz_fcm 6030 2026-01-15 14:28:12Z snguyen $ |
|---|
| 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 | # AI : on n'utilise plus qu'un seul bld.cfg |
|---|
| 14 | # AI cas rad(rrtm,ecrad,..)/cosp(v1,v2) geres dans makelmdz_fcm |
|---|
| 15 | ##set -x |
|---|
| 16 | set -e |
|---|
| 17 | ######################################################################## |
|---|
| 18 | # options par defaut pour la commande make |
|---|
| 19 | ######################################################################## |
|---|
| 20 | |
|---|
| 21 | dim="96x72x19" |
|---|
| 22 | physique=lmd |
|---|
| 23 | filtre=filtrez |
|---|
| 24 | couple=false |
|---|
| 25 | veget=false |
|---|
| 26 | inlandsis=false |
|---|
| 27 | rrtm=false |
|---|
| 28 | rad="oldrad" |
|---|
| 29 | dust=false |
|---|
| 30 | strataer=false |
|---|
| 31 | chimie=false |
|---|
| 32 | parallel=none |
|---|
| 33 | paramem="mem" |
|---|
| 34 | compil_mod=prod |
|---|
| 35 | io=ioipsl |
|---|
| 36 | LIBPREFIX="" |
|---|
| 37 | cosp=false |
|---|
| 38 | cosp2=false |
|---|
| 39 | cospv2=false |
|---|
| 40 | job=1 |
|---|
| 41 | full='' |
|---|
| 42 | libphy=false |
|---|
| 43 | isotopes=false |
|---|
| 44 | isoverif=false |
|---|
| 45 | diagiso=false |
|---|
| 46 | isotrac=false |
|---|
| 47 | force_compile=false |
|---|
| 48 | cplocninca=false |
|---|
| 49 | |
|---|
| 50 | arch_defined="FALSE" |
|---|
| 51 | arch_path="arch" |
|---|
| 52 | arch_default_path="arch" |
|---|
| 53 | |
|---|
| 54 | LMDGCM=`/bin/pwd` |
|---|
| 55 | LIBOGCM=$LMDGCM/libo |
|---|
| 56 | LIBFGCM=$LMDGCM/libf |
|---|
| 57 | DYN_COMMON_PATH=$LIBFGCM/dyn3d_common |
|---|
| 58 | GRID_PATH=$LIBFGCM/grid |
|---|
| 59 | # path for optional packages, but default set to ".void_dir" |
|---|
| 60 | FILTRE_PATH=$LMDGCM/.void_dir |
|---|
| 61 | DYN_PHYS_PATH=$LMDGCM/.void_dir |
|---|
| 62 | DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir |
|---|
| 63 | PHY_COMMON_PATH=$LMDGCM/.void_dir |
|---|
| 64 | RAD_PATH=$LMDGCM/.void_dir |
|---|
| 65 | INLANDSIS_PATH=$LMDGCM/.void_dir |
|---|
| 66 | DUST_PATH=$LMDGCM/.void_dir |
|---|
| 67 | STRATAER_PATH=$LMDGCM/.void_dir |
|---|
| 68 | COSP_PATH=$LMDGCM/.void_dir |
|---|
| 69 | fcm_path=$LMDGCM/tools/fcm/bin |
|---|
| 70 | |
|---|
| 71 | ######################################################################## |
|---|
| 72 | # Quelques initialisations de variables du shell. |
|---|
| 73 | ######################################################################## |
|---|
| 74 | |
|---|
| 75 | CPP_KEY="IN_LMDZ" |
|---|
| 76 | INCLUDE="" |
|---|
| 77 | LIB="" |
|---|
| 78 | adjnt="" |
|---|
| 79 | COMPIL_FFLAGS="%PROD_FFLAGS" |
|---|
| 80 | PARA_FFLAGS="" |
|---|
| 81 | PARA_LD="" |
|---|
| 82 | EXT_SRC="" |
|---|
| 83 | |
|---|
| 84 | ######################################################################## |
|---|
| 85 | # lecture des options de mymake |
|---|
| 86 | ######################################################################## |
|---|
| 87 | |
|---|
| 88 | while (($# > 0)) |
|---|
| 89 | do |
|---|
| 90 | case $1 in |
|---|
| 91 | "-h") cat <<fin |
|---|
| 92 | Usage : |
|---|
| 93 | makelmdz_fcm [options] -arch nom_arch exec |
|---|
| 94 | [-h] : brief help |
|---|
| 95 | [-d [[IMx]JMx]LM] : IM, JM, LM are the dimensions in x, y, z (default: $dim) |
|---|
| 96 | [-p PHYS] : set of physical parametrizations (in libf/phyPHYS), (default: lmd) |
|---|
| 97 | [-prod / -dev / -debug] : compilation mode production (default) / developement / debug |
|---|
| 98 | [-c false/MPI1/OMCT] : coupling with ocean model : MPI1/OMCT/false (default: false) |
|---|
| 99 | [-v false/orchideetrunk/orchidee2.1/orchidee2.0/orchidee1.9] : version of the vegetation model to include (default: false) |
|---|
| 100 | false : no vegetation model |
|---|
| 101 | orchideetrunk : compile using ORCHIDEE trunk from revision 7757 or higher |
|---|
| 102 | orchidee2.1 : compile using ORCHIDEE 2.1 until 4.1 included or until revision 7757 on the trunk |
|---|
| 103 | orchidee2.2 : compile using ORCHIDEE 2.2 |
|---|
| 104 | orchidee2.0 : compile using ORCHIDEE 2.0 |
|---|
| 105 | orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
|---|
| 106 | true : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6 |
|---|
| 107 | [-chimie INCA/false] : with INCA chemistry model or without (default: false) |
|---|
| 108 | [-cplocninca ] : allow transfer of species from PISCES to INCA (default: false) |
|---|
| 109 | [-cosp true/false] : compile with/without cosp package (default: false) |
|---|
| 110 | [-cosp2 true/false] : compile with/without cosp2 package (default: false) |
|---|
| 111 | [-cospv2 true/false] : compile with/without cospv2 package (default: false) |
|---|
| 112 | [-inlandsis true/false] : compile with/without inlandsis package (default: false) |
|---|
| 113 | [-rrtm true/false] : compile with/without rrtm package (default: false) |
|---|
| 114 | [-rad oldrad/rrtm/ecrad/ecrad-acc] : compile with oldrad/rrtm/ecrad radiatif code (default: oldrad) |
|---|
| 115 | [-dust true/false] : compile with/without the dust package by Boucher and co (default: false) |
|---|
| 116 | [-strataer true/false] : compile with/without the strat aer package by Boucher and co (default: false) |
|---|
| 117 | [-isotopes true/false] : compile with/without water isotopes in the physics |
|---|
| 118 | [-isoverif true/false] : compile with/without verifications for water isotopes in the physics |
|---|
| 119 | [-diagiso true/false] : compile with/without special diagnostics for water isotopes in the physics |
|---|
| 120 | [-isotrac true/false] : compile with/without tracers of water isotopes in the physics |
|---|
| 121 | [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp |
|---|
| 122 | [-io ioipsl/mix/xios] : Input/Output library (default: ioipsl) |
|---|
| 123 | [-include INCLUDES] : extra include path to add |
|---|
| 124 | [-cpp CPP_KEY] : additional preprocessing definitions |
|---|
| 125 | [-adjnt] : adjoint model, not operational ... |
|---|
| 126 | [-mem] : reduced memory dynamics (obsolete flag; always on in parallel mode) |
|---|
| 127 | [-filtre NOMFILTRE] : use filtre from libf/NOMFILTRE (default: filtrez) |
|---|
| 128 | [-link LINKS] : additional links with other libraries |
|---|
| 129 | [-j n] : active parallel compiling on ntask |
|---|
| 130 | [-full] : full recompiling |
|---|
| 131 | [-libphy] : only compile physics package (no dynamics or main program) |
|---|
| 132 | [-fcm_path path] : path to the fcm tool (default: tools/fcm/bin) |
|---|
| 133 | [-ext_src path] : path to an additional set of routines to compile with the model |
|---|
| 134 | [-arch_path path] : path to architecture files (default: $arch_default_path) |
|---|
| 135 | [-force_compile] : recompile although there seems to be an on-going compilation |
|---|
| 136 | -arch nom_arch : target architecture |
|---|
| 137 | exec : executable to build |
|---|
| 138 | fin |
|---|
| 139 | exit;; |
|---|
| 140 | |
|---|
| 141 | "-d") |
|---|
| 142 | dim=$2 ; shift ; shift ;; |
|---|
| 143 | |
|---|
| 144 | "-p") |
|---|
| 145 | physique="$2" ; shift ; shift ;; |
|---|
| 146 | |
|---|
| 147 | "-c") |
|---|
| 148 | couple="$2" ; shift ; shift ;; |
|---|
| 149 | |
|---|
| 150 | "-prod") |
|---|
| 151 | compil_mod="prod" ; shift ;; |
|---|
| 152 | |
|---|
| 153 | "-dev") |
|---|
| 154 | compil_mod="dev" ; shift ;; |
|---|
| 155 | |
|---|
| 156 | "-debug") |
|---|
| 157 | compil_mod="debug" ; shift ;; |
|---|
| 158 | |
|---|
| 159 | "-io") |
|---|
| 160 | io="$2" ; shift ; shift ;; |
|---|
| 161 | |
|---|
| 162 | "-v") |
|---|
| 163 | veget="$2" ; shift ; shift ;; |
|---|
| 164 | |
|---|
| 165 | "-inlandsis") |
|---|
| 166 | inlandsis="$2" ; shift ; shift ;; |
|---|
| 167 | |
|---|
| 168 | "-rrtm") |
|---|
| 169 | rrtm="$2" ; if [ "$2" = "false" ] ; then rad="oldrad" ; else rad="rrtm" ; fi ; shift ; shift ;; |
|---|
| 170 | |
|---|
| 171 | "-rad") |
|---|
| 172 | rad="$2" ; shift ; shift ;; |
|---|
| 173 | |
|---|
| 174 | "-dust") |
|---|
| 175 | dust="$2" ; shift ; shift ;; |
|---|
| 176 | |
|---|
| 177 | "-strataer") |
|---|
| 178 | strataer="$2" ; shift ; shift ;; |
|---|
| 179 | |
|---|
| 180 | "-chimie") |
|---|
| 181 | chimie="$2" ; shift ; shift ;; |
|---|
| 182 | |
|---|
| 183 | "-cplocninca") |
|---|
| 184 | cplocninca=TRUE ; shift ;; |
|---|
| 185 | |
|---|
| 186 | "-isotopes") |
|---|
| 187 | isotopes="$2" ; shift ; shift ;; |
|---|
| 188 | |
|---|
| 189 | "-isoverif") |
|---|
| 190 | isoverif="$2" ; shift ; shift ;; |
|---|
| 191 | |
|---|
| 192 | "-diagiso") |
|---|
| 193 | diagiso="$2" ; shift ; shift ;; |
|---|
| 194 | |
|---|
| 195 | "-isotrac") |
|---|
| 196 | isotrac="$2" ; shift ; shift ;; |
|---|
| 197 | |
|---|
| 198 | "-parallel") |
|---|
| 199 | parallel="$2" ; shift ; shift ;; |
|---|
| 200 | |
|---|
| 201 | "-include") |
|---|
| 202 | INCLUDE="$INCLUDE -I$2" ; shift ; shift ;; |
|---|
| 203 | |
|---|
| 204 | "-cpp") |
|---|
| 205 | CPP_KEY="$CPP_KEY $2" ; shift ; shift ;; |
|---|
| 206 | |
|---|
| 207 | "-adjnt") |
|---|
| 208 | echo "not operational ... work to be done here ";exit |
|---|
| 209 | opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d " |
|---|
| 210 | optim="$optim -Dadj" ; shift ;; |
|---|
| 211 | |
|---|
| 212 | "-cosp") |
|---|
| 213 | cosp="$2" ; shift ; shift ;; |
|---|
| 214 | |
|---|
| 215 | "-cosp2") |
|---|
| 216 | cosp2="$2" ; shift ; shift ;; |
|---|
| 217 | |
|---|
| 218 | "-cospv2") |
|---|
| 219 | cospv2="$2" ; shift ; shift ;; |
|---|
| 220 | |
|---|
| 221 | "-mem") |
|---|
| 222 | echo "option -mem is obsolete (now always on in parallel)" |
|---|
| 223 | paramem="mem" ; shift ;; |
|---|
| 224 | |
|---|
| 225 | "-filtre") |
|---|
| 226 | filtre=$2 ; shift ; shift ;; |
|---|
| 227 | |
|---|
| 228 | "-link") |
|---|
| 229 | LIB="$LIB $2" ; shift ; shift ;; |
|---|
| 230 | |
|---|
| 231 | "-fcm_path") |
|---|
| 232 | fcm_path=$2 ; shift ; shift ;; |
|---|
| 233 | |
|---|
| 234 | "-ext_src") |
|---|
| 235 | EXT_SRC=$2 ; shift ; shift ;; |
|---|
| 236 | |
|---|
| 237 | "-j") |
|---|
| 238 | job=$2 ; shift ; shift ;; |
|---|
| 239 | |
|---|
| 240 | "-full") |
|---|
| 241 | full="-full" ; shift ;; |
|---|
| 242 | |
|---|
| 243 | "-libphy") |
|---|
| 244 | libphy="true" ; shift ;; |
|---|
| 245 | |
|---|
| 246 | "-arch") |
|---|
| 247 | arch=$2 ; arch_defined="TRUE" ; shift ; shift ;; |
|---|
| 248 | |
|---|
| 249 | "-arch_path") |
|---|
| 250 | arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;; |
|---|
| 251 | |
|---|
| 252 | "-force_compile") |
|---|
| 253 | force_compile=true ; shift ;; |
|---|
| 254 | |
|---|
| 255 | *) |
|---|
| 256 | code="$1" ; shift ;; |
|---|
| 257 | esac |
|---|
| 258 | done |
|---|
| 259 | |
|---|
| 260 | ############################################################### |
|---|
| 261 | # path to fcm |
|---|
| 262 | ############################################################### |
|---|
| 263 | # handle case when provided path to fcm was given as a relative |
|---|
| 264 | # path (from makelmdz_fcm script directory) and not an absolute path |
|---|
| 265 | if [[ ${fcm_path:0:1} != "/" ]] ; then |
|---|
| 266 | # prepend with makelmdz_fcm location |
|---|
| 267 | fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path} |
|---|
| 268 | fi |
|---|
| 269 | |
|---|
| 270 | # add fcm_path to PATH |
|---|
| 271 | export PATH=${fcm_path}:${PATH} |
|---|
| 272 | |
|---|
| 273 | echo "Path to fcm:" |
|---|
| 274 | echo ${fcm_path} |
|---|
| 275 | |
|---|
| 276 | ############################################################### |
|---|
| 277 | # lecture des chemins propres \`a l'architecture de la machine # |
|---|
| 278 | ############################################################### |
|---|
| 279 | rm -f .void_file |
|---|
| 280 | echo > .void_file |
|---|
| 281 | rm -rf .void_dir |
|---|
| 282 | mkdir .void_dir |
|---|
| 283 | |
|---|
| 284 | if [[ "$arch_defined" == "TRUE" ]] |
|---|
| 285 | then |
|---|
| 286 | rm -f arch.path |
|---|
| 287 | rm -f arch.fcm |
|---|
| 288 | rm -f arch.env |
|---|
| 289 | |
|---|
| 290 | if test -f $arch_path/arch-${arch}.path |
|---|
| 291 | then |
|---|
| 292 | ln -s $arch_path/arch-${arch}.path arch.path |
|---|
| 293 | elif test -f $arch_default_path/arch-${arch}.path |
|---|
| 294 | then |
|---|
| 295 | ln -s $arch_default_path/arch-${arch}.path arch.path |
|---|
| 296 | fi |
|---|
| 297 | |
|---|
| 298 | if test -f $arch_path/arch-${arch}.fcm |
|---|
| 299 | then |
|---|
| 300 | ln -s $arch_path/arch-${arch}.fcm arch.fcm |
|---|
| 301 | elif test -f $arch_default_path/arch-${arch}.fcm |
|---|
| 302 | then |
|---|
| 303 | ln -s $arch_default_path/arch-${arch}.fcm arch.fcm |
|---|
| 304 | fi |
|---|
| 305 | |
|---|
| 306 | if test -f $arch_path/arch-${arch}.env |
|---|
| 307 | then |
|---|
| 308 | ln -s $arch_path/arch-${arch}.env arch.env |
|---|
| 309 | elif test -f $arch_default_path/arch-${arch}.env |
|---|
| 310 | then |
|---|
| 311 | ln -s $arch_default_path/arch-${arch}.env arch.env |
|---|
| 312 | else |
|---|
| 313 | ln -s .void_file arch.env |
|---|
| 314 | fi |
|---|
| 315 | # source architecture PATH and ENV files |
|---|
| 316 | source arch.env |
|---|
| 317 | source arch.path |
|---|
| 318 | else |
|---|
| 319 | echo "You must define a target architecture" |
|---|
| 320 | exit 1 |
|---|
| 321 | fi |
|---|
| 322 | |
|---|
| 323 | ######################################################################## |
|---|
| 324 | # Definition des clefs CPP, des chemins des includes et modules |
|---|
| 325 | # et des libraries |
|---|
| 326 | ######################################################################## |
|---|
| 327 | |
|---|
| 328 | if [[ "$compil_mod" == "prod" ]] |
|---|
| 329 | then |
|---|
| 330 | COMPIL_FFLAGS="%PROD_FFLAGS" |
|---|
| 331 | elif [[ "$compil_mod" == "dev" ]] |
|---|
| 332 | then |
|---|
| 333 | COMPIL_FFLAGS="%DEV_FFLAGS" |
|---|
| 334 | elif [[ "$compil_mod" == "debug" ]] |
|---|
| 335 | then |
|---|
| 336 | COMPIL_FFLAGS="%DEBUG_FFLAGS" |
|---|
| 337 | fi |
|---|
| 338 | |
|---|
| 339 | phys_root=$physique |
|---|
| 340 | if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi |
|---|
| 341 | if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi |
|---|
| 342 | if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi |
|---|
| 343 | if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi |
|---|
| 344 | if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi |
|---|
| 345 | if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi |
|---|
| 346 | |
|---|
| 347 | if [[ "$physique" != "nophys" ]] |
|---|
| 348 | then |
|---|
| 349 | #We'll use some physics |
|---|
| 350 | CPP_KEY="$CPP_KEY CPP_PHYS" |
|---|
| 351 | if [[ "${phys_root}" == "lmd" ]] |
|---|
| 352 | then |
|---|
| 353 | #For lmd physics, default planet type is Earth |
|---|
| 354 | CPP_KEY="$CPP_KEY CPP_EARTH" |
|---|
| 355 | fi |
|---|
| 356 | # set physics common utilities path |
|---|
| 357 | PHY_COMMON_PATH="${LIBFGCM}/phy_common" |
|---|
| 358 | # set the dyn/phys interface path |
|---|
| 359 | DYN_PHYS_PATH="${LIBFGCM}/dynphy_lonlat" |
|---|
| 360 | DYN_PHYS_SUB_PATH="${LIBFGCM}/dynphy_lonlat/phy${phys_root}" |
|---|
| 361 | fi |
|---|
| 362 | |
|---|
| 363 | if [[ "$filtre" == "filtrez" ]] |
|---|
| 364 | then |
|---|
| 365 | FILTRE_PATH=${LIBFGCM}/$filtre |
|---|
| 366 | fi |
|---|
| 367 | |
|---|
| 368 | if [[ "$chimie" == "INCA" ]] |
|---|
| 369 | then |
|---|
| 370 | CPP_KEY="$CPP_KEY INCA" |
|---|
| 371 | INCLUDE="$INCLUDE ${INCA_INCDIR}" |
|---|
| 372 | LIB="$LIB ${INCA_LIBDIR} ${INCA_LIB}" |
|---|
| 373 | fi |
|---|
| 374 | |
|---|
| 375 | if [[ "$isotopes" == "true" ]] |
|---|
| 376 | then |
|---|
| 377 | CPP_KEY="$CPP_KEY ISO" |
|---|
| 378 | fi |
|---|
| 379 | |
|---|
| 380 | if [[ "$isoverif" == "true" ]] |
|---|
| 381 | then |
|---|
| 382 | CPP_KEY="$CPP_KEY ISOVERIF" |
|---|
| 383 | fi |
|---|
| 384 | |
|---|
| 385 | if [[ "$diagiso" == "true" ]] |
|---|
| 386 | then |
|---|
| 387 | CPP_KEY="$CPP_KEY DIAGISO" |
|---|
| 388 | fi |
|---|
| 389 | |
|---|
| 390 | if [[ "$isotrac" == "true" ]] |
|---|
| 391 | then |
|---|
| 392 | CPP_KEY="$CPP_KEY ISOTRAC" |
|---|
| 393 | fi |
|---|
| 394 | |
|---|
| 395 | if [[ "$couple" != "false" ]] |
|---|
| 396 | then |
|---|
| 397 | if [[ "$couple" == "MPI1" ]] |
|---|
| 398 | then |
|---|
| 399 | CPP_KEY="$CPP_KEY CPP_COUPLE" |
|---|
| 400 | export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1 |
|---|
| 401 | export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib |
|---|
| 402 | INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
|---|
| 403 | LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io" |
|---|
| 404 | else |
|---|
| 405 | CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT" |
|---|
| 406 | INCLUDE="$INCLUDE ${OASIS_INCDIR}" |
|---|
| 407 | LIB="$LIB ${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu" |
|---|
| 408 | fi |
|---|
| 409 | fi |
|---|
| 410 | |
|---|
| 411 | if [[ "$parallel" == "mpi" ]] |
|---|
| 412 | then |
|---|
| 413 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI" |
|---|
| 414 | PARA_FFLAGS="%MPI_FFLAGS" |
|---|
| 415 | PARA_LD="%MPI_LD" |
|---|
| 416 | elif [[ "$parallel" == "omp" ]] |
|---|
| 417 | then |
|---|
| 418 | CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP" |
|---|
| 419 | PARA_FFLAGS="%OMP_FFLAGS" |
|---|
| 420 | PARA_LD="%OMP_LD" |
|---|
| 421 | elif [[ "$parallel" == "mpi_omp" ]] |
|---|
| 422 | then |
|---|
| 423 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP" |
|---|
| 424 | PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS" |
|---|
| 425 | PARA_LD="%MPI_LD %OMP_LD" |
|---|
| 426 | fi |
|---|
| 427 | |
|---|
| 428 | if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \ |
|---|
| 429 | && "$compil_mod" == "debug" ]] |
|---|
| 430 | then |
|---|
| 431 | echo "Usually, parallelization with OpenMP requires some optimization." |
|---|
| 432 | echo "We suggest switching to \"-dev\"." |
|---|
| 433 | fi |
|---|
| 434 | |
|---|
| 435 | if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" -o "$veget" = "orchidee2.1" -o "$veget" = "orchidee2.2" -o "$veget" = "orchideetrunk" ] |
|---|
| 436 | then |
|---|
| 437 | echo "doing orchidee" |
|---|
| 438 | #NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6 |
|---|
| 439 | # For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments |
|---|
| 440 | # 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 |
|---|
| 441 | # FC orchidee 2.2 pour le 1D uniquement a ce stade suppose que l on a mis un numero de revision au moment de l install |
|---|
| 442 | INCLUDE="${INCLUDE} ${ORCH_INCDIR}" |
|---|
| 443 | CPP_KEY="$CPP_KEY CPP_VEGET" |
|---|
| 444 | # temporary, for Orchidee versions 1.9.* (before openmp activation) |
|---|
| 445 | if [[ "$veget" == "orchidee1.9" ]] ; then |
|---|
| 446 | CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP" |
|---|
| 447 | fi |
|---|
| 448 | if [[ "$veget" == "orchidee2.0" ]] ; then |
|---|
| 449 | orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob -lorchidee" |
|---|
| 450 | CPP_KEY="$CPP_KEY ORCHIDEE_NOUNSTRUCT" |
|---|
| 451 | elif [[ "$veget" == "orchidee2.1" || "orchidee2.2" ]] ; then |
|---|
| 452 | CPP_KEY="$CPP_KEY ORCHIDEE_NOLIC" |
|---|
| 453 | orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob -lorchidee" |
|---|
| 454 | elif [[ "$veget" == "orchideetrunk" ]] ; then |
|---|
| 455 | orch_libs="-lorchidee" |
|---|
| 456 | else |
|---|
| 457 | orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob" |
|---|
| 458 | fi |
|---|
| 459 | LIB="${LIB} ${ORCH_LIBDIR} ${orch_libs}" |
|---|
| 460 | # for lib in ${orch_libs} ; do |
|---|
| 461 | # if [ -f ${ORCH_LIBDIR#-L}/lib${LIBPREFIX}$lib.a ] ; then |
|---|
| 462 | # LIB="${LIB} -l${LIBPREFIX}$lib " |
|---|
| 463 | # fi |
|---|
| 464 | # done |
|---|
| 465 | echo "orchidee lib" |
|---|
| 466 | echo ${LIB} |
|---|
| 467 | elif [[ "$veget" != "false" ]] ; then |
|---|
| 468 | echo "Option -v $veget does not exist" |
|---|
| 469 | echo "Use ./makelmdz_fcm -h for more information" |
|---|
| 470 | exit |
|---|
| 471 | fi |
|---|
| 472 | |
|---|
| 473 | INLANDSIS_PATH="$LIBFGCM/phy${physique}/inlandsis" |
|---|
| 474 | if [[ "$inlandsis" == "true" ]]; then |
|---|
| 475 | CPP_KEY="$CPP_KEY CPP_INLANDSIS" |
|---|
| 476 | fi |
|---|
| 477 | |
|---|
| 478 | if [[ "$rad" == "rrtm" ]] |
|---|
| 479 | then |
|---|
| 480 | CPP_KEY="$CPP_KEY CPP_RRTM" |
|---|
| 481 | RAD_PATH="$LIBFGCM/phy${physique}/rrtm" |
|---|
| 482 | fi |
|---|
| 483 | if [[ "$rad" == "ecrad" ]] |
|---|
| 484 | then |
|---|
| 485 | CPP_KEY="$CPP_KEY CPP_ECRAD" |
|---|
| 486 | RAD_PATH="$LIBFGCM/phy${physique}/ecrad" |
|---|
| 487 | fi |
|---|
| 488 | |
|---|
| 489 | if [[ "$rad" == "ecrad-acc" ]] |
|---|
| 490 | then |
|---|
| 491 | CPP_KEY="$CPP_KEY CPP_ECRAD" |
|---|
| 492 | RAD_PATH="$LIBFGCM/phy${physique}/ecrad-acc" |
|---|
| 493 | fi |
|---|
| 494 | |
|---|
| 495 | DUST_PATH="$LIBFGCM/phy${physique}/Dust" |
|---|
| 496 | if [[ "$dust" == "true" ]]; then |
|---|
| 497 | CPP_KEY="$CPP_KEY CPP_Dust" |
|---|
| 498 | fi |
|---|
| 499 | |
|---|
| 500 | STRATAER_PATH="$LIBFGCM/phy${physique}/StratAer" |
|---|
| 501 | if [[ "$strataer" == "true" ]]; then |
|---|
| 502 | CPP_KEY="$CPP_KEY CPP_StratAer" |
|---|
| 503 | fi |
|---|
| 504 | |
|---|
| 505 | INCLUDE="$INCLUDE ${NETCDF95_INCDIR}" |
|---|
| 506 | LIB="$LIB ${NETCDF95_LIBDIR} ${NETCDF95_LIB}" |
|---|
| 507 | |
|---|
| 508 | if [[ $io == ioipsl ]] |
|---|
| 509 | then |
|---|
| 510 | CPP_KEY="$CPP_KEY CPP_IOIPSL" |
|---|
| 511 | INCLUDE="$INCLUDE ${IOIPSL_INCDIR}" |
|---|
| 512 | LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB}" |
|---|
| 513 | elif [[ $io == mix ]] |
|---|
| 514 | then |
|---|
| 515 | # For now, xios implies also using ioipsl |
|---|
| 516 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS" |
|---|
| 517 | INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}" |
|---|
| 518 | LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}" |
|---|
| 519 | elif [[ $io == xios ]] |
|---|
| 520 | then |
|---|
| 521 | # For now, xios implies also using ioipsl |
|---|
| 522 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT" |
|---|
| 523 | INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}" |
|---|
| 524 | LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}" |
|---|
| 525 | fi |
|---|
| 526 | |
|---|
| 527 | if [[ "$cosp" == "true" ]] |
|---|
| 528 | then |
|---|
| 529 | CPP_KEY="$CPP_KEY CPP_COSP" |
|---|
| 530 | COSP_PATH="$LIBFGCM/phylmd/cosp" |
|---|
| 531 | # LIB="${LIB} -l${LIBPREFIX}cosp" |
|---|
| 532 | fi |
|---|
| 533 | |
|---|
| 534 | if [[ "$cosp2" == "true" ]] |
|---|
| 535 | then |
|---|
| 536 | CPP_KEY="$CPP_KEY CPP_COSP2" |
|---|
| 537 | COSP_PATH="$LIBFGCM/phylmd/cosp2" |
|---|
| 538 | # LIB="${LIB} -l${LIBPREFIX}cosp2" |
|---|
| 539 | fi |
|---|
| 540 | |
|---|
| 541 | if [[ "$cospv2" == "true" ]] |
|---|
| 542 | then |
|---|
| 543 | CPP_KEY="$CPP_KEY CPP_COSPV2" |
|---|
| 544 | COSP_PATH="$LIBFGCM/phylmd/cospv2" |
|---|
| 545 | # LIB="${LIB} -l${LIBPREFIX}cosp2" |
|---|
| 546 | fi |
|---|
| 547 | |
|---|
| 548 | if [[ "$cplocninca" == "TRUE" ]] |
|---|
| 549 | then |
|---|
| 550 | CPP_KEY="${CPP_KEY} CPP_CPLOCNINCA" |
|---|
| 551 | fi |
|---|
| 552 | |
|---|
| 553 | |
|---|
| 554 | INCLUDE="$INCLUDE ${NETCDF_INCDIR}" |
|---|
| 555 | LIB="$LIB ${NETCDF_LIBDIR} ${NETCDF_LIB}" |
|---|
| 556 | |
|---|
| 557 | ######################################################################## |
|---|
| 558 | # calcul du nombre de dimensions |
|---|
| 559 | ######################################################################## |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | dim_full=$dim |
|---|
| 563 | dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
|---|
| 564 | set $dim |
|---|
| 565 | dimc=$# |
|---|
| 566 | echo calcul de la dimension |
|---|
| 567 | echo dim $dim |
|---|
| 568 | echo dimc $dimc |
|---|
| 569 | |
|---|
| 570 | |
|---|
| 571 | ######################################################################## |
|---|
| 572 | # Gestion des dimensions du modele. |
|---|
| 573 | # on cree ou remplace le fichier des dimensions |
|---|
| 574 | ######################################################################## |
|---|
| 575 | |
|---|
| 576 | cd $LIBFGCM/grid |
|---|
| 577 | if [[ -f dimensions_mod.f90 ]] |
|---|
| 578 | then |
|---|
| 579 | if [[ $force_compile == true ]] |
|---|
| 580 | then |
|---|
| 581 | \rm -f $LIBFGCM/grid/dimensions_mod.f90 |
|---|
| 582 | else |
|---|
| 583 | echo "WARNING: you are probably already compiling the model somewhere else." |
|---|
| 584 | echo "Wait until the first compilation is finished before launching this one." |
|---|
| 585 | echo "If you are sure that you are not compiling elsewhere, " |
|---|
| 586 | echo "If you are sure that you are not compiling elsewhere, then" |
|---|
| 587 | echo rm -f $LIBFGCM/grid/dimensions_mod.f90 |
|---|
| 588 | echo "before reruning the compilation" |
|---|
| 589 | echo "or run makelmdz_fcm with option -force_compile" |
|---|
| 590 | exit 1 |
|---|
| 591 | fi |
|---|
| 592 | fi |
|---|
| 593 | |
|---|
| 594 | |
|---|
| 595 | |
|---|
| 596 | cd $LIBFGCM/grid/dimension |
|---|
| 597 | ./makdim $dim |
|---|
| 598 | cat $LIBFGCM/grid/dimensions_mod.f90 |
|---|
| 599 | cd $LMDGCM |
|---|
| 600 | |
|---|
| 601 | |
|---|
| 602 | ######################################################################## |
|---|
| 603 | # Differentes dynamiques (3d, 2d, 1d) |
|---|
| 604 | ######################################################################## |
|---|
| 605 | |
|---|
| 606 | dimension=`echo $dim | wc -w` |
|---|
| 607 | echo dimension $dimension |
|---|
| 608 | |
|---|
| 609 | if (( $dimension == 1 )) |
|---|
| 610 | then |
|---|
| 611 | CPP_KEY="$CPP_KEY CPP_1D" |
|---|
| 612 | ## no filtre in 1d: |
|---|
| 613 | FILTRE_PATH=$LMDGCM/.void_dir |
|---|
| 614 | ## no need to compile all routines in dyn3d_common either: |
|---|
| 615 | DYN_COMMON_PATH=$LMDGCM/.void_dir |
|---|
| 616 | ## no need to compile all routines in dynlmdz_phy... ; |
|---|
| 617 | ## (because key ones are included in 1D main program) |
|---|
| 618 | DYN_PHYS_PATH=$LMDGCM/.void_dir |
|---|
| 619 | DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir |
|---|
| 620 | fi |
|---|
| 621 | |
|---|
| 622 | ###################################################################### |
|---|
| 623 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
|---|
| 624 | # ---> YM desactive pour le traitemement en parallele |
|---|
| 625 | ###################################################################### |
|---|
| 626 | |
|---|
| 627 | #if [[ -f $libf/phy$physique/raddim.h ]] |
|---|
| 628 | #then |
|---|
| 629 | # if [[ -f $libf/phy$physique/raddim.$dimh.h ]] |
|---|
| 630 | #then |
|---|
| 631 | # \rm -f $libf/phy$physique/raddim.h |
|---|
| 632 | # cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
|---|
| 633 | # echo $libf/phy$physique/raddim.$dimh.h |
|---|
| 634 | # cat $libf/phy$physique/raddim.h |
|---|
| 635 | # else |
|---|
| 636 | # echo On peut diminuer la taille de l executable en creant |
|---|
| 637 | # echo le fichier $libf/phy$physique/raddim.$dimh.h |
|---|
| 638 | # \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
|---|
| 639 | # fi |
|---|
| 640 | #fi |
|---|
| 641 | |
|---|
| 642 | ###################################################################### |
|---|
| 643 | # Gestion du filtre qui n'existe qu'en 3d. |
|---|
| 644 | ###################################################################### |
|---|
| 645 | |
|---|
| 646 | if (( `expr $dimc \> 2` == 1 )) |
|---|
| 647 | then |
|---|
| 648 | filtre="FILTRE=$filtre" |
|---|
| 649 | else |
|---|
| 650 | filtre="FILTRE= L_FILTRE= " |
|---|
| 651 | fi |
|---|
| 652 | echo MACRO FILTRE $filtre |
|---|
| 653 | |
|---|
| 654 | echo $dimc |
|---|
| 655 | |
|---|
| 656 | |
|---|
| 657 | |
|---|
| 658 | ###################################################################### |
|---|
| 659 | # Creation du suffixe de la configuration |
|---|
| 660 | ###################################################################### |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | SUFF_NAME=_${dim_full} |
|---|
| 664 | SUFF_NAME=${SUFF_NAME}_phy${physique}_${rad} |
|---|
| 665 | |
|---|
| 666 | if [[ "$parallel" != "none" ]] |
|---|
| 667 | then |
|---|
| 668 | SUFF_NAME=${SUFF_NAME}_para |
|---|
| 669 | DYN=dyn${dimc}d${paramem} |
|---|
| 670 | if [[ "$paramem" == "mem" ]] |
|---|
| 671 | then |
|---|
| 672 | SUFF_NAME=${SUFF_NAME}_${paramem} |
|---|
| 673 | else |
|---|
| 674 | echo "The version of the dynamics in dyn3dpar is no longer updated." |
|---|
| 675 | echo "You should use option \"-mem\"." |
|---|
| 676 | exit 1 |
|---|
| 677 | fi |
|---|
| 678 | else |
|---|
| 679 | SUFF_NAME=${SUFF_NAME}_seq |
|---|
| 680 | if (( $dimension == 1 )) |
|---|
| 681 | then |
|---|
| 682 | # dynamics-related routines in"dyn1d" subdirectory of phy${physique} |
|---|
| 683 | DYN=phy${physique}/dyn1d |
|---|
| 684 | else |
|---|
| 685 | DYN=dyn${dimc}d |
|---|
| 686 | fi |
|---|
| 687 | fi |
|---|
| 688 | |
|---|
| 689 | if [[ $veget = "false" ]] |
|---|
| 690 | then |
|---|
| 691 | SUFF_NAME=${SUFF_NAME} |
|---|
| 692 | else |
|---|
| 693 | SUFF_NAME=${SUFF_NAME}_${veget} |
|---|
| 694 | fi |
|---|
| 695 | |
|---|
| 696 | if [[ $dust == "true" ]] |
|---|
| 697 | then |
|---|
| 698 | SUFF_NAME=${SUFF_NAME}_spla |
|---|
| 699 | fi |
|---|
| 700 | |
|---|
| 701 | if [[ $couple != "false" ]] |
|---|
| 702 | then |
|---|
| 703 | SUFF_NAME=${SUFF_NAME}_couple |
|---|
| 704 | fi |
|---|
| 705 | |
|---|
| 706 | if [[ $chimie == "INCA" ]] |
|---|
| 707 | then |
|---|
| 708 | SUFF_NAME=${SUFF_NAME}_inca |
|---|
| 709 | fi |
|---|
| 710 | |
|---|
| 711 | if [[ "$isotopes" == "true" ]] |
|---|
| 712 | then |
|---|
| 713 | SUFF_NAME=${SUFF_NAME}_iso |
|---|
| 714 | fi |
|---|
| 715 | if [[ "$isoverif" == "true" ]] |
|---|
| 716 | then |
|---|
| 717 | SUFF_NAME=${SUFF_NAME}_isoverif |
|---|
| 718 | fi |
|---|
| 719 | if [[ "$isotrac" == "true" ]] |
|---|
| 720 | then |
|---|
| 721 | SUFF_NAME=${SUFF_NAME}_isotrac |
|---|
| 722 | fi |
|---|
| 723 | if [[ "$diagiso" == "true" ]] |
|---|
| 724 | then |
|---|
| 725 | SUFF_NAME=${SUFF_NAME}_diagiso |
|---|
| 726 | fi |
|---|
| 727 | |
|---|
| 728 | if [[ $libphy == "true" ]] |
|---|
| 729 | then |
|---|
| 730 | # special case where we compile only the physics |
|---|
| 731 | DYN=$LMDGCM/.void_dir |
|---|
| 732 | DYN_COMMON_PATH=$LMDGCM/.void_dir |
|---|
| 733 | FILTRE_PATH=$LMDGCM/.void_dir |
|---|
| 734 | DYN_PHYS_PATH=$LMDGCM/.void_dir |
|---|
| 735 | DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir |
|---|
| 736 | GRID_PATH=$LMDGCM/.void_dir |
|---|
| 737 | #and there is no main program to generate |
|---|
| 738 | code="" |
|---|
| 739 | SUFF_NAME="" |
|---|
| 740 | else |
|---|
| 741 | SUFF_NAME=${SUFF_NAME}.e |
|---|
| 742 | fi |
|---|
| 743 | |
|---|
| 744 | cd $LMDGCM |
|---|
| 745 | config_fcm="config.fcm" |
|---|
| 746 | rm -f $config_fcm |
|---|
| 747 | touch $config_fcm |
|---|
| 748 | if [ ! X"${code}${SUFF_NAME}" == X ] ; then |
|---|
| 749 | rm -f bin/${code}${SUFF_NAME} |
|---|
| 750 | fi |
|---|
| 751 | if [ ! X"${code}" == X ] ; then |
|---|
| 752 | rm -f bin/${code}.e |
|---|
| 753 | fi |
|---|
| 754 | rm -f arch.fcm |
|---|
| 755 | rm -f arch.opt |
|---|
| 756 | |
|---|
| 757 | if [[ "$rad" == "rrtm" ]] ; then |
|---|
| 758 | RAD_SOURCES=" |
|---|
| 759 | src::rad %RAD |
|---|
| 760 | " |
|---|
| 761 | fi |
|---|
| 762 | if [[ "$rad" == "ecrad" || "$rad" == "ecrad-acc" ]] ; then |
|---|
| 763 | RAD_SOURCES=" |
|---|
| 764 | src::rad %RAD |
|---|
| 765 | src::lmdz %RAD/lmdz |
|---|
| 766 | src::radiation %RAD/radiation |
|---|
| 767 | src::ifsrrtm %RAD/ifsrrtm |
|---|
| 768 | src::ifsaux %RAD/ifsaux |
|---|
| 769 | src::ecradinc %RAD/include |
|---|
| 770 | src::ecradhook %RAD/drhook |
|---|
| 771 | src::ecradutil %RAD/utilities |
|---|
| 772 | " |
|---|
| 773 | fi |
|---|
| 774 | |
|---|
| 775 | if [[ "$cosp" == "true" ]]; then |
|---|
| 776 | COSP_SOURCES=" |
|---|
| 777 | src::cosp %COSP |
|---|
| 778 | " |
|---|
| 779 | elif [[ "$cospv2" == "true" ]]; then |
|---|
| 780 | COSP_SOURCES=" |
|---|
| 781 | src::cosp %COSP |
|---|
| 782 | src::cosp::cosp_src %COSP/src |
|---|
| 783 | src::cosp::lmdz_cosp %COSP/lmdz |
|---|
| 784 | src::cosp::cosp_simulator %COSP/src/simulator |
|---|
| 785 | src::cosp::cosp_misr %COSP/src/simulator/MISR_simulator |
|---|
| 786 | src::cosp::cosp_modis %COSP/src/simulator/MODIS_simulator |
|---|
| 787 | src::cosp::cosp_parasol %COSP/src/simulator/parasol |
|---|
| 788 | src::cosp::cosp_icarus %COSP/src/simulator/icarus |
|---|
| 789 | src::cosp::cosp_actsim %COSP/src/simulator/actsim |
|---|
| 790 | src::cosp::cosp_rttov %COSP/src/simulator/rttov |
|---|
| 791 | src::cosp::cosp_quickbeam %COSP/src/simulator/quickbeam |
|---|
| 792 | src::cosp::cosp_utils %COSP/model-interface |
|---|
| 793 | src::cosp::cosp_subcol %COSP/subsample_and_optics_example/subcol |
|---|
| 794 | src::cosp::cosp_subcol_rng %COSP/subsample_and_optics_example/subcol/rng |
|---|
| 795 | src::cosp::cosp_optics %COSP/subsample_and_optics_example/optics |
|---|
| 796 | src::cosp::cosp_optics_quickbeam %COSP/subsample_and_optics_example/optics/quickbeam_optics |
|---|
| 797 | " |
|---|
| 798 | fi |
|---|
| 799 | |
|---|
| 800 | cat >> $config_fcm <<EOF |
|---|
| 801 | %ARCH $arch |
|---|
| 802 | %INCDIR $INCLUDE |
|---|
| 803 | %LIB $LIB |
|---|
| 804 | %ROOT_PATH $PWD |
|---|
| 805 | %LIBF $LIBFGCM |
|---|
| 806 | %LIBO $LIBOGCM |
|---|
| 807 | %DYN $DYN |
|---|
| 808 | %DYN_COMMON $DYN_COMMON_PATH |
|---|
| 809 | %PHY_COMMON $PHY_COMMON_PATH |
|---|
| 810 | %FILTRE $FILTRE_PATH |
|---|
| 811 | %PHYS phy${physique} |
|---|
| 812 | %DYN_PHYS $DYN_PHYS_PATH |
|---|
| 813 | %DYN_PHYS_SUB $DYN_PHYS_SUB_PATH |
|---|
| 814 | %GRID $GRID_PATH |
|---|
| 815 | %RAD $RAD_PATH |
|---|
| 816 | %COSP $COSP_PATH |
|---|
| 817 | %DUST $DUST_PATH |
|---|
| 818 | %STRATAER $STRATAER_PATH |
|---|
| 819 | %INLANDSIS $INLANDSIS_PATH |
|---|
| 820 | %CPP_KEY $CPP_KEY |
|---|
| 821 | %EXEC $code |
|---|
| 822 | %SUFF_NAME $SUFF_NAME |
|---|
| 823 | %COMPIL_FFLAGS $COMPIL_FFLAGS |
|---|
| 824 | %PARA_FFLAGS $PARA_FFLAGS |
|---|
| 825 | %PARA_LD $PARA_LD |
|---|
| 826 | %EXT_SRC $EXT_SRC |
|---|
| 827 | EOF |
|---|
| 828 | |
|---|
| 829 | cat >> $config_fcm <<EOF |
|---|
| 830 | %RAD_SOURCES |
|---|
| 831 | $RAD_SOURCES |
|---|
| 832 | EOF |
|---|
| 833 | |
|---|
| 834 | cat >> $config_fcm <<EOF |
|---|
| 835 | %COSP_SOURCES |
|---|
| 836 | $COSP_SOURCES |
|---|
| 837 | EOF |
|---|
| 838 | |
|---|
| 839 | # AI inutil retour a 1 seul bld.cfg |
|---|
| 840 | #if [[ "$rad" == "ecrad" || "$rad" == "ecrad-acc" ]] |
|---|
| 841 | #then |
|---|
| 842 | #cp bld.cfg.ecrad bld.cfg |
|---|
| 843 | #else |
|---|
| 844 | #cp bld.cfg.rrtm bld.cfg |
|---|
| 845 | #fi |
|---|
| 846 | |
|---|
| 847 | ln -s arch/arch-${arch}.fcm arch.fcm |
|---|
| 848 | if test -f arch/arch-${arch}.opt && [ $compil_mod = "prod" ] |
|---|
| 849 | then |
|---|
| 850 | ln -s arch/arch-${arch}.opt arch.opt |
|---|
| 851 | else |
|---|
| 852 | ln -s .void_file arch.opt |
|---|
| 853 | fi |
|---|
| 854 | |
|---|
| 855 | set +e |
|---|
| 856 | |
|---|
| 857 | rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock |
|---|
| 858 | ./build_gcm ${fcm_path} -j $job $full |
|---|
| 859 | build_status=$? |
|---|
| 860 | |
|---|
| 861 | rm -rf tmp_src |
|---|
| 862 | rm -rf config |
|---|
| 863 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config |
|---|
| 864 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src |
|---|
| 865 | |
|---|
| 866 | if [[ -r $LIBFGCM/grid/dimensions_mod.f90 ]] |
|---|
| 867 | then |
|---|
| 868 | # Cleanup: remove dimension.h file |
|---|
| 869 | \rm -f $LIBFGCM/grid/dimensions_mod.f90 |
|---|
| 870 | fi |
|---|
| 871 | |
|---|
| 872 | # build netcdf95 library necessary for the makelmdz script |
|---|
| 873 | if [[ $build_status = 0 ]] |
|---|
| 874 | then |
|---|
| 875 | cp bin/${code}${SUFF_NAME} bin/${code}.e |
|---|
| 876 | if [[ ! -d tools/netcdf95/include ]] |
|---|
| 877 | then |
|---|
| 878 | mkdir tools/netcdf95/include tools/netcdf95/lib |
|---|
| 879 | cp config/inc/netcdf95.mod config/inc/nf95_*mod tools/netcdf95/include |
|---|
| 880 | cp config/obj/netcdf95.o config/obj/nf95_*o config/obj/check_start_count_m.o tools/netcdf95/lib |
|---|
| 881 | cd tools/netcdf95/lib; ar rv libnetcdf95.a *.o; ranlib libnetcdf95.a |
|---|
| 882 | cd - |
|---|
| 883 | fi |
|---|
| 884 | fi |
|---|
| 885 | |
|---|
| 886 | exit $build_status |
|---|