[371] | 1 | #!/bin/csh -f |
---|
[135] | 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" |
---|
[671] | 8 | set physique=std |
---|
[135] | 9 | set phys="PHYS=$physique" |
---|
[671] | 10 | set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I.' |
---|
[135] | 11 | set ntrac = 1 |
---|
| 12 | set filtre=filtrez |
---|
| 13 | set grille=reg |
---|
| 14 | set dyntype="dyn" |
---|
[671] | 15 | set bands="32x36" |
---|
| 16 | set scatterers="1" |
---|
[135] | 17 | ######################################################################## |
---|
| 18 | # path a changer contenant les sources et les objets du modele |
---|
| 19 | ######################################################################## |
---|
| 20 | |
---|
| 21 | #### If you want you can set environment variables here |
---|
[371] | 22 | # default LMDGCM is where the makegcm script is: |
---|
| 23 | #setenv LMDGCM `pwd`"/"`dirname $0` # only works for relative paths |
---|
[373] | 24 | set scriptdir=`dirname $0` |
---|
| 25 | setenv LMDGCM `readlink -f $scriptdir` |
---|
[135] | 26 | #setenv LMDGCM /u/emlmd/LMDZ.MARS |
---|
[371] | 27 | setenv LIBOGCM $LMDGCM/libo |
---|
| 28 | # NetCDF |
---|
[671] | 29 | # 64 bit machines what is below is OK on LMD machines |
---|
| 30 | setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_g95/lib |
---|
| 31 | setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_g95/include |
---|
[135] | 32 | #else |
---|
| 33 | # setenv NCDFLIB /distrib/local/netcdf/g95_32bits/lib |
---|
| 34 | # setenv NCDFINC /distrib/local/netcdf/g95_32bits/include |
---|
| 35 | #endif |
---|
| 36 | #### |
---|
| 37 | |
---|
| 38 | setenv localdir "`pwd`" |
---|
| 39 | set MODIPSL=0 |
---|
| 40 | echo $localdir | grep modipsl >& /dev/null |
---|
| 41 | if ( ! $status ) then |
---|
| 42 | set MODIPSL=1 |
---|
| 43 | setenv LMDGCM $localdir |
---|
| 44 | cd ../.. |
---|
| 45 | setenv LIBOGCM "`pwd`/lib" |
---|
| 46 | cd $localdir |
---|
| 47 | if ( `hostname` == rhodes ) then |
---|
| 48 | set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
| 49 | set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
| 50 | else |
---|
| 51 | if ( `hostname` == nymphea0 ) then |
---|
| 52 | set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
| 53 | set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
| 54 | else |
---|
| 55 | echo 'Probleme de definition des variables NCDFINC et NCDFLIB' |
---|
| 56 | endif |
---|
| 57 | endif |
---|
| 58 | else |
---|
| 59 | if ( ! $?LMDGCM ) then |
---|
| 60 | echo You must initialize the variable LMDGCM in your environnement |
---|
| 61 | echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc |
---|
| 62 | exit |
---|
| 63 | endif |
---|
| 64 | if ( ! $?LIBOGCM ) then |
---|
| 65 | set LIBOGCM=$LMDGCM/libo |
---|
| 66 | endif |
---|
| 67 | if ( ! $?NCDFLIB ) then |
---|
| 68 | echo You must initialize the variable NCDFLIB in your environnement |
---|
| 69 | echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc |
---|
| 70 | exit |
---|
| 71 | endif |
---|
| 72 | if ( ! $?NCDFINC ) then |
---|
| 73 | echo You must initialize the variable NCDFINC in your environnement |
---|
| 74 | echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc |
---|
| 75 | exit |
---|
| 76 | endif |
---|
| 77 | endif |
---|
| 78 | set model=$LMDGCM |
---|
| 79 | set libo=$LIBOGCM |
---|
| 80 | |
---|
| 81 | ######################################################################## |
---|
| 82 | # Les differentes platformes reconnues |
---|
| 83 | ######################################################################## |
---|
| 84 | |
---|
| 85 | set HP=0 |
---|
| 86 | set IBM=0 |
---|
| 87 | set SUN=0 |
---|
| 88 | set VPP=0 |
---|
| 89 | set CRAY=0 |
---|
| 90 | set DEC=0 |
---|
| 91 | set LINUX=0 |
---|
| 92 | set NEC=0 |
---|
| 93 | set XNEC=0 |
---|
| 94 | if ( `uname` == HP-UX ) then |
---|
| 95 | set machine=HP |
---|
| 96 | set HP=1 |
---|
| 97 | else if (`uname` == UNIX_System_V ) then |
---|
| 98 | set machine=VPP |
---|
| 99 | set VPP=1 |
---|
| 100 | else if (`uname` == SunOS ) then |
---|
| 101 | set machine=SUN |
---|
| 102 | set SUN=1 |
---|
| 103 | else if ( `uname` == AIX ) then |
---|
| 104 | set machine=IBM |
---|
| 105 | set IBM=1 |
---|
| 106 | else if ( `uname` == OSF1 ) then |
---|
| 107 | set machine=ALPHA |
---|
| 108 | set DEC=1 |
---|
| 109 | else if ( `uname` == Linux ) then |
---|
| 110 | set machine=LINUX |
---|
| 111 | set LINUX=1 |
---|
| 112 | else if ( `hostname` == atlas || `hostname` == axis || `hostname` == etoile ) then |
---|
| 113 | set machine=CRAY |
---|
| 114 | set CRAY=1 |
---|
| 115 | else if ( `uname` == SUPER-UX ) then |
---|
| 116 | set machine=NEC |
---|
| 117 | set NEC=1 |
---|
| 118 | else if ( `hostname` == rhodes) then |
---|
| 119 | set machine=XNEC |
---|
| 120 | set XNEC=1 |
---|
| 121 | else |
---|
| 122 | echo Vous travaillez sur une machine non prevue par le reglement |
---|
| 123 | exit |
---|
| 124 | endif |
---|
| 125 | |
---|
| 126 | # create $libo directory if it doesn't exist |
---|
| 127 | if ( ! -d $libo ) then |
---|
| 128 | mkdir $libo |
---|
| 129 | endif |
---|
| 130 | |
---|
| 131 | if $VPP then |
---|
| 132 | set netcdf=netcdf_v |
---|
| 133 | else |
---|
| 134 | set netcdf=netcdf |
---|
| 135 | endif |
---|
| 136 | ######################################################################## |
---|
| 137 | # Quelques initialisations de variables du shell. |
---|
| 138 | ######################################################################## |
---|
| 139 | |
---|
| 140 | set dyn= |
---|
| 141 | set opt_link="" |
---|
| 142 | set adjnt="" |
---|
| 143 | set opt_dep="" |
---|
| 144 | |
---|
| 145 | set optim90="" |
---|
| 146 | set oplink="" |
---|
| 147 | |
---|
| 148 | ######################################################################## |
---|
| 149 | # Optimisations par defaut suivant les machines |
---|
| 150 | ######################################################################## |
---|
| 151 | |
---|
| 152 | echo "Optimisations par defaut suivant les machines" |
---|
| 153 | set libf=$model/libf |
---|
| 154 | #setenv localdir "LOCAL_DIR=`pwd`" |
---|
| 155 | #setenv localdir "`pwd`" |
---|
| 156 | cd $model |
---|
| 157 | if $CRAY then |
---|
| 158 | set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv ' |
---|
| 159 | set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf " |
---|
| 160 | set mod_loc_dir=" " |
---|
| 161 | set mod_suffix=" " |
---|
| 162 | else if $SUN then |
---|
| 163 | set optim90=" -fast" |
---|
| 164 | set optimtru90=" -fast -free" |
---|
| 165 | set opt_link="-L$NCDFLIB -lnetcdf" |
---|
| 166 | set mod_loc_dir=$localdir |
---|
| 167 | set mod_suffix=mod |
---|
| 168 | else if $HP then |
---|
| 169 | else if $IBM then |
---|
| 170 | else if $VPP then |
---|
| 171 | set optim90="$optim -X9 -w" |
---|
| 172 | if $COUPLE then |
---|
| 173 | 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" |
---|
| 174 | set oplink="-Wl,-t,-P,-dy " |
---|
| 175 | else |
---|
| 176 | set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
| 177 | set oplink="-Wl,-t,-dy " |
---|
| 178 | endif |
---|
| 179 | set mod_loc_dir=$IOIPSLDIR |
---|
| 180 | set mod_suffix=mod |
---|
| 181 | else if $DEC then |
---|
| 182 | else if $LINUX then |
---|
| 183 | # Ehouarn 'g95' compiler |
---|
[671] | 184 | set optim90="-O3 -fstatic -funroll-loops " |
---|
| 185 | set optimtru90="-O3 -fstatic -funroll-loops " |
---|
[135] | 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 | |
---|
[671] | 245 | The makegcm script: |
---|
| 246 | ------------------- |
---|
[135] | 247 | |
---|
[671] | 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. |
---|
[135] | 251 | |
---|
[671] | 252 | 2. then, makegcm compiles program prog.f located by default in |
---|
| 253 | $LMDGCM/libf/dyn3d and makes the link with the libraries. |
---|
[135] | 254 | |
---|
[671] | 255 | Environment Variables '$LMDGCM' and '$LIBOGCM' |
---|
| 256 | must be set as environment variables or directly |
---|
| 257 | in the makegcm file. |
---|
[135] | 258 | |
---|
[671] | 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. |
---|
[135] | 262 | |
---|
[671] | 263 | The FORTRAN libraries are stored in directory $LIBOGCM. |
---|
[135] | 264 | |
---|
| 265 | |
---|
| 266 | OPTIONS: |
---|
| 267 | -------- |
---|
| 268 | |
---|
[671] | 269 | The following options can either be defined by default by editing the |
---|
| 270 | makegcm "script", or in interactive mode: |
---|
[135] | 271 | |
---|
[671] | 272 | -d imxjmxlm where im, jm, and lm are the number of longitudes, |
---|
| 273 | latitudes and vertical layers respectively. |
---|
[135] | 274 | |
---|
[671] | 275 | -t ntrac Selects the number of tracers present in the model |
---|
[135] | 276 | |
---|
[671] | 277 | Options -d and -t overwrite file |
---|
[135] | 278 | $LMDGCM/libf/grid/dimensions.h |
---|
[671] | 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: |
---|
[135] | 285 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
---|
[671] | 286 | If the file does not exist already |
---|
| 287 | it is created by the script |
---|
[135] | 288 | $LMDGCM/libf/grid/dimension/makdim |
---|
| 289 | |
---|
[671] | 290 | -s nscat Number of radiatively active scatterers |
---|
| 291 | |
---|
| 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: |
---|
[135] | 296 | $LMDGCM/libf/phyPHYS |
---|
| 297 | |
---|
[671] | 298 | -g grille Selects the grid type. |
---|
| 299 | This option overwrites file |
---|
[135] | 300 | $LMDGCM/libf/grid/fxyprim.h |
---|
[671] | 301 | with file |
---|
[135] | 302 | $LMDGCM/libf/grid/fxy_grille.h |
---|
[671] | 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 |
---|
[135] | 307 | |
---|
[671] | 308 | -O "compilation options" set of fortran compilation options to use |
---|
[135] | 309 | |
---|
| 310 | -include path |
---|
[671] | 311 | Used if the subroutines contain #include files (ccp) that |
---|
| 312 | are located in directories that are not referenced by default. |
---|
[135] | 313 | |
---|
[671] | 314 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
[135] | 315 | |
---|
| 316 | -olddyn To compile GCM with "old dynamics" |
---|
| 317 | |
---|
[671] | 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. |
---|
[135] | 324 | |
---|
| 325 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
[671] | 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. |
---|
[135] | 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 optim90="$2" ; shift ; shift ; goto top |
---|
| 345 | |
---|
| 346 | case -p |
---|
| 347 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
---|
| 348 | |
---|
[671] | 349 | case -s |
---|
| 350 | set scatterers="$2" ; shift ; goto top |
---|
| 351 | |
---|
[135] | 352 | case -g |
---|
| 353 | set grille="$2" ; shift ; shift ; goto top |
---|
| 354 | |
---|
[671] | 355 | case -b |
---|
| 356 | set bands=$2 ; shift ; shift ; goto top |
---|
| 357 | |
---|
[135] | 358 | case -t |
---|
| 359 | set ntrac=$2 ; shift ; shift ; goto top |
---|
| 360 | |
---|
| 361 | case -include |
---|
| 362 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
| 363 | |
---|
| 364 | case -adjnt |
---|
| 365 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
| 366 | |
---|
| 367 | case -olddyn |
---|
| 368 | set dyntype="olddyn" ; shift; goto top |
---|
| 369 | |
---|
| 370 | case -filtre |
---|
| 371 | set filtre=$2 ; shift ; shift ; goto top |
---|
| 372 | |
---|
| 373 | case -link |
---|
| 374 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
---|
| 375 | |
---|
| 376 | case -debug |
---|
| 377 | if $HP then |
---|
| 378 | set optim90=" -g " |
---|
| 379 | else if $SUN then |
---|
| 380 | setenv PARALLEL 4 |
---|
| 381 | set optim90=" -g -C " |
---|
| 382 | set optimtru90=" -g -C " |
---|
| 383 | else if $CRAY then |
---|
| 384 | set optim90="$optim90"" -G1 " |
---|
| 385 | else if $LINUX then |
---|
[671] | 386 | ## for g95 |
---|
| 387 | set optim="-g -Wall -ftrace=full -fbounds-check" |
---|
| 388 | set optim90="-g -Wall -ftrace=full -fbounds-check" |
---|
| 389 | set optimtru90="-g -Wall -ftrace=full -fbounds-check" |
---|
[135] | 390 | else |
---|
| 391 | echo "pas d option debug predefinie pour cette machine" |
---|
| 392 | exit |
---|
| 393 | endif |
---|
| 394 | shift ; goto top |
---|
| 395 | |
---|
| 396 | default |
---|
| 397 | set code="$1" ; shift ; goto top |
---|
| 398 | |
---|
| 399 | endsw |
---|
| 400 | endif |
---|
| 401 | |
---|
| 402 | echo "apres les opts dim $dim" |
---|
| 403 | |
---|
| 404 | ######################################################################## |
---|
| 405 | # cas special sans physique |
---|
| 406 | ######################################################################## |
---|
| 407 | if ( "$physique" == 'nophys' ) then |
---|
| 408 | set phys="L_PHY= LIBPHY=" |
---|
| 409 | endif |
---|
| 410 | |
---|
| 411 | ######################################################################## |
---|
| 412 | #subtilites sur le nom de la librairie |
---|
| 413 | ######################################################################## |
---|
| 414 | |
---|
| 415 | \rm tmp ; touch tmp |
---|
| 416 | \rm tmp90 ; touch tmp90 |
---|
| 417 | foreach i ( $optim90 ) |
---|
| 418 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
| 419 | end |
---|
| 420 | set suf= |
---|
| 421 | foreach i ( `sort tmp | uniq ` ) |
---|
| 422 | set suf=$suf$i |
---|
| 423 | end |
---|
| 424 | if ( ! $IBM ) then |
---|
| 425 | set nomlib="$nomlib$suf" |
---|
| 426 | endif |
---|
| 427 | if ( $DEC ) then |
---|
| 428 | set nomlib=DEC |
---|
| 429 | endif |
---|
| 430 | |
---|
| 431 | # dimension |
---|
| 432 | echo "dimension avant sed $dim" |
---|
| 433 | if ( $IBM ) then |
---|
| 434 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
| 435 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
| 436 | else if ( $SUN || $XNEC ) then |
---|
| 437 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 438 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 439 | else |
---|
| 440 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 441 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 442 | endif |
---|
| 443 | |
---|
[671] | 444 | # bands |
---|
| 445 | echo "bands avant sed $bands" |
---|
| 446 | if ( $IBM ) then |
---|
| 447 | set bands=`echo $bands | sed -en 's/[^0-9]/ /g'` |
---|
| 448 | set bands_=`echo $bands | sed -en 's/[^0-9]/_/g'` |
---|
| 449 | else if ( $SUN || $XNEC ) then |
---|
| 450 | set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` |
---|
| 451 | set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'` |
---|
| 452 | else |
---|
| 453 | set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` |
---|
| 454 | set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'` |
---|
| 455 | endif |
---|
| 456 | |
---|
| 457 | |
---|
[135] | 458 | # build final name of libraries directory: |
---|
| 459 | if ( "$dyntype" == "olddyn" ) then |
---|
[671] | 460 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn |
---|
[135] | 461 | else |
---|
[671] | 462 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille} |
---|
[135] | 463 | endif |
---|
| 464 | |
---|
[671] | 465 | # Append number of bands to nomlib (new for universal model) |
---|
| 466 | set nomlib=${nomlib}_${bands_} |
---|
| 467 | |
---|
[135] | 468 | # Append 'physique' type, if it is not mars, to nomlib |
---|
| 469 | if ( "$physique" != "mars" ) then |
---|
| 470 | set nomlib=${nomlib}_${physique} |
---|
| 471 | endif |
---|
| 472 | |
---|
| 473 | ## M-A-F nomlib trop long sur CRAY pour ar |
---|
| 474 | if ( $CRAY ) then |
---|
| 475 | set nomlib=F90_${dim_}_t${ntrac} |
---|
| 476 | endif |
---|
| 477 | if ( $NEC || $XNEC ) then |
---|
| 478 | set nomlib=F90_${dim_}_t${ntrac} |
---|
| 479 | endif |
---|
| 480 | |
---|
| 481 | echo "calcul de la dimension" |
---|
| 482 | set dimc=`echo $dim | wc -w` |
---|
| 483 | |
---|
| 484 | if ( "$dimc" == "2" ) then |
---|
| 485 | set include="$include "'-I$(LIBF)/dyn2d ' |
---|
| 486 | set dimh=$dim |
---|
| 487 | else |
---|
| 488 | if ( "$dyntype" == "olddyn" ) then |
---|
| 489 | set include="$include "'-I$(LIBF)/olddyn3d ' |
---|
| 490 | else |
---|
| 491 | set include="$include "'-I$(LIBF)/dyn3d ' |
---|
| 492 | endif |
---|
| 493 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
---|
| 494 | endif |
---|
| 495 | echo "dimc is $dimc" |
---|
| 496 | |
---|
| 497 | ######################################################################## |
---|
| 498 | # path pour les #include |
---|
| 499 | ######################################################################## |
---|
| 500 | |
---|
| 501 | set include="$include -I$NCDFINC " |
---|
| 502 | echo $include |
---|
| 503 | |
---|
| 504 | ######################################################################## |
---|
| 505 | # Gestion des dimensions du modele. |
---|
| 506 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
---|
| 507 | ######################################################################## |
---|
| 508 | |
---|
| 509 | cd $libf/grid |
---|
| 510 | if ( -f dimensions.h ) then |
---|
[671] | 511 | echo "WARNING: you are already compiling the model somewhere else" |
---|
| 512 | echo "Wait until the first compilation is finished before starting." |
---|
| 513 | echo "If you are sure that you are not compiling elsewhere, you can" |
---|
| 514 | echo "type [yes] to continue." |
---|
| 515 | echo "Do you want to continue?" |
---|
| 516 | if ( $< == "yes" ) then |
---|
| 517 | #remove old dimensions.h , bands.h and scatterers.h files |
---|
| 518 | \rm -f $libf/grid/dimensions.h |
---|
| 519 | \rm -f $libf/grid/bands.h |
---|
| 520 | \rm -f $libf/phy${physique}/scatterers.h |
---|
[135] | 521 | else |
---|
| 522 | exit |
---|
| 523 | endif |
---|
| 524 | endif |
---|
| 525 | |
---|
| 526 | # Build the appropriate 'dimensions.h' file |
---|
| 527 | cd dimension |
---|
| 528 | makdim $ntrac $dim |
---|
| 529 | # echo contents of dimensions.h to standard output |
---|
| 530 | cat $libf/grid/dimensions.h |
---|
| 531 | |
---|
[671] | 532 | # Build the appropriate 'bands.h' file |
---|
| 533 | makbands $bands |
---|
| 534 | # echo contents of bands.h to standard output |
---|
| 535 | cat $libf/grid/bands.h |
---|
| 536 | |
---|
| 537 | # Build the appropriate 'scatterers.h' file |
---|
| 538 | cd $libf/phy$physique/scatterers |
---|
| 539 | ./make_scatterers $scatterers |
---|
| 540 | # echo contents of scatterers.h to standard output |
---|
| 541 | cat $libf/phy$physique/scatterers.h |
---|
| 542 | |
---|
[135] | 543 | cd $LMDGCM |
---|
| 544 | # set path to objects directory |
---|
| 545 | set libo=$libo/$nomlib |
---|
| 546 | # create objects directory, if it doesn't exist |
---|
| 547 | if ( ! -d $libo ) then |
---|
| 548 | mkdir $libo |
---|
| 549 | cd $model |
---|
| 550 | endif |
---|
| 551 | |
---|
| 552 | ######################################################################## |
---|
| 553 | # Differentes dynamiques (3d, 2d, 1d) |
---|
| 554 | ######################################################################## |
---|
| 555 | |
---|
| 556 | set dimension=`echo $dim | wc -w` |
---|
| 557 | echo dimension $dimension dim $dim |
---|
| 558 | if ( $dimension == 1 ) then |
---|
| 559 | echo pas de dynamique |
---|
| 560 | set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
| 561 | endif |
---|
| 562 | endif |
---|
| 563 | |
---|
| 564 | cd $model |
---|
| 565 | if ( $dimension == 3 ) then |
---|
| 566 | cd libf/grid |
---|
| 567 | \rm fxyprim.h |
---|
| 568 | cp -p fxy_${grille}.h fxyprim.h |
---|
| 569 | endif |
---|
| 570 | |
---|
| 571 | ###################################################################### |
---|
| 572 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
| 573 | ###################################################################### |
---|
| 574 | |
---|
| 575 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
| 576 | if ( "$dyntype" == "olddyn" ) then |
---|
| 577 | set filtre="oldfiltrez" |
---|
| 578 | endif |
---|
| 579 | |
---|
| 580 | if ( `expr $dimc \> 2` == 1 ) then |
---|
| 581 | set filtre="FILTRE=$filtre" |
---|
| 582 | else |
---|
| 583 | set filtre="FILTRE= L_FILTRE= " |
---|
| 584 | endif |
---|
| 585 | echo "MACRO FILTRE $filtre" |
---|
| 586 | |
---|
| 587 | echo "dimc $dimc" |
---|
| 588 | |
---|
| 589 | ######################################################################## |
---|
| 590 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
| 591 | ######################################################################## |
---|
| 592 | # c'est a dire dans 3 cas: |
---|
| 593 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
| 594 | # derniere creation du makefile |
---|
| 595 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
| 596 | # n'existe pas. |
---|
| 597 | # 3. Si le makefile n'existe pas. |
---|
| 598 | ######################################################################## |
---|
| 599 | |
---|
| 600 | cd $model |
---|
[646] | 601 | find libf -name '*.[Fh]' -print | sort >! tmp77 |
---|
[135] | 602 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
[646] | 603 | find libf -name '*.[Fh]90' -print | sort >> tmp90 |
---|
[135] | 604 | |
---|
| 605 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
| 606 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
| 607 | || ! -f makefile \ |
---|
| 608 | || ! -f liste_des_sources_f90 \ |
---|
| 609 | || ! -f liste_des_sources_f77 ) then |
---|
| 610 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
| 611 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
| 612 | diff liste_des_sources_f77 tmp77 |
---|
| 613 | diff liste_des_sources_f90 tmp90 |
---|
| 614 | \cp tmp77 liste_des_sources_f77 |
---|
| 615 | \cp tmp90 liste_des_sources_f90 |
---|
| 616 | echo "On recree le makefile" |
---|
| 617 | if ("$dyntype" == "olddyn") then |
---|
| 618 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 619 | else |
---|
| 620 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 621 | endif |
---|
| 622 | \mv tmp makefile |
---|
| 623 | echo "Nouveau makefile cree." |
---|
| 624 | endif |
---|
| 625 | |
---|
| 626 | ######################################################################## |
---|
| 627 | # Execution de la comande make |
---|
| 628 | ######################################################################## |
---|
| 629 | |
---|
| 630 | echo PHYSIQUE $phys |
---|
| 631 | echo dynamique $dyn $dimension |
---|
| 632 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
| 633 | echo PATH pour les fichiers INCLUDE $include |
---|
| 634 | echo OPLINK="$oplink" |
---|
| 635 | |
---|
| 636 | if $HP then |
---|
| 637 | set f77='fort77 +OP' |
---|
| 638 | set f90='jensaisrien' |
---|
| 639 | set opt_link="$opt_link -lm" |
---|
| 640 | else if $VPP then |
---|
| 641 | set f77=frt |
---|
| 642 | set f90=$f77 |
---|
| 643 | else if $CRAY then |
---|
| 644 | set f77=f90 |
---|
| 645 | set f90=f90 |
---|
| 646 | else if $LINUX then |
---|
| 647 | # set f77=pgf90 |
---|
| 648 | # set f90=pgf90 |
---|
| 649 | set f77=g95 |
---|
| 650 | set f90=g95 |
---|
| 651 | else if $SUN then |
---|
| 652 | set f77=f90 |
---|
| 653 | set f90=f90 |
---|
| 654 | else if $NEC then |
---|
| 655 | set f77=f90 |
---|
| 656 | set f90=f90 |
---|
| 657 | else if $XNEC then |
---|
| 658 | set f77=sxmpif90 |
---|
| 659 | set f90=sxmpif90 |
---|
| 660 | else |
---|
| 661 | set f77=f77 |
---|
| 662 | set f90=f90 |
---|
| 663 | endif |
---|
| 664 | |
---|
| 665 | cd $model |
---|
| 666 | |
---|
| 667 | if $VPP then |
---|
| 668 | set make="gmake RANLIB=ls" |
---|
| 669 | else if $CRAY then |
---|
| 670 | set make="make RANLIB=ls" |
---|
| 671 | else if $NEC then |
---|
| 672 | set make="make RANLIB=ls" |
---|
| 673 | else if $LINUX then |
---|
| 674 | set make="make -k RANLIB=ranlib" |
---|
| 675 | else if $XNEC then |
---|
| 676 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
| 677 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
| 678 | else |
---|
| 679 | set make="make RANLIB=ranlib" |
---|
| 680 | endif |
---|
| 681 | |
---|
| 682 | # |
---|
| 683 | # etat0_netcdf a besoin d'info de la physique |
---|
| 684 | # A revoir |
---|
| 685 | set include="$include"" -I$libf/phy$physique" |
---|
| 686 | |
---|
| 687 | |
---|
| 688 | ################################################################# |
---|
| 689 | # Execution de la comande make... ENFIN! |
---|
| 690 | ################################################################# |
---|
| 691 | |
---|
| 692 | if $VPP then |
---|
| 693 | set optim90=" $optim90 -Am -M$libo" |
---|
| 694 | set optimtru90="$optim90" |
---|
| 695 | else if $SUN then |
---|
| 696 | set optim90=" $optim90 -M$libo" |
---|
| 697 | set optimtru90=" $optimtru90 " |
---|
| 698 | else if $NEC then |
---|
| 699 | set optim90=" $optim90 -I$libo " |
---|
| 700 | else if $XNEC then |
---|
| 701 | set optim90=" $optim90 -I$libo " |
---|
| 702 | set optimtru90=" $optimtru90 -I$libo " |
---|
| 703 | else if $LINUX then |
---|
| 704 | # Ehouarn : adapt to g95 |
---|
| 705 | set optim90="$optim90 -fmod=$libo" |
---|
| 706 | set optimtru90="$optimtru90 -fmod=$libo" |
---|
| 707 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
| 708 | # set mod_loc_dir=$libo |
---|
| 709 | endif |
---|
| 710 | |
---|
| 711 | set link="$f90 $optim90" |
---|
| 712 | |
---|
| 713 | set ar=ar |
---|
| 714 | |
---|
| 715 | if $XNEC then |
---|
| 716 | set link="sxld $opt_link" |
---|
| 717 | set link="$f90 " |
---|
| 718 | # set ar=sxar |
---|
| 719 | endif |
---|
| 720 | |
---|
| 721 | cd $localdir |
---|
| 722 | |
---|
[371] | 723 | set source_code=${code}.F |
---|
| 724 | if (-f $LMDGCM/libf/phystd/${code}.F90) then |
---|
| 725 | set source_code=${code}.F90 |
---|
| 726 | endif |
---|
| 727 | |
---|
[135] | 728 | echo $make -f $LMDGCM/makefile \ |
---|
| 729 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 730 | OPTIM90="$optim90" \ |
---|
| 731 | OPTIMTRU90="$optimtru90" \ |
---|
| 732 | INCLUDE="$include" \ |
---|
| 733 | $filtre \ |
---|
| 734 | LIBO=$libo \ |
---|
| 735 | $dyn \ |
---|
| 736 | $phys \ |
---|
| 737 | DIM=$dimc \ |
---|
| 738 | DYNTYPE="$dyntype" \ |
---|
| 739 | L_ADJNT="$adjnt" \ |
---|
| 740 | LOCAL_DIR="$localdir" \ |
---|
| 741 | F77="$f77" \ |
---|
| 742 | F90="$f90" \ |
---|
| 743 | OPLINK="$oplink" \ |
---|
| 744 | LINK="$link" \ |
---|
| 745 | GCM="$LMDGCM" \ |
---|
| 746 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 747 | MOD_SUFFIX=$mod_suffix \ |
---|
| 748 | AR=$ar \ |
---|
[371] | 749 | SOURCE=$source_code \ |
---|
[135] | 750 | PROG=$code |
---|
| 751 | |
---|
| 752 | |
---|
| 753 | $make -f $LMDGCM/makefile \ |
---|
| 754 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 755 | OPTIM90="$optim90" \ |
---|
| 756 | OPTIMTRU90="$optimtru90" \ |
---|
| 757 | INCLUDE="$include" \ |
---|
| 758 | $filtre \ |
---|
| 759 | LIBO=$libo \ |
---|
| 760 | $dyn \ |
---|
| 761 | $phys \ |
---|
| 762 | DIM=$dimc \ |
---|
| 763 | DYNTYPE="$dyntype" \ |
---|
| 764 | L_ADJNT="$adjnt" \ |
---|
| 765 | LOCAL_DIR="$localdir" \ |
---|
| 766 | F77="$f77" \ |
---|
| 767 | F90="$f90" \ |
---|
| 768 | OPLINK="$oplink" \ |
---|
| 769 | LINK="$link" \ |
---|
| 770 | GCM="$LMDGCM" \ |
---|
| 771 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 772 | MOD_SUFFIX=$mod_suffix \ |
---|
| 773 | AR=$ar \ |
---|
[371] | 774 | SOURCE=$source_code \ |
---|
[135] | 775 | PROG=$code |
---|
| 776 | |
---|
[671] | 777 | \rm -f $libf/grid/dimensions.h |
---|
| 778 | \rm -f $libf/grid/bands.h |
---|
| 779 | \rm -f $libf/phy$physique/scatterers.h |
---|