1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 #------------------------------------------------------------------------------
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
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/>.
25 # etc/config/settings.sh
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-<VERSION>/etc/bashrc
31 #------------------------------------------------------------------------------
43 # prefix to LD_LIBRARY_PATH
48 export LD_LIBRARY_PATH
=$1:$LD_LIBRARY_PATH
58 export MANPATH
=$1:$MANPATH
63 #------------------------------------------------------------------------------
64 # Set environment variables according to system type
65 export WM_ARCH
=`uname -s`
77 case "$WM_ARCH_OPTION" in
79 export WM_COMPILER_ARCH
=64
82 export WM_CFLAGS
='-m32 -fPIC'
83 export WM_CXXFLAGS
='-m32 -fPIC'
84 export WM_LDFLAGS
='-m32'
88 export WM_COMPILER_LIB_ARCH
=64
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"
103 export WM_COMPILER
=I64
109 export WM_COMPILER_LIB_ARCH
=64
112 export WM_CFLAGS
='-mabi=64 -fPIC'
113 export WM_CXXFLAGS
='-mabi=64 -fPIC'
114 export WM_LDFLAGS
='-mabi=64 -G0'
119 export WM_COMPILER_LIB_ARCH
=64
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
136 export WM_COMPILER_LIB_ARCH
=64
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
147 Your "$WM_ARCH" operating system is not supported by this release
148 of OpenFOAM. For further assistance, please contact www.OpenFOAM.org
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" ]
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
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
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
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" ]
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
226 gcc_version
=gcc-4.4
.3
227 gmp_version
=gmp-5.0
.1
228 mpfr_version
=mpfr-2.4
.2
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
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
243 gcc_version
=gcc-4.4
.3
244 gmp_version
=gmp-5.0
.1
245 mpfr_version
=mpfr-2.4
.2
248 gcc_version
=gcc-4.3
.3
249 gmp_version
=gmp-4.2
.4
250 mpfr_version
=mpfr-2.4
.1
253 # using clang - not gcc
255 export WM_CXX
='clang++'
256 #clang_version=llvm-2.9
257 clang_version
=llvm-svn
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"
268 # optional configuration tweaks:
269 _foamSource
`$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.sh`
271 if [ -n "$gcc_version" ]
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" ] ||
{
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'"
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 ]
295 _foamAddLib
$gccDir/lib
$WM_COMPILER_LIB_ARCH
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" ]
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" ]
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" ] ||
{
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'"
332 _foamAddMan
$clangDir/share
/man
333 _foamAddPath
$clangDir/bin
335 unset clang_version clangDir
338 # okay, use system compiler
341 echo "Warn: foamCompiler='$foamCompiler' is unsupported" 1>&2
342 echo " treating as 'system' instead" 1>&2
348 # add c++0x flags for external programs
350 if [ -n "$WM_CXXFLAGS" ]
352 case "$WM_COMPILER" in
354 WM_CXXFLAGS
="$WM_CXXFLAGS -std=c++0x"
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" ]
372 if [ -d "$BOOST_ARCH_PATH" ]
374 _foamAddLib
$BOOST_ARCH_PATH/lib
376 unset BOOST_ARCH_PATH
378 _foamAddLib
$CGAL_ARCH_PATH/lib
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
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
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" ]
422 echo "Using system installed MPI:"
423 echo " compile flags : $PINC"
424 echo " link flags : $PLIBS"
425 echo " libmpi dir : $libDir"
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
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
454 export FOAM_MPI
=hpmpi
455 export MPI_HOME
=/opt
/hpmpi
456 export MPI_ARCH_PATH
=$MPI_HOME
458 _foamAddPath
$MPI_ARCH_PATH/bin
462 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia32
466 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_amd64
469 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia64
472 echo Unknown processor
type `uname -m` for Linux
478 export FOAM_MPI
=gamma
479 export MPI_ARCH_PATH
=/usr
484 export MPI_ARCH_PATH
=/opt
/mpi
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
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
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
]
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 ]
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