[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_gfortran/lib |
---|
| 30 | # setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_gfortran/include |
---|
| 31 | #else |
---|
| 32 | # setenv NCDFLIB /donnees/emlmd/netcdf-4.0.1_gfortran/lib |
---|
| 33 | # setenv NCDFINC /donnees/emlmd/netcdf-4.0.1_gfortran/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 'gfortran' compiler |
---|
| 183 | set optim="-O3 -funroll-loops " |
---|
| 184 | set optim90="-O3 -funroll-loops " |
---|
| 185 | set optimtru90="-O3 -funroll-loops " |
---|
| 186 | # |
---|
| 187 | set opt_link=" -L$NCDFLIB -lnetcdf " |
---|
| 188 | set mod_loc_dir=$localdir |
---|
| 189 | set mod_suffix=mod |
---|
| 190 | else if $NEC then |
---|
| 191 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 192 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
| 193 | ### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v " |
---|
| 194 | set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib -lnetcdf_i8r8 " |
---|
| 195 | set mod_loc_dir="." |
---|
| 196 | set mod_suffix="mod" |
---|
| 197 | else if $XNEC then |
---|
| 198 | set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 199 | set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
| 200 | if $MODIPSL then |
---|
| 201 | if $COUPLE then |
---|
| 202 | set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 203 | else |
---|
| 204 | set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
| 205 | endif |
---|
| 206 | set mod_loc_dir="./" |
---|
| 207 | else |
---|
| 208 | #### 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" |
---|
| 209 | set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
| 210 | set mod_loc_dir="." |
---|
| 211 | endif |
---|
| 212 | set mod_suffix="mod" |
---|
| 213 | |
---|
| 214 | endif |
---|
| 215 | |
---|
| 216 | # Ehouarn: add 'g9fortran' string to pathname |
---|
| 217 | set nomlib=${machine}_gfortran |
---|
| 218 | |
---|
| 219 | # Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64) |
---|
| 220 | if (`uname` == Linux && `uname -m` == "x86_64") then |
---|
| 221 | set nomlib=${machine}64_gfortran |
---|
| 222 | endif |
---|
| 223 | |
---|
| 224 | ######################################################################## |
---|
| 225 | # lecture des options de mymake |
---|
| 226 | ######################################################################## |
---|
| 227 | |
---|
| 228 | top: |
---|
| 229 | if ($#argv > 0) then |
---|
| 230 | switch ($1:q) |
---|
| 231 | |
---|
| 232 | case -h: |
---|
| 233 | |
---|
| 234 | ######################################################################## |
---|
| 235 | # Manuel en ligne |
---|
| 236 | ######################################################################## |
---|
| 237 | more <<eod |
---|
| 238 | |
---|
| 239 | |
---|
| 240 | makegcm [Options] prog |
---|
| 241 | |
---|
| 242 | |
---|
| 243 | The makegcm script: |
---|
| 244 | ------------------- |
---|
| 245 | |
---|
| 246 | 1. compiles a series of subroutines located in the $LMDGCM/libf |
---|
| 247 | sub-directories. |
---|
| 248 | The objects are then stored in the libraries in $LIBOGCM. |
---|
| 249 | |
---|
| 250 | 2. then, makegcm compiles program prog.f located by default in |
---|
| 251 | $LMDGCM/libf/dyn3d and makes the link with the libraries. |
---|
| 252 | |
---|
| 253 | Environment Variables '$LMDGCM' and '$LIBOGCM' |
---|
| 254 | must be set as environment variables or directly |
---|
| 255 | in the makegcm file. |
---|
| 256 | |
---|
| 257 | The makegcm command is used to control the different versions of the model |
---|
| 258 | in parallel, compiled using the compilation options |
---|
| 259 | and the various dimensions, without having to recompile the whole model. |
---|
| 260 | |
---|
| 261 | The FORTRAN libraries are stored in directory $LIBOGCM. |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | OPTIONS: |
---|
| 265 | -------- |
---|
| 266 | |
---|
| 267 | The following options can either be defined by default by editing the |
---|
| 268 | makegcm "script", or in interactive mode: |
---|
| 269 | |
---|
| 270 | -d imxjmxlm where im, jm, and lm are the number of longitudes, |
---|
| 271 | latitudes and vertical layers respectively. |
---|
| 272 | |
---|
| 273 | -t ntrac Selects the number of tracers present in the model |
---|
| 274 | |
---|
| 275 | Options -d and -t overwrite file |
---|
| 276 | $LMDGCM/libf/grid/dimensions.h |
---|
| 277 | which contains the 3 dimensions of the |
---|
| 278 | horizontal grid |
---|
| 279 | im, jm, lm plus the number of tracers passively advected |
---|
| 280 | by the dynamics ntrac, |
---|
| 281 | in 4 PARAMETER FORTRAN format |
---|
| 282 | with a new file: |
---|
| 283 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
---|
| 284 | If the file does not exist already |
---|
| 285 | it is created by the script |
---|
| 286 | $LMDGCM/libf/grid/dimension/makdim |
---|
| 287 | |
---|
[148] | 288 | -s nscat Number of radiatively active scatterers |
---|
| 289 | |
---|
[38] | 290 | -p PHYS Selects the set of physical parameterizations |
---|
| 291 | you want to compile the model with. |
---|
| 292 | The model is then compiled using the physical |
---|
| 293 | parameterization sources in directory: |
---|
| 294 | $LMDGCM/libf/phyPHYS |
---|
| 295 | |
---|
| 296 | -g grille Selects the grid type. |
---|
| 297 | This option overwrites file |
---|
| 298 | $LMDGCM/libf/grid/fxyprim.h |
---|
| 299 | with file |
---|
| 300 | $LMDGCM/libf/grid/fxy_grille.h |
---|
| 301 | the grid can take the following values: |
---|
| 302 | 1. reg - the regular grid |
---|
| 303 | 2. sin - to obtain equidistant points in terms of sin(latitude) |
---|
| 304 | 3. new - to zoom into a part of the globe |
---|
| 305 | |
---|
| 306 | -O "compilation options" set of fortran compilation options to use |
---|
| 307 | |
---|
| 308 | -include path |
---|
| 309 | Used if the subroutines contain #include files (ccp) that |
---|
| 310 | are located in directories that are not referenced by default. |
---|
| 311 | |
---|
| 312 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
| 313 | |
---|
| 314 | -olddyn To compile GCM with "old dynamics" |
---|
| 315 | |
---|
| 316 | -filtre filter |
---|
| 317 | To select the longitudinal filter in the polar regions. |
---|
| 318 | "filter" corresponds to the name of a directory located in |
---|
| 319 | $LMDGCM/libf. The standard filter for the model is "filtrez" |
---|
| 320 | which can be used for a regular grid and for a |
---|
| 321 | grid with longitudinal zoom. |
---|
| 322 | |
---|
| 323 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
| 324 | Adds a link to FORTRAN libraries |
---|
| 325 | libfile1.a, libfile2.a ... |
---|
| 326 | located in directories dir1, dir2 ...respectively |
---|
| 327 | If dirn is a directory with an automatic path |
---|
| 328 | (/usr/lib ... for example) |
---|
| 329 | there is no need to specify -Ldirn. |
---|
| 330 | |
---|
| 331 | eod |
---|
| 332 | exit |
---|
| 333 | |
---|
| 334 | ######################################################################## |
---|
| 335 | # Lecture des differentes options |
---|
| 336 | ######################################################################## |
---|
| 337 | |
---|
| 338 | case -d: |
---|
| 339 | set dim=$2 ; shift ; shift ; goto top |
---|
| 340 | |
---|
| 341 | case -O: |
---|
| 342 | set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top |
---|
| 343 | |
---|
| 344 | case -p |
---|
| 345 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
---|
| 346 | |
---|
[148] | 347 | case -s |
---|
| 348 | set scatterers="$2" ; shift ; goto top |
---|
| 349 | |
---|
[38] | 350 | case -g |
---|
| 351 | set grille="$2" ; shift ; shift ; goto top |
---|
| 352 | |
---|
| 353 | case -t |
---|
| 354 | set ntrac=$2 ; shift ; shift ; goto top |
---|
| 355 | |
---|
| 356 | case -include |
---|
| 357 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
| 358 | |
---|
| 359 | case -adjnt |
---|
| 360 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
| 361 | |
---|
| 362 | case -olddyn |
---|
| 363 | set dyntype="olddyn" ; shift; goto top |
---|
| 364 | |
---|
| 365 | case -filtre |
---|
| 366 | set filtre=$2 ; shift ; shift ; goto top |
---|
| 367 | |
---|
| 368 | case -link |
---|
| 369 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
---|
| 370 | |
---|
| 371 | case -debug |
---|
| 372 | if $HP then |
---|
| 373 | set optim90=" -g " |
---|
| 374 | else if $SUN then |
---|
| 375 | setenv PARALLEL 4 |
---|
| 376 | set optim90=" -g -C " |
---|
| 377 | set optimtru90=" -g -C " |
---|
| 378 | else if $CRAY then |
---|
| 379 | set optim90="$optim90"" -G1 " |
---|
| 380 | else if $LINUX then |
---|
| 381 | ## for gfortran |
---|
| 382 | set optim="-g -Wall -fcheck=all -fwhole-file -fbounds-check -ffpe-trap=invalid,zero,overflow" |
---|
| 383 | set optim90="-g -Wall -fcheck=all -fwhole-file -fbounds-check -ffpe-trap=invalid,zero,overflow" |
---|
| 384 | set optimtru90="-g -Wall -fcheck=all -fwhole-file -fbounds-check -ffpe-trap=invalid,zero,overflow" |
---|
| 385 | else |
---|
| 386 | echo "pas d option debug predefinie pour cette machine" |
---|
| 387 | exit |
---|
| 388 | endif |
---|
| 389 | shift ; goto top |
---|
| 390 | |
---|
| 391 | default |
---|
| 392 | set code="$1" ; shift ; goto top |
---|
| 393 | |
---|
| 394 | endsw |
---|
| 395 | endif |
---|
| 396 | |
---|
| 397 | echo "apres les opts dim $dim" |
---|
| 398 | |
---|
| 399 | ######################################################################## |
---|
| 400 | # cas special sans physique |
---|
| 401 | ######################################################################## |
---|
| 402 | if ( "$physique" == 'nophys' ) then |
---|
| 403 | set phys="L_PHY= LIBPHY=" |
---|
| 404 | endif |
---|
| 405 | |
---|
| 406 | ######################################################################## |
---|
| 407 | # choix du nombre de traceur par defaut si il n'a pas ete choisi, |
---|
| 408 | # suivant la physique |
---|
| 409 | ######################################################################## |
---|
| 410 | |
---|
| 411 | if ( $ntrac == 0 ) then |
---|
| 412 | if ( "$physique" == 'nophys' ) then |
---|
| 413 | set ntrac=1 |
---|
| 414 | else if ( "$physique" == 'lmd' ) then |
---|
| 415 | set ntrac=2 |
---|
| 416 | else if ( "$physique" == 'lmd_test_li' ) then |
---|
| 417 | set ntrac=2 |
---|
| 418 | else if ( "$physique" == 'ec' ) then |
---|
| 419 | set ntrac=1 |
---|
| 420 | else |
---|
| 421 | set ntrac = 1 |
---|
| 422 | endif |
---|
| 423 | endif |
---|
| 424 | |
---|
| 425 | ######################################################################## |
---|
| 426 | #subtilites sur le nom de la librairie |
---|
| 427 | ######################################################################## |
---|
| 428 | |
---|
| 429 | \rm tmp ; touch tmp |
---|
| 430 | \rm tmp90 ; touch tmp90 |
---|
| 431 | foreach i ( $optim90 ) |
---|
| 432 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
| 433 | end |
---|
| 434 | set suf= |
---|
| 435 | foreach i ( `sort tmp | uniq ` ) |
---|
| 436 | set suf=$suf$i |
---|
| 437 | end |
---|
| 438 | if ( ! $IBM ) then |
---|
| 439 | set nomlib="$nomlib$suf" |
---|
| 440 | endif |
---|
| 441 | if ( $DEC ) then |
---|
| 442 | set nomlib=DEC |
---|
| 443 | endif |
---|
| 444 | |
---|
| 445 | # dimension |
---|
| 446 | |
---|
| 447 | echo "dimension avant sed $dim" |
---|
| 448 | if ( $IBM ) then |
---|
| 449 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
| 450 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
| 451 | else if ( $SUN || $XNEC ) then |
---|
| 452 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 453 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 454 | else |
---|
| 455 | # set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'` |
---|
| 456 | # set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'` |
---|
| 457 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 458 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
| 459 | endif |
---|
| 460 | |
---|
| 461 | # build final name of libraries directory: |
---|
| 462 | if ( "$dyntype" == "olddyn" ) then |
---|
[148] | 463 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn |
---|
[38] | 464 | else |
---|
[148] | 465 | set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille} |
---|
[38] | 466 | endif |
---|
| 467 | |
---|
| 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 |
---|
[148] | 511 | echo "WARNING: you are probably already compiling the model (perhaps" |
---|
| 512 | echo " elsewhere). Wait until the first compilation ends before " |
---|
| 513 | echo " compiling a different configuration." |
---|
| 514 | echo "If you are sure that you are not already compiling, then you" |
---|
| 515 | echo " may continue this compilation by answering yes." |
---|
| 516 | echo "Do you want to continue?" |
---|
| 517 | if ( $< == "yes" ) then |
---|
[38] | 518 | #remove old dimensions.h file |
---|
| 519 | \rm -f $libf/grid/dimensions.h |
---|
[148] | 520 | #remove old scatterers.h file |
---|
| 521 | \rm -f $libf/phymars/scatterers.h |
---|
[38] | 522 | else |
---|
| 523 | exit |
---|
| 524 | endif |
---|
| 525 | endif |
---|
| 526 | |
---|
| 527 | # Build the appropriate 'dimensions.h' file |
---|
| 528 | cd dimension |
---|
| 529 | ./makdim $ntrac $dim |
---|
| 530 | # echo contents of dimensions.h to standard output |
---|
| 531 | cat $libf/grid/dimensions.h |
---|
| 532 | |
---|
[148] | 533 | cd $libf/phymars/scatterers |
---|
| 534 | # Build the appropriate 'scatterers.h' file |
---|
| 535 | ./make_scatterers $scatterers |
---|
| 536 | # echo contents of scatterers.h to standard output |
---|
| 537 | cat $libf/phymars/scatterers.h |
---|
| 538 | |
---|
[38] | 539 | cd $LMDGCM |
---|
| 540 | # set path to objects directory |
---|
| 541 | set libo=$libo/$nomlib |
---|
| 542 | # create objects directory, if it doesn't exist |
---|
| 543 | if ( ! -d $libo ) then |
---|
| 544 | mkdir $libo |
---|
| 545 | cd $model |
---|
| 546 | endif |
---|
| 547 | |
---|
| 548 | ######################################################################## |
---|
| 549 | # Differentes dynamiques (3d, 2d, 1d) |
---|
| 550 | ######################################################################## |
---|
| 551 | |
---|
| 552 | set dimension=`echo $dim | wc -w` |
---|
| 553 | echo dimension $dimension dim $dim |
---|
| 554 | if ( $dimension == 1 ) then |
---|
| 555 | echo pas de dynamique |
---|
| 556 | set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
| 557 | endif |
---|
| 558 | endif |
---|
| 559 | |
---|
| 560 | cd $model |
---|
| 561 | if ( $dimension == 3 ) then |
---|
| 562 | cd libf/grid |
---|
| 563 | \rm fxyprim.h |
---|
| 564 | cp -p fxy_${grille}.h fxyprim.h |
---|
| 565 | endif |
---|
| 566 | |
---|
| 567 | ###################################################################### |
---|
| 568 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
| 569 | ###################################################################### |
---|
| 570 | |
---|
| 571 | if ( -f $libf/phy$physique/raddim.h ) then |
---|
| 572 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
---|
| 573 | \rm $libf/phy$physique/raddim.h |
---|
| 574 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
| 575 | echo $libf/phy$physique/raddim.$dimh.h |
---|
| 576 | cat $libf/phy$physique/raddim.$dimh.h |
---|
| 577 | cat $libf/phy$physique/raddim.h |
---|
| 578 | else |
---|
| 579 | echo On peut diminuer la taille de l executable en creant |
---|
| 580 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
| 581 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
| 582 | endif |
---|
| 583 | endif |
---|
| 584 | |
---|
| 585 | ###################################################################### |
---|
| 586 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
| 587 | ###################################################################### |
---|
| 588 | |
---|
| 589 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
| 590 | if ( "$dyntype" == "olddyn" ) then |
---|
| 591 | set filtre="oldfiltrez" |
---|
| 592 | endif |
---|
| 593 | |
---|
| 594 | if ( `expr $dimc \> 2` == 1 ) then |
---|
| 595 | set filtre="FILTRE=$filtre" |
---|
| 596 | else |
---|
| 597 | set filtre="FILTRE= L_FILTRE= " |
---|
| 598 | endif |
---|
| 599 | echo "MACRO FILTRE $filtre" |
---|
| 600 | |
---|
| 601 | echo "dimc $dimc" |
---|
| 602 | |
---|
| 603 | ######################################################################## |
---|
| 604 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
| 605 | ######################################################################## |
---|
| 606 | # c'est a dire dans 3 cas: |
---|
| 607 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
| 608 | # derniere creation du makefile |
---|
| 609 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
| 610 | # n'existe pas. |
---|
| 611 | # 3. Si le makefile n'existe pas. |
---|
| 612 | ######################################################################## |
---|
| 613 | |
---|
| 614 | cd $model |
---|
| 615 | find libf -name '*.[Fh]' -print >! tmp77 |
---|
| 616 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
| 617 | find libf -name '*.[Fh]90' -print >> tmp90 |
---|
| 618 | |
---|
| 619 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
| 620 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
| 621 | || ! -f makefile \ |
---|
| 622 | || ! -f liste_des_sources_f90 \ |
---|
| 623 | || ! -f liste_des_sources_f77 ) then |
---|
| 624 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
| 625 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
| 626 | diff liste_des_sources_f77 tmp77 |
---|
| 627 | diff liste_des_sources_f90 tmp90 |
---|
| 628 | \cp tmp77 liste_des_sources_f77 |
---|
| 629 | \cp tmp90 liste_des_sources_f90 |
---|
| 630 | echo "On recree le makefile" |
---|
| 631 | if ("$dyntype" == "olddyn") then |
---|
| 632 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 633 | else |
---|
| 634 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
| 635 | endif |
---|
| 636 | \mv tmp makefile |
---|
| 637 | echo "Nouveau makefile cree." |
---|
| 638 | endif |
---|
| 639 | |
---|
| 640 | ######################################################################## |
---|
| 641 | # Execution de la comande make |
---|
| 642 | ######################################################################## |
---|
| 643 | |
---|
| 644 | echo PHYSIQUE $phys |
---|
| 645 | echo dynamique $dyn $dimension |
---|
| 646 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
| 647 | echo PATH pour les fichiers INCLUDE $include |
---|
| 648 | echo OPLINK="$oplink" |
---|
| 649 | |
---|
| 650 | if $HP then |
---|
| 651 | set f77='fort77 +OP' |
---|
| 652 | set f90='jensaisrien' |
---|
| 653 | set opt_link="$opt_link -lm" |
---|
| 654 | else if $VPP then |
---|
| 655 | set f77=frt |
---|
| 656 | set f90=$f77 |
---|
| 657 | else if $CRAY then |
---|
| 658 | set f77=f90 |
---|
| 659 | set f90=f90 |
---|
| 660 | else if $LINUX then |
---|
| 661 | # set f77=pgf90 |
---|
| 662 | # set f90=pgf90 |
---|
| 663 | set f77=gfortran |
---|
| 664 | set f90=gfortran |
---|
| 665 | else if $SUN then |
---|
| 666 | set f77=f90 |
---|
| 667 | set f90=f90 |
---|
| 668 | else if $NEC then |
---|
| 669 | set f77=f90 |
---|
| 670 | set f90=f90 |
---|
| 671 | else if $XNEC then |
---|
| 672 | set f77=sxmpif90 |
---|
| 673 | set f90=sxmpif90 |
---|
| 674 | else |
---|
| 675 | set f77=f77 |
---|
| 676 | set f90=f90 |
---|
| 677 | endif |
---|
| 678 | |
---|
| 679 | cd $model |
---|
| 680 | |
---|
| 681 | if $VPP then |
---|
| 682 | set make="gmake RANLIB=ls" |
---|
| 683 | else if $CRAY then |
---|
| 684 | set make="make RANLIB=ls" |
---|
| 685 | else if $NEC then |
---|
| 686 | set make="make RANLIB=ls" |
---|
| 687 | else if $LINUX then |
---|
| 688 | set make="make -k RANLIB=ranlib" |
---|
| 689 | else if $XNEC then |
---|
| 690 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
| 691 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
| 692 | else |
---|
| 693 | set make="make RANLIB=ranlib" |
---|
| 694 | endif |
---|
| 695 | |
---|
| 696 | set include="$include"" -I$libf/phy$physique" |
---|
| 697 | |
---|
| 698 | |
---|
| 699 | ################################################################# |
---|
| 700 | # Execution de la comande make... ENFIN! |
---|
| 701 | ################################################################# |
---|
| 702 | |
---|
| 703 | if $VPP then |
---|
| 704 | set optim90=" $optim90 -Am -M$libo" |
---|
| 705 | set optimtru90="$optim90" |
---|
| 706 | else if $SUN then |
---|
| 707 | set optim90=" $optim90 -M$libo" |
---|
| 708 | set optimtru90=" $optimtru90 " |
---|
| 709 | else if $NEC then |
---|
| 710 | set optim90=" $optim90 -I$libo " |
---|
| 711 | else if $XNEC then |
---|
| 712 | set optim90=" $optim90 -I$libo " |
---|
| 713 | set optimtru90=" $optimtru90 -I$libo " |
---|
| 714 | else if $LINUX then |
---|
| 715 | # Ehouarn : adapt to gfortran |
---|
| 716 | set optim="$optim -I${libo}" |
---|
| 717 | set optim90="$optim90 -I${libo}" |
---|
| 718 | set optimtru90="$optimtru90 -ffree-form -I${libo}" |
---|
| 719 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
| 720 | # set mod_loc_dir=$libo |
---|
| 721 | endif |
---|
| 722 | |
---|
| 723 | set link="$f90 $optim90" |
---|
| 724 | |
---|
| 725 | set ar=ar |
---|
| 726 | |
---|
| 727 | if $XNEC then |
---|
| 728 | set link="sxld $opt_link" |
---|
| 729 | set link="$f90 " |
---|
| 730 | # set ar=sxar |
---|
| 731 | endif |
---|
| 732 | |
---|
| 733 | |
---|
| 734 | cd $localdir |
---|
| 735 | |
---|
| 736 | echo $make -f $LMDGCM/makefile \ |
---|
| 737 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 738 | OPTIM="$optim" \ |
---|
| 739 | OPTIM90="$optim90" \ |
---|
| 740 | OPTIMTRU90="$optimtru90" \ |
---|
| 741 | INCLUDE="$include" \ |
---|
| 742 | $filtre \ |
---|
| 743 | LIBO=$libo \ |
---|
| 744 | $dyn \ |
---|
| 745 | $phys \ |
---|
| 746 | DIM=$dimc \ |
---|
| 747 | DYNTYPE="$dyntype" \ |
---|
| 748 | L_ADJNT="$adjnt" \ |
---|
| 749 | LOCAL_DIR="$localdir" \ |
---|
| 750 | F77="$f77" \ |
---|
| 751 | F90="$f90" \ |
---|
| 752 | OPLINK="$oplink" \ |
---|
| 753 | LINK="$link" \ |
---|
| 754 | GCM="$LMDGCM" \ |
---|
| 755 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 756 | MOD_SUFFIX=$mod_suffix \ |
---|
| 757 | AR=$ar \ |
---|
| 758 | PROG=$code |
---|
| 759 | |
---|
| 760 | |
---|
| 761 | $make -f $LMDGCM/makefile \ |
---|
| 762 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
| 763 | OPTIM="$optim" \ |
---|
| 764 | OPTIM90="$optim90" \ |
---|
| 765 | OPTIMTRU90="$optimtru90" \ |
---|
| 766 | INCLUDE="$include" \ |
---|
| 767 | $filtre \ |
---|
| 768 | LIBO=$libo \ |
---|
| 769 | $dyn \ |
---|
| 770 | $phys \ |
---|
| 771 | DIM=$dimc \ |
---|
| 772 | DYNTYPE="$dyntype" \ |
---|
| 773 | L_ADJNT="$adjnt" \ |
---|
| 774 | LOCAL_DIR="$localdir" \ |
---|
| 775 | F77="$f77" \ |
---|
| 776 | F90="$f90" \ |
---|
| 777 | OPLINK="$oplink" \ |
---|
| 778 | LINK="$link" \ |
---|
| 779 | GCM="$LMDGCM" \ |
---|
| 780 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 781 | MOD_SUFFIX=$mod_suffix \ |
---|
| 782 | AR=$ar \ |
---|
| 783 | PROG=$code |
---|
| 784 | |
---|
[148] | 785 | # cleanup, remove dimensions.h and scatterers.h |
---|
| 786 | \rm -f $libf/grid/dimensions.h |
---|
| 787 | \rm -f $libf/phymars/scatterers.h |
---|