[38] | 1 | #!/bin/csh -f |
---|
| 2 | # $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $ |
---|
| 3 | #set verbose echo |
---|
| 4 | ######################################################################## |
---|
| 5 | # options par defaut pour la commande make |
---|
| 6 | ######################################################################## |
---|
| 7 | set dim="64x48x32" |
---|
| 8 | set physique=mars |
---|
| 9 | set phys="PHYS=$physique" |
---|
| 10 | set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. -I$(LIBF)/aeronomars' |
---|
| 11 | set ntrac = 1 |
---|
| 12 | set filtre=filtrez |
---|
| 13 | set grille=reg |
---|
| 14 | set dyntype="dyn" |
---|
[148] | 15 | set scatterers="1" |
---|
[38] | 16 | ######################################################################## |
---|
| 17 | # path a changer contenant les sources et les objets du modele |
---|
| 18 | ######################################################################## |
---|
| 19 | |
---|
| 20 | #### If you want you can set environment variables here (instead of |
---|
| 21 | #### relying on the C-shell environment variables) |
---|
| 22 | # default LMDGCM to where makegcm script is located: |
---|
| 23 | #setenv LMDGCM "`dirname $0`" |
---|
| 24 | # You may set LIBOGCM to something else; otherwise we default to: |
---|
| 25 | #setenv LIBOGCM $LMDGCM/libo |
---|
| 26 | ## NetCDF Libraries: what follows is OK for LMD 32 and 64bit Linux Machines |
---|
| 27 | #if ( `uname -m` == "x86_64" ) then |
---|
| 28 | ## 64 bit machines |
---|
| 29 | # setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_g95/lib |
---|
| 30 | # setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_g95/include |
---|
| 31 | #else |
---|
| 32 | # setenv NCDFLIB /donnees/emlmd/netcdf-4.0.1_g95/lib |
---|
| 33 | # setenv NCDFINC /donnees/emlmd/netcdf-4.0.1_g95/include |
---|
| 34 | #endif |
---|
| 35 | #### |
---|
| 36 | |
---|
| 37 | setenv localdir "`pwd`" |
---|
| 38 | set MODIPSL=0 |
---|
| 39 | echo $localdir | grep modipsl >& /dev/null |
---|
| 40 | if ( ! $status ) then |
---|
| 41 | set MODIPSL=1 |
---|
| 42 | setenv LMDGCM $localdir |
---|
| 43 | cd ../.. |
---|
| 44 | setenv LIBOGCM "`pwd`/lib" |
---|
| 45 | cd $localdir |
---|
| 46 | if ( `hostname` == rhodes ) then |
---|
| 47 | set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
| 48 | set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
| 49 | else |
---|
| 50 | if ( `hostname` == nymphea0 ) then |
---|
| 51 | set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
| 52 | set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
| 53 | else |
---|
| 54 | echo 'Probleme de definition des variables NCDFINC et NCDFLIB' |
---|
| 55 | endif |
---|
| 56 | endif |
---|
| 57 | else |
---|
| 58 | if ( ! $?LMDGCM ) then |
---|
| 59 | echo You must initialize the variable LMDGCM in your environnement |
---|
| 60 | echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc |
---|
| 61 | exit |
---|
| 62 | endif |
---|
| 63 | if ( ! $?LIBOGCM ) then |
---|
| 64 | set LIBOGCM=$LMDGCM/libo |
---|
| 65 | endif |
---|
| 66 | if ( ! $?NCDFLIB ) then |
---|
| 67 | echo You must initialize the variable NCDFLIB in your environnement |
---|
| 68 | echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc |
---|
| 69 | exit |
---|
| 70 | endif |
---|
| 71 | if ( ! $?NCDFINC ) then |
---|
| 72 | echo You must initialize the variable NCDFINC in your environnement |
---|
| 73 | echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc |
---|
| 74 | exit |
---|
| 75 | endif |
---|
| 76 | endif |
---|
| 77 | set model=$LMDGCM |
---|
| 78 | set libo=$LIBOGCM |
---|
| 79 | |
---|
| 80 | ######################################################################## |
---|
| 81 | # Les differentes platformes reconnues |
---|
| 82 | ######################################################################## |
---|
| 83 | |
---|
| 84 | set HP=0 |
---|
| 85 | set IBM=0 |
---|
| 86 | set SUN=0 |
---|
| 87 | set VPP=0 |
---|
| 88 | set CRAY=0 |
---|
| 89 | set DEC=0 |
---|
| 90 | set LINUX=0 |
---|
| 91 | set NEC=0 |
---|
| 92 | set XNEC=0 |
---|
| 93 | if ( `uname` == HP-UX ) then |
---|
| 94 | set machine=HP |
---|
| 95 | set HP=1 |
---|
| 96 | else if (`uname` == UNIX_System_V ) then |
---|
| 97 | set machine=VPP |
---|
| 98 | set VPP=1 |
---|
| 99 | else if (`uname` == SunOS ) then |
---|
| 100 | set machine=SUN |
---|
| 101 | set SUN=1 |
---|
| 102 | else if ( `uname` == AIX ) then |
---|
| 103 | set machine=IBM |
---|
| 104 | set IBM=1 |
---|
| 105 | else if ( `uname` == OSF1 ) then |
---|
| 106 | set machine=ALPHA |
---|
| 107 | set DEC=1 |
---|
| 108 | else if ( `uname` == Linux ) then |
---|
| 109 | set machine=LINUX |
---|
| 110 | set LINUX=1 |
---|
| 111 | else if ( `hostname` == atlas || `hostname` == axis || `hostname` == etoile ) then |
---|
| 112 | set machine=CRAY |
---|
| 113 | set CRAY=1 |
---|
| 114 | else if ( `uname` == SUPER-UX ) then |
---|
| 115 | set machine=NEC |
---|
| 116 | set NEC=1 |
---|
| 117 | else if ( `hostname` == rhodes) then |
---|
| 118 | set machine=XNEC |
---|
| 119 | set XNEC=1 |
---|
| 120 | else |
---|
| 121 | echo Vous travaillez sur une machine non prevue par le reglement |
---|
| 122 | exit |
---|
| 123 | endif |
---|
| 124 | |
---|
| 125 | # create $libo directory if it doesn't exist |
---|
| 126 | if ( ! -d $libo ) then |
---|
| 127 | mkdir $libo |
---|
| 128 | endif |
---|
| 129 | |
---|
| 130 | if $VPP then |
---|
| 131 | set netcdf=netcdf_v |
---|
| 132 | else |
---|
| 133 | set netcdf=netcdf |
---|
| 134 | endif |
---|
| 135 | ######################################################################## |
---|
| 136 | # Quelques initialisations de variables du shell. |
---|
| 137 | ######################################################################## |
---|
| 138 | |
---|
| 139 | set dyn= |
---|
| 140 | set opt_link="" |
---|
| 141 | set adjnt="" |
---|
| 142 | set opt_dep="" |
---|
| 143 | |
---|
| 144 | set optim90="" |
---|
| 145 | set oplink="" |
---|
| 146 | |
---|
| 147 | ######################################################################## |
---|
| 148 | # Optimisations par defaut suivant les machines |
---|
| 149 | ######################################################################## |
---|
| 150 | |
---|
| 151 | echo "Optimisations par defaut suivant les machines" |
---|
| 152 | set libf=$model/libf |
---|
| 153 | #setenv localdir "LOCAL_DIR=`pwd`" |
---|
| 154 | #setenv localdir "`pwd`" |
---|
| 155 | cd $model |
---|
| 156 | if $CRAY then |
---|
| 157 | set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv ' |
---|
| 158 | set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf " |
---|
| 159 | set mod_loc_dir=" " |
---|
| 160 | set mod_suffix=" " |
---|
| 161 | else if $SUN then |
---|
| 162 | set optim90=" -fast" |
---|
| 163 | set optimtru90=" -fast -free" |
---|
| 164 | set opt_link="-L$NCDFLIB -lnetcdf" |
---|
| 165 | set mod_loc_dir=$localdir |
---|
| 166 | set mod_suffix=mod |
---|
| 167 | else if $HP then |
---|
| 168 | else if $IBM then |
---|
| 169 | else if $VPP then |
---|
| 170 | set optim90="$optim -X9 -w" |
---|
| 171 | if $COUPLE then |
---|
| 172 | set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
| 173 | set oplink="-Wl,-t,-P,-dy " |
---|
| 174 | else |
---|
| 175 | set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
| 176 | set oplink="-Wl,-t,-dy " |
---|
| 177 | endif |
---|
| 178 | set mod_loc_dir=$IOIPSLDIR |
---|
| 179 | set mod_suffix=mod |
---|
| 180 | else if $DEC then |
---|
| 181 | else if $LINUX then |
---|
| 182 | # Ehouarn 'g95' compiler |
---|
| 183 | set optim="-O3 -fstatic -funroll-loops " |
---|
| 184 | set optim90=" -O3 -fstatic -funroll-loops " |
---|
| 185 | set optimtru90=" -O3 -fstatic -funroll-loops " |
---|
| 186 | # set opt_link=" -Mfree -L/usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$NCDFLIB -lnetcdf -Wl,-Bstatic " |
---|
| 187 | # Ehouarn: there is no /usr/local/pgi/linux86/lib, but it doesn't matter |
---|
| 188 | # also changed -Wl,-Bstatic to -Bstatic |
---|
| 189 | set opt_link=" -L$NCDFLIB -lnetcdf " |
---|
| 190 | set mod_loc_dir=$localdir |
---|
| 191 | set mod_suffix=mod |
---|
| 192 | else if $NEC then |
---|
| 193 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 194 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 195 | ### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v " |
---|
| 196 | set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib -lnetcdf_i8r8 " |
---|
| 197 | set mod_loc_dir="." |
---|
| 198 | set mod_suffix="mod" |
---|
| 199 | else if $XNEC then |
---|
| 200 | set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 201 | set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 202 | if $MODIPSL then |
---|
| 203 | if $COUPLE then |
---|
| 204 | set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 205 | else |
---|
| 206 | set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 207 | endif |
---|
| 208 | set mod_loc_dir="./" |
---|
| 209 | else |
---|
| 210 | #### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lsxioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
| 211 | set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
| 212 | set mod_loc_dir="." |
---|
| 213 | endif |
---|
| 214 | set mod_suffix="mod" |
---|
| 215 | |
---|
| 216 | endif |
---|
| 217 | |
---|
| 218 | # Ehouarn: add 'g95' string to pathname |
---|
| 219 | set nomlib=${machine}_g95 |
---|
| 220 | |
---|
| 221 | # Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64) |
---|
| 222 | if (`uname` == Linux && `uname -m` == "x86_64") then |
---|
| 223 | set nomlib=${machine}64_g95 |
---|
| 224 | endif |
---|
| 225 | |
---|
| 226 | ######################################################################## |
---|
| 227 | # lecture des options de mymake |
---|
| 228 | ######################################################################## |
---|
| 229 | |
---|
| 230 | top: |
---|
| 231 | if ($#argv > 0) then |
---|
| 232 | switch ($1:q) |
---|
| 233 | |
---|
| 234 | case -h: |
---|
| 235 | |
---|
| 236 | ######################################################################## |
---|
| 237 | # Manuel en ligne |
---|
| 238 | ######################################################################## |
---|
| 239 | more <<eod |
---|
| 240 | |
---|
| 241 | |
---|
| 242 | makegcm [Options] prog |
---|
| 243 | |
---|
| 244 | |
---|
| 245 | The makegcm script: |
---|
| 246 | ------------------- |
---|
| 247 | |
---|
| 248 | 1. compiles a series of subroutines located in the $LMDGCM/libf |
---|
| 249 | sub-directories. |
---|
| 250 | The objects are then stored in the libraries in $LIBOGCM. |
---|
| 251 | |
---|
| 252 | 2. then, makegcm compiles program prog.f located by default in |
---|
| 253 | $LMDGCM/libf/dyn3d and makes the link with the libraries. |
---|
| 254 | |
---|
| 255 | Environment Variables '$LMDGCM' and '$LIBOGCM' |
---|
| 256 | must be set as environment variables or directly |
---|
| 257 | in the makegcm file. |
---|
| 258 | |
---|
| 259 | The makegcm command is used to control the different versions of the model |
---|
| 260 | in parallel, compiled using the compilation options |
---|
| 261 | and the various dimensions, without having to recompile the whole model. |
---|
| 262 | |
---|
| 263 | The FORTRAN libraries are stored in directory $LIBOGCM. |
---|
| 264 | |
---|
| 265 | |
---|
| 266 | OPTIONS: |
---|
| 267 | -------- |
---|
| 268 | |
---|
| 269 | The following options can either be defined by default by editing the |
---|
| 270 | makegcm "script", or in interactive mode: |
---|
| 271 | |
---|
| 272 | -d imxjmxlm where im, jm, and lm are the number of longitudes, |
---|
| 273 | latitudes and vertical layers respectively. |
---|
| 274 | |
---|
| 275 | -t ntrac Selects the number of tracers present in the model |
---|
| 276 | |
---|
| 277 | Options -d and -t overwrite file |
---|
| 278 | $LMDGCM/libf/grid/dimensions.h |
---|
| 279 | which contains the 3 dimensions of the |
---|
| 280 | horizontal grid |
---|
| 281 | im, jm, lm plus the number of tracers passively advected |
---|
| 282 | by the dynamics ntrac, |
---|
| 283 | in 4 PARAMETER FORTRAN format |
---|
| 284 | with a new file: |
---|
| 285 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
---|
| 286 | If the file does not exist already |
---|
| 287 | it is created by the script |
---|
| 288 | $LMDGCM/libf/grid/dimension/makdim |
---|
| 289 | |
---|
[148] | 290 | -s nscat Number of radiatively active scatterers |
---|
| 291 | |
---|
[38] | 292 | -p PHYS Selects the set of physical parameterizations |
---|
| 293 | you want to compile the model with. |
---|
| 294 | The model is then compiled using the physical |
---|
| 295 | parameterization sources in directory: |
---|
| 296 | $LMDGCM/libf/phyPHYS |
---|
| 297 | |
---|
| 298 | -g grille Selects the grid type. |
---|
| 299 | This option overwrites file |
---|
| 300 | $LMDGCM/libf/grid/fxyprim.h |
---|
| 301 | with file |
---|
| 302 | $LMDGCM/libf/grid/fxy_grille.h |
---|
| 303 | the grid can take the following values: |
---|
| 304 | 1. reg - the regular grid |
---|
| 305 | 2. sin - to obtain equidistant points in terms of sin(latitude) |
---|
| 306 | 3. new - to zoom into a part of the globe |
---|
| 307 | |
---|
| 308 | -O "compilation options" set of fortran compilation options to use |
---|
| 309 | |
---|
| 310 | -include path |
---|
| 311 | Used if the subroutines contain #include files (ccp) that |
---|
| 312 | are located in directories that are not referenced by default. |
---|
| 313 | |
---|
| 314 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
| 315 | |
---|
| 316 | -olddyn To compile GCM with "old dynamics" |
---|
| 317 | |
---|
| 318 | -filtre filter |
---|
| 319 | To select the longitudinal filter in the polar regions. |
---|
| 320 | "filter" corresponds to the name of a directory located in |
---|
| 321 | $LMDGCM/libf. The standard filter for the model is "filtrez" |
---|
| 322 | which can be used for a regular grid and for a |
---|
| 323 | grid with longitudinal zoom. |
---|
| 324 | |
---|
| 325 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
| 326 | Adds a link to FORTRAN libraries |
---|
| 327 | libfile1.a, libfile2.a ... |
---|
| 328 | located in directories dir1, dir2 ...respectively |
---|
| 329 | If dirn is a directory with an automatic path |
---|
| 330 | (/usr/lib ... for example) |
---|
| 331 | there is no need to specify -Ldirn. |
---|
| 332 | |
---|
| 333 | eod |
---|
| 334 | exit |
---|
| 335 | |
---|
| 336 | ######################################################################## |
---|
| 337 | # Lecture des differentes options |
---|
| 338 | ######################################################################## |
---|
| 339 | |
---|
| 340 | case -d: |
---|
| 341 | set dim=$2 ; shift ; shift ; goto top |
---|
| 342 | |
---|
| 343 | case -O: |
---|
| 344 | set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top |
---|
| 345 | |
---|
| 346 | case -p |
---|
| 347 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
---|
| 348 | |
---|
[148] | 349 | case -s |
---|
| 350 | set scatterers="$2" ; shift ; goto top |
---|
| 351 | |
---|
[38] | 352 | case -g |
---|
| 353 | set grille="$2" ; shift ; shift ; goto top |
---|
| 354 | |
---|
| 355 | case -t |
---|
| 356 | set ntrac=$2 ; shift ; shift ; goto top |
---|
| 357 | |
---|
| 358 | case -include |
---|
| 359 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
| 360 | |
---|
| 361 | case -adjnt |
---|
| 362 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
| 363 | |
---|
| 364 | case -olddyn |
---|
| 365 | set dyntype="olddyn" ; shift; goto top |
---|
| 366 | |
---|
| 367 | case -filtre |
---|
| 368 | set filtre=$2 ; shift ; shift ; goto top |
---|
| 369 | |
---|
| 370 | case -link |
---|
| 371 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
---|
| 372 | |
---|
| 373 | case -debug |
---|
| 374 | if $HP then |
---|
| 375 | set optim90=" -g " |
---|
| 376 | else if $SUN then |
---|
| 377 | setenv PARALLEL 4 |
---|
| 378 | set optim90=" -g -C " |
---|
| 379 | set optimtru90=" -g -C " |
---|
| 380 | else if $CRAY then |
---|
| 381 | set optim90="$optim90"" -G1 " |
---|
| 382 | else if $LINUX then |
---|
| 383 | ## for g95 |
---|
| 384 | set optim="-g -Wall -ftrace=full -fbounds-check" |
---|
| 385 | set optim90="-g -Wall -ftrace=full -fbounds-check" |
---|
| 386 | set optimtru90="-g -Wall -ftrace=full -fbounds-check" |
---|
| 387 | else |
---|
| 388 | echo "pas d option debug predefinie pour cette machine" |
---|
| 389 | exit |
---|
| 390 | endif |
---|
| 391 | shift ; goto top |
---|
| 392 | |
---|
| 393 | default |
---|
| 394 | set code="$1" ; shift ; goto top |
---|
| 395 | |
---|
| 396 | endsw |
---|
| 397 | endif |
---|
| 398 | |
---|
| 399 | echo "apres les opts dim $dim" |
---|
| 400 | |
---|
| 401 | ######################################################################## |
---|
| 402 | # cas special sans physique |
---|
| 403 | ######################################################################## |
---|
| 404 | if ( "$physique" == 'nophys' ) then |
---|
| 405 | set phys="L_PHY= LIBPHY=" |
---|
| 406 | endif |
---|
| 407 | |
---|
| 408 | ######################################################################## |
---|
| 409 | # choix du nombre de traceur par defaut si il n'a pas ete choisi, |
---|
| 410 | # suivant la physique |
---|
| 411 | ######################################################################## |
---|
| 412 | |
---|
| 413 | if ( $ntrac == 0 ) then |
---|
| 414 | if ( "$physique" == 'nophys' ) then |
---|
| 415 | set ntrac=1 |
---|
| 416 | else if ( "$physique" == 'lmd' ) then |
---|
| 417 | set ntrac=2 |
---|
| 418 | else if ( "$physique" == 'lmd_test_li' ) then |
---|
| 419 | set ntrac=2 |
---|
| 420 | else if ( "$physique" == 'ec' ) then |
---|
| 421 | set ntrac=1 |
---|
| 422 | else |
---|
| 423 | set ntrac = 1 |
---|
| 424 | endif |
---|
| 425 | endif |
---|
| 426 | |
---|
| 427 | ######################################################################## |
---|
| 428 | #subtilites sur le nom de la librairie |
---|
| 429 | ######################################################################## |
---|
| 430 | |
---|
| 431 | \rm tmp ; touch tmp |
---|
| 432 | \rm tmp90 ; touch tmp90 |
---|
| 433 | foreach i ( $optim90 ) |
---|
| 434 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
| 435 | end |
---|
| 436 | set suf= |
---|
| 437 | foreach i ( `sort tmp | uniq ` ) |
---|
| 438 | set suf=$suf$i |
---|
| 439 | end |
---|
| 440 | if ( ! $IBM ) then |
---|
| 441 | set nomlib="$nomlib$suf" |
---|
| 442 | endif |
---|
| 443 | if ( $DEC ) then |
---|
| 444 | set nomlib=DEC |
---|
| 445 | endif |
---|
| 446 | |
---|
| 447 | # dimension |
---|
| 448 | |
---|
| 449 | echo "dimension avant sed $dim" |
---|
| 450 | if ( $IBM ) then |
---|
| 451 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
| 452 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
| 453 | else if ( $SUN || $XNEC ) then |
---|
| 454 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 455 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 456 | else |
---|
| 457 | # set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'` |
---|
| 458 | # set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'` |
---|
| 459 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 460 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 461 | endif |
---|
| 462 | |
---|
| 463 | # build final name of libraries directory: |
---|
| 464 | if ( "$dyntype" == "olddyn" ) then |
---|
[148] | 465 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn |
---|
[38] | 466 | else |
---|
[148] | 467 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille} |
---|
[38] | 468 | endif |
---|
| 469 | |
---|
| 470 | # Append 'physique' type, if it is not mars, to nomlib |
---|
| 471 | if ( "$physique" != "mars" ) then |
---|
| 472 | set nomlib=${nomlib}_${physique} |
---|
| 473 | endif |
---|
| 474 | |
---|
| 475 | ## M-A-F nomlib trop long sur CRAY pour ar |
---|
| 476 | if ( $CRAY ) then |
---|
| 477 | set nomlib=F90_${dim_}_t${ntrac} |
---|
| 478 | endif |
---|
| 479 | if ( $NEC || $XNEC ) then |
---|
| 480 | set nomlib=F90_${dim_}_t${ntrac} |
---|
| 481 | endif |
---|
| 482 | |
---|
| 483 | echo "calcul de la dimension" |
---|
| 484 | set dimc=`echo $dim | wc -w` |
---|
| 485 | |
---|
| 486 | if ( "$dimc" == "2" ) then |
---|
| 487 | set include="$include "'-I$(LIBF)/dyn2d ' |
---|
| 488 | set dimh=$dim |
---|
| 489 | else |
---|
| 490 | if ( "$dyntype" == "olddyn" ) then |
---|
| 491 | set include="$include "'-I$(LIBF)/olddyn3d ' |
---|
| 492 | else |
---|
| 493 | set include="$include "'-I$(LIBF)/dyn3d ' |
---|
| 494 | endif |
---|
| 495 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
---|
| 496 | endif |
---|
| 497 | echo "dimc is $dimc" |
---|
| 498 | |
---|
| 499 | ######################################################################## |
---|
| 500 | # path pour les #include |
---|
| 501 | ######################################################################## |
---|
| 502 | |
---|
| 503 | set include="$include -I$NCDFINC " |
---|
| 504 | echo $include |
---|
| 505 | |
---|
| 506 | ######################################################################## |
---|
| 507 | # Gestion des dimensions du modele. |
---|
| 508 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
---|
| 509 | ######################################################################## |
---|
| 510 | |
---|
| 511 | cd $libf/grid |
---|
| 512 | if ( -f dimensions.h ) then |
---|
[148] | 513 | echo "WARNING: you are probably already compiling the model (perhaps" |
---|
| 514 | echo " elsewhere). Wait until the first compilation ends before " |
---|
| 515 | echo " compiling a different configuration." |
---|
| 516 | echo "If you are sure that you are not already compiling, then you" |
---|
| 517 | echo " may continue this compilation by answering yes." |
---|
| 518 | echo "Do you want to continue?" |
---|
| 519 | if ( $< == "yes" ) then |
---|
[38] | 520 | #remove old dimensions.h file |
---|
| 521 | \rm -f $libf/grid/dimensions.h |
---|
[148] | 522 | #remove old scatterers.h file |
---|
| 523 | \rm -f $libf/phymars/scatterers.h |
---|
[38] | 524 | else |
---|
| 525 | exit |
---|
| 526 | endif |
---|
| 527 | endif |
---|
| 528 | |
---|
| 529 | # Build the appropriate 'dimensions.h' file |
---|
| 530 | cd dimension |
---|
| 531 | ./makdim $ntrac $dim |
---|
| 532 | # echo contents of dimensions.h to standard output |
---|
| 533 | cat $libf/grid/dimensions.h |
---|
| 534 | |
---|
[148] | 535 | cd $libf/phymars/scatterers |
---|
| 536 | # Build the appropriate 'scatterers.h' file |
---|
| 537 | ./make_scatterers $scatterers |
---|
| 538 | # echo contents of scatterers.h to standard output |
---|
| 539 | cat $libf/phymars/scatterers.h |
---|
| 540 | |
---|
[38] | 541 | cd $LMDGCM |
---|
| 542 | # set path to objects directory |
---|
| 543 | set libo=$libo/$nomlib |
---|
| 544 | # create objects directory, if it doesn't exist |
---|
| 545 | if ( ! -d $libo ) then |
---|
| 546 | mkdir $libo |
---|
| 547 | cd $model |
---|
| 548 | endif |
---|
| 549 | |
---|
| 550 | ######################################################################## |
---|
| 551 | # Differentes dynamiques (3d, 2d, 1d) |
---|
| 552 | ######################################################################## |
---|
| 553 | |
---|
| 554 | set dimension=`echo $dim | wc -w` |
---|
| 555 | echo dimension $dimension dim $dim |
---|
| 556 | if ( $dimension == 1 ) then |
---|
| 557 | echo pas de dynamique |
---|
| 558 | set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
| 559 | endif |
---|
| 560 | endif |
---|
| 561 | |
---|
| 562 | cd $model |
---|
| 563 | if ( $dimension == 3 ) then |
---|
| 564 | cd libf/grid |
---|
| 565 | \rm fxyprim.h |
---|
| 566 | cp -p fxy_${grille}.h fxyprim.h |
---|
| 567 | endif |
---|
| 568 | |
---|
| 569 | ###################################################################### |
---|
| 570 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
| 571 | ###################################################################### |
---|
| 572 | |
---|
| 573 | if ( -f $libf/phy$physique/raddim.h ) then |
---|
| 574 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
---|
| 575 | \rm $libf/phy$physique/raddim.h |
---|
| 576 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
| 577 | echo $libf/phy$physique/raddim.$dimh.h |
---|
| 578 | cat $libf/phy$physique/raddim.$dimh.h |
---|
| 579 | cat $libf/phy$physique/raddim.h |
---|
| 580 | else |
---|
| 581 | echo On peut diminuer la taille de l executable en creant |
---|
| 582 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
| 583 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
| 584 | endif |
---|
| 585 | endif |
---|
| 586 | |
---|
| 587 | ###################################################################### |
---|
| 588 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
| 589 | ###################################################################### |
---|
| 590 | |
---|
| 591 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
| 592 | if ( "$dyntype" == "olddyn" ) then |
---|
| 593 | set filtre="oldfiltrez" |
---|
| 594 | endif |
---|
| 595 | |
---|
| 596 | if ( `expr $dimc \> 2` == 1 ) then |
---|
| 597 | set filtre="FILTRE=$filtre" |
---|
| 598 | else |
---|
| 599 | set filtre="FILTRE= L_FILTRE= " |
---|
| 600 | endif |
---|
| 601 | echo "MACRO FILTRE $filtre" |
---|
| 602 | |
---|
| 603 | echo "dimc $dimc" |
---|
| 604 | |
---|
| 605 | ######################################################################## |
---|
| 606 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
| 607 | ######################################################################## |
---|
| 608 | # c'est a dire dans 3 cas: |
---|
| 609 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
| 610 | # derniere creation du makefile |
---|
| 611 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
| 612 | # n'existe pas. |
---|
| 613 | # 3. Si le makefile n'existe pas. |
---|
| 614 | ######################################################################## |
---|
| 615 | |
---|
| 616 | cd $model |
---|
| 617 | find libf -name '*.[Fh]' -print >! tmp77 |
---|
| 618 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
| 619 | find libf -name '*.[Fh]90' -print >> tmp90 |
---|
| 620 | |
---|
| 621 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
| 622 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
| 623 | || ! -f makefile \ |
---|
| 624 | || ! -f liste_des_sources_f90 \ |
---|
| 625 | || ! -f liste_des_sources_f77 ) then |
---|
| 626 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
| 627 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
| 628 | diff liste_des_sources_f77 tmp77 |
---|
| 629 | diff liste_des_sources_f90 tmp90 |
---|
| 630 | \cp tmp77 liste_des_sources_f77 |
---|
| 631 | \cp tmp90 liste_des_sources_f90 |
---|
| 632 | echo "On recree le makefile" |
---|
| 633 | if ("$dyntype" == "olddyn") then |
---|
| 634 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 635 | else |
---|
| 636 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 637 | endif |
---|
| 638 | \mv tmp makefile |
---|
| 639 | echo "Nouveau makefile cree." |
---|
| 640 | endif |
---|
| 641 | |
---|
| 642 | ######################################################################## |
---|
| 643 | # Execution de la comande make |
---|
| 644 | ######################################################################## |
---|
| 645 | |
---|
| 646 | echo PHYSIQUE $phys |
---|
| 647 | echo dynamique $dyn $dimension |
---|
| 648 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
| 649 | echo PATH pour les fichiers INCLUDE $include |
---|
| 650 | echo OPLINK="$oplink" |
---|
| 651 | |
---|
| 652 | if $HP then |
---|
| 653 | set f77='fort77 +OP' |
---|
| 654 | set f90='jensaisrien' |
---|
| 655 | set opt_link="$opt_link -lm" |
---|
| 656 | else if $VPP then |
---|
| 657 | set f77=frt |
---|
| 658 | set f90=$f77 |
---|
| 659 | else if $CRAY then |
---|
| 660 | set f77=f90 |
---|
| 661 | set f90=f90 |
---|
| 662 | else if $LINUX then |
---|
| 663 | # set f77=pgf90 |
---|
| 664 | # set f90=pgf90 |
---|
| 665 | set f77=g95 |
---|
| 666 | set f90=g95 |
---|
| 667 | else if $SUN then |
---|
| 668 | set f77=f90 |
---|
| 669 | set f90=f90 |
---|
| 670 | else if $NEC then |
---|
| 671 | set f77=f90 |
---|
| 672 | set f90=f90 |
---|
| 673 | else if $XNEC then |
---|
| 674 | set f77=sxmpif90 |
---|
| 675 | set f90=sxmpif90 |
---|
| 676 | else |
---|
| 677 | set f77=f77 |
---|
| 678 | set f90=f90 |
---|
| 679 | endif |
---|
| 680 | |
---|
| 681 | cd $model |
---|
| 682 | |
---|
| 683 | if $VPP then |
---|
| 684 | set make="gmake RANLIB=ls" |
---|
| 685 | else if $CRAY then |
---|
| 686 | set make="make RANLIB=ls" |
---|
| 687 | else if $NEC then |
---|
| 688 | set make="make RANLIB=ls" |
---|
| 689 | else if $LINUX then |
---|
| 690 | set make="make -k RANLIB=ranlib" |
---|
| 691 | else if $XNEC then |
---|
| 692 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
| 693 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
| 694 | else |
---|
| 695 | set make="make RANLIB=ranlib" |
---|
| 696 | endif |
---|
| 697 | |
---|
| 698 | set include="$include"" -I$libf/phy$physique" |
---|
| 699 | |
---|
| 700 | |
---|
| 701 | ################################################################# |
---|
| 702 | # Execution de la comande make... ENFIN! |
---|
| 703 | ################################################################# |
---|
| 704 | |
---|
| 705 | if $VPP then |
---|
| 706 | set optim90=" $optim90 -Am -M$libo" |
---|
| 707 | set optimtru90="$optim90" |
---|
| 708 | else if $SUN then |
---|
| 709 | set optim90=" $optim90 -M$libo" |
---|
| 710 | set optimtru90=" $optimtru90 " |
---|
| 711 | else if $NEC then |
---|
| 712 | set optim90=" $optim90 -I$libo " |
---|
| 713 | else if $XNEC then |
---|
| 714 | set optim90=" $optim90 -I$libo " |
---|
| 715 | set optimtru90=" $optimtru90 -I$libo " |
---|
| 716 | else if $LINUX then |
---|
| 717 | # Ehouarn : adapt to g95 |
---|
| 718 | set optim="$optim -fmod=$libo" |
---|
| 719 | set optim90="$optim90 -fmod=$libo" |
---|
| 720 | set optimtru90="$optimtru90 -fmod=$libo" |
---|
| 721 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
| 722 | # set mod_loc_dir=$libo |
---|
| 723 | endif |
---|
| 724 | |
---|
| 725 | set link="$f90 $optim90" |
---|
| 726 | |
---|
| 727 | set ar=ar |
---|
| 728 | |
---|
| 729 | if $XNEC then |
---|
| 730 | set link="sxld $opt_link" |
---|
| 731 | set link="$f90 " |
---|
| 732 | # set ar=sxar |
---|
| 733 | endif |
---|
| 734 | |
---|
| 735 | |
---|
| 736 | cd $localdir |
---|
| 737 | |
---|
| 738 | echo $make -f $LMDGCM/makefile \ |
---|
| 739 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 740 | OPTIM="$optim" \ |
---|
| 741 | OPTIM90="$optim90" \ |
---|
| 742 | OPTIMTRU90="$optimtru90" \ |
---|
| 743 | INCLUDE="$include" \ |
---|
| 744 | $filtre \ |
---|
| 745 | LIBO=$libo \ |
---|
| 746 | $dyn \ |
---|
| 747 | $phys \ |
---|
| 748 | DIM=$dimc \ |
---|
| 749 | DYNTYPE="$dyntype" \ |
---|
| 750 | L_ADJNT="$adjnt" \ |
---|
| 751 | LOCAL_DIR="$localdir" \ |
---|
| 752 | F77="$f77" \ |
---|
| 753 | F90="$f90" \ |
---|
| 754 | OPLINK="$oplink" \ |
---|
| 755 | LINK="$link" \ |
---|
| 756 | GCM="$LMDGCM" \ |
---|
| 757 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 758 | MOD_SUFFIX=$mod_suffix \ |
---|
| 759 | AR=$ar \ |
---|
| 760 | PROG=$code |
---|
| 761 | |
---|
| 762 | |
---|
| 763 | $make -f $LMDGCM/makefile \ |
---|
| 764 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 765 | OPTIM="$optim" \ |
---|
| 766 | OPTIM90="$optim90" \ |
---|
| 767 | OPTIMTRU90="$optimtru90" \ |
---|
| 768 | INCLUDE="$include" \ |
---|
| 769 | $filtre \ |
---|
| 770 | LIBO=$libo \ |
---|
| 771 | $dyn \ |
---|
| 772 | $phys \ |
---|
| 773 | DIM=$dimc \ |
---|
| 774 | DYNTYPE="$dyntype" \ |
---|
| 775 | L_ADJNT="$adjnt" \ |
---|
| 776 | LOCAL_DIR="$localdir" \ |
---|
| 777 | F77="$f77" \ |
---|
| 778 | F90="$f90" \ |
---|
| 779 | OPLINK="$oplink" \ |
---|
| 780 | LINK="$link" \ |
---|
| 781 | GCM="$LMDGCM" \ |
---|
| 782 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 783 | MOD_SUFFIX=$mod_suffix \ |
---|
| 784 | AR=$ar \ |
---|
| 785 | PROG=$code |
---|
| 786 | |
---|
[148] | 787 | # cleanup, remove dimensions.h and scatterers.h |
---|
| 788 | \rm -f $libf/grid/dimensions.h |
---|
| 789 | \rm -f $libf/phymars/scatterers.h |
---|