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