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