BUG: pointPatchFieldNew: incorrect end() iterator
[OpenFOAM-2.0.x.git] / etc / config / settings.sh
blobdaf8ef1e578d3f60911c0401f5c25ff87954dfd3
1 #----------------------------------*-sh-*--------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6 # \\/ M anipulation |
7 #------------------------------------------------------------------------------
8 # License
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 # File
25 # etc/config/settings.sh
27 # Description
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-<VERSION>/etc/bashrc
31 #------------------------------------------------------------------------------
33 # prefix to PATH
34 _foamAddPath()
36 while [ $# -ge 1 ]
38 export PATH=$1:$PATH
39 shift
40 done
43 # prefix to LD_LIBRARY_PATH
44 _foamAddLib()
46 while [ $# -ge 1 ]
48 export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
49 shift
50 done
53 # prefix to MANPATH
54 _foamAddMan()
56 while [ $# -ge 1 ]
58 export MANPATH=$1:$MANPATH
59 shift
60 done
63 #------------------------------------------------------------------------------
64 # Set environment variables according to system type
65 export WM_ARCH=`uname -s`
67 case "$WM_ARCH" in
68 Linux)
69 WM_ARCH=linux
71 # compiler specifics
72 case `uname -m` in
73 i686)
76 x86_64)
77 case "$WM_ARCH_OPTION" in
78 32)
79 export WM_COMPILER_ARCH=64
80 export WM_CC='gcc'
81 export WM_CXX='g++'
82 export WM_CFLAGS='-m32 -fPIC'
83 export WM_CXXFLAGS='-m32 -fPIC'
84 export WM_LDFLAGS='-m32'
86 64)
87 WM_ARCH=linux64
88 export WM_COMPILER_LIB_ARCH=64
89 export WM_CC='gcc'
90 export WM_CXX='g++'
91 export WM_CFLAGS='-m64 -fPIC'
92 export WM_CXXFLAGS='-m64 -fPIC'
93 export WM_LDFLAGS='-m64'
96 echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
98 esac
101 ia64)
102 WM_ARCH=linuxIA64
103 export WM_COMPILER=I64
106 mips64)
107 WM_ARCH=SiCortex64
108 WM_MPLIB=MPI
109 export WM_COMPILER_LIB_ARCH=64
110 export WM_CC='gcc'
111 export WM_CXX='g++'
112 export WM_CFLAGS='-mabi=64 -fPIC'
113 export WM_CXXFLAGS='-mabi=64 -fPIC'
114 export WM_LDFLAGS='-mabi=64 -G0'
117 ppc64)
118 WM_ARCH=linuxPPC64
119 export WM_COMPILER_LIB_ARCH=64
120 export WM_CC='gcc'
121 export WM_CXX='g++'
122 export WM_CFLAGS='-m64 -fPIC'
123 export WM_CXXFLAGS='-m64 -fPIC'
124 export WM_LDFLAGS='-m64'
128 echo Unknown processor type `uname -m` for Linux
130 esac
133 SunOS)
134 WM_ARCH=SunOS64
135 WM_MPLIB=FJMPI
136 export WM_COMPILER_LIB_ARCH=64
137 export WM_CC='gcc'
138 export WM_CXX='g++'
139 export WM_CFLAGS='-mabi=64 -fPIC'
140 export WM_CXXFLAGS='-mabi=64 -fPIC'
141 export WM_LDFLAGS='-mabi=64 -G0'
144 *) # an unsupported operating system
145 cat <<USAGE
147 Your "$WM_ARCH" operating system is not supported by this release
148 of OpenFOAM. For further assistance, please contact www.OpenFOAM.org
150 USAGE
152 esac
155 #------------------------------------------------------------------------------
157 # location of the jobControl directory
158 export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
160 # wmake configuration
161 export WM_DIR=$WM_PROJECT_DIR/wmake
162 export WM_LINK_LANGUAGE=c++
163 export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
165 # base executables/libraries
166 export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
167 export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
169 # external (ThirdParty) libraries
170 export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
172 # shared site executables/libraries
173 # similar naming convention as ~OpenFOAM expansion
174 if [ -n "$WM_PROJECT_SITE" ]
175 then
176 export FOAM_SITE_APPBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
177 export FOAM_SITE_LIBBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
178 else
179 export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
180 export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
183 # user executables/libraries
184 export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
185 export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
187 # dynamicCode templates
188 # - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
189 # export FOAM_CODE_TEMPLATES=$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
191 # convenience
192 export FOAM_APP=$WM_PROJECT_DIR/applications
193 export FOAM_SRC=$WM_PROJECT_DIR/src
194 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
195 export FOAM_UTILITIES=$FOAM_APP/utilities
196 export FOAM_SOLVERS=$FOAM_APP/solvers
197 export FOAM_RUN=$WM_PROJECT_USER_DIR/run
199 # add wmake to the path - not required for runtime only environment
200 [ -d "$WM_DIR" ] && PATH=$WM_DIR:$PATH
201 # add OpenFOAM scripts to the path
202 export PATH=$WM_PROJECT_DIR/bin:$PATH
204 _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
205 # Make sure to pick up dummy versions of external libraries last
206 _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
208 # Compiler settings
209 # ~~~~~~~~~~~~~~~~~
210 unset gcc_version gmp_version mpfr_version mpc_version
211 unset MPFR_ARCH_PATH GMP_ARCH_PATH
213 # Location of compiler installation
214 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215 if [ -z "$foamCompiler" ]
216 then
217 foamCompiler=system
218 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
219 echo " foamCompiler not set, using '$foamCompiler'" 1>&2
222 case "${foamCompiler}" in
223 OpenFOAM | ThirdParty)
224 case "$WM_COMPILER" in
225 Gcc | Gcc++0x)
226 gcc_version=gcc-4.4.3
227 gmp_version=gmp-5.0.1
228 mpfr_version=mpfr-2.4.2
230 Gcc46 | Gcc46++0x)
231 gcc_version=gcc-4.6.1
232 gmp_version=gmp-5.0.1
233 mpfr_version=mpfr-2.4.2
234 mpc_version=mpc-0.8.1
236 Gcc45 | Gcc45++0x)
237 gcc_version=gcc-4.5.2
238 gmp_version=gmp-5.0.1
239 mpfr_version=mpfr-2.4.2
240 mpc_version=mpc-0.8.1
242 Gcc44 | Gcc44++0x)
243 gcc_version=gcc-4.4.3
244 gmp_version=gmp-5.0.1
245 mpfr_version=mpfr-2.4.2
247 Gcc43)
248 gcc_version=gcc-4.3.3
249 gmp_version=gmp-4.2.4
250 mpfr_version=mpfr-2.4.1
252 Clang)
253 # using clang - not gcc
254 export WM_CC='clang'
255 export WM_CXX='clang++'
256 #clang_version=llvm-2.9
257 clang_version=llvm-svn
260 echo
261 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:"
262 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
263 echo " Please check your settings"
264 echo
266 esac
268 # optional configuration tweaks:
269 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.sh`
271 if [ -n "$gcc_version" ]
272 then
273 gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
274 gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
275 mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
276 mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
278 # Check that the compiler directory can be found
279 [ -d "$gccDir" ] || {
280 echo
281 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:"
282 echo " Cannot find $gccDir installation."
283 echo " Please install this compiler version or if you wish to use the system compiler,"
284 echo " change the 'foamCompiler' setting to 'system'"
285 echo
288 _foamAddMan $gccDir/man
289 _foamAddPath $gccDir/bin
291 # add compiler libraries to run-time environment
292 # 64-bit needs lib64, but 32-bit needs lib (not lib32)
293 if [ "$WM_ARCH_OPTION" = 64 ]
294 then
295 _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
296 else
297 _foamAddLib $gccDir/lib
301 # add gmp/mpfr libraries to run-time environment
302 _foamAddLib $gmpDir/lib
303 _foamAddLib $mpfrDir/lib
305 # add mpc libraries (not need for older gcc) to run-time environment
306 if [ -n "$mpc_version" ]
307 then
308 _foamAddLib $mpcDir/lib
311 # used by boost/CGAL:
312 export MPFR_ARCH_PATH=$mpfrDir
313 export GMP_ARCH_PATH=$gmpDir
315 unset gcc_version gccDir
316 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
318 if [ -n "$clang_version" ]
319 then
320 clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
322 # Check that the compiler directory can be found
323 [ -d "$clangDir" ] || {
324 echo
325 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:"
326 echo " Cannot find $clangDir installation."
327 echo " Please install this compiler version or if you wish to use the system compiler,"
328 echo " change the 'foamCompiler' setting to 'system'"
329 echo
332 _foamAddMan $clangDir/share/man
333 _foamAddPath $clangDir/bin
335 unset clang_version clangDir
337 system)
338 # okay, use system compiler
341 echo "Warn: foamCompiler='$foamCompiler' is unsupported" 1>&2
342 echo " treating as 'system' instead" 1>&2
344 esac
348 # add c++0x flags for external programs
350 if [ -n "$WM_CXXFLAGS" ]
351 then
352 case "$WM_COMPILER" in
353 Gcc*++0x)
354 WM_CXXFLAGS="$WM_CXXFLAGS -std=c++0x"
356 esac
360 # boost and CGAL
361 # ~~~~~~~~~~~~~~
363 boost_version=boost_1_45_0
364 cgal_version=CGAL-3.8
366 export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
367 export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
369 # enabled if CGAL is available
370 if [ -d "$CGAL_ARCH_PATH" ]
371 then
372 if [ -d "$BOOST_ARCH_PATH" ]
373 then
374 _foamAddLib $BOOST_ARCH_PATH/lib
375 else
376 unset BOOST_ARCH_PATH
378 _foamAddLib $CGAL_ARCH_PATH/lib
379 else
380 unset BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH GMP_ARCH_PATH
383 unset boost_version cgal_version
386 # Communications library
387 # ~~~~~~~~~~~~~~~~~~~~~~
389 unset MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
391 case "$WM_MPLIB" in
392 OPENMPI)
393 export FOAM_MPI=openmpi-1.5.3
394 # optional configuration tweaks:
395 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.sh`
397 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
399 # Tell OpenMPI where to find its install directory
400 export OPAL_PREFIX=$MPI_ARCH_PATH
402 _foamAddPath $MPI_ARCH_PATH/bin
403 _foamAddLib $MPI_ARCH_PATH/lib
404 _foamAddMan $MPI_ARCH_PATH/man
407 SYSTEMOPENMPI)
408 # Use the system installed openmpi, get library directory via mpicc
409 export FOAM_MPI=openmpi-system
411 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
412 export PINC="`mpicc --showme:compile`"
413 export PLIBS="`mpicc --showme:link`"
414 libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
416 # Bit of a hack: strip off 'lib' and hope this is the path to openmpi
417 # include files and libraries.
418 export MPI_ARCH_PATH="${libDir%/*}"
420 if [ "$FOAM_VERBOSE" -a "$PS1" ]
421 then
422 echo "Using system installed MPI:"
423 echo " compile flags : $PINC"
424 echo " link flags : $PLIBS"
425 echo " libmpi dir : $libDir"
428 _foamAddLib $libDir
429 unset libDir
432 MPICH)
433 export FOAM_MPI=mpich2-1.1.1p1
434 export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
435 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
437 _foamAddPath $MPI_ARCH_PATH/bin
438 _foamAddLib $MPI_ARCH_PATH/lib
439 _foamAddMan $MPI_ARCH_PATH/share/man
442 MPICH-GM)
443 export FOAM_MPI=mpich-gm
444 export MPI_ARCH_PATH=/opt/mpi
445 export MPICH_PATH=$MPI_ARCH_PATH
446 export GM_LIB_PATH=/opt/gm/lib64
448 _foamAddPath $MPI_ARCH_PATH/bin
449 _foamAddLib $MPI_ARCH_PATH/lib
450 _foamAddLib $GM_LIB_PATH
453 HPMPI)
454 export FOAM_MPI=hpmpi
455 export MPI_HOME=/opt/hpmpi
456 export MPI_ARCH_PATH=$MPI_HOME
458 _foamAddPath $MPI_ARCH_PATH/bin
460 case `uname -m` in
461 i686)
462 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
465 x86_64)
466 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
468 ia64)
469 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
472 echo Unknown processor type `uname -m` for Linux
474 esac
477 GAMMA)
478 export FOAM_MPI=gamma
479 export MPI_ARCH_PATH=/usr
482 MPI)
483 export FOAM_MPI=mpi
484 export MPI_ARCH_PATH=/opt/mpi
487 FJMPI)
488 export FOAM_MPI=fjmpi
489 export MPI_ARCH_PATH=/opt/FJSVmpi2
491 _foamAddPath $MPI_ARCH_PATH/bin
492 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
493 _foamAddLib /opt/FSUNf90/lib/sparcv9
494 _foamAddLib /opt/FJSVpnidt/lib
497 QSMPI)
498 export FOAM_MPI=qsmpi
499 export MPI_ARCH_PATH=/usr/lib/mpi
501 _foamAddPath $MPI_ARCH_PATH/bin
502 _foamAddLib $MPI_ARCH_PATH/lib
506 export FOAM_MPI=dummy
508 esac
510 # add (non-dummy) MPI implementation
511 # dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
512 if [ "$FOAM_MPI" != dummy ]
513 then
514 _foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI
519 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
520 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
521 : ${minBufferSize:=20000000}
523 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
524 then
525 MPI_BUFFER_SIZE=$minBufferSize
527 export MPI_BUFFER_SIZE
530 # cleanup environment:
531 # ~~~~~~~~~~~~~~~~~~~~
532 unset _foamAddPath _foamAddLib _foamAddMan foamCompiler minBufferSize
534 # ----------------------------------------------------------------- end-of-file