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