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