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