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