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