1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright held by original author
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 the
13 # Free Software Foundation; either version 2 of the License, or (at your
14 # 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, write to the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 # Startup file for OpenFOAM
30 # Sourced from OpenFOAM-??/etc/bashrc
32 #------------------------------------------------------------------------------
44 # prefix to LD_LIBRARY_PATH
49 export LD_LIBRARY_PATH
=$1:$LD_LIBRARY_PATH
50 if [ "$WM_ARCH_BASE" == "darwin" ]
52 export DYLD_LIBRARY_PATH
=$1:$DYLD_LIBRARY_PATH
58 # Source files, possibly with some verbosity
59 # Yes, this is the same definition as in the file etc/bash
60 # We need that definition available for scripts sourcing
61 # settings.sh directly.
66 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
72 # location of the jobControl directory
73 export FOAM_JOB_DIR
=$WM_PROJECT_INST_DIR/jobControl
76 export WM_DIR
=$WM_PROJECT_DIR/wmake
77 export WM_LINK_LANGUAGE
=c
++
78 export WM_OPTIONS
=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
79 export PATH
=$WM_DIR:$PATH
81 #export WM_DECOMP_INC=-DCELL_DECOMP
82 #export WM_DECOMP_LIBS="-lcellDecompFiniteElement -lcellDecompositionMotionSolver"
83 export WM_DECOMP_INC
=-DFACE_DECOMP
84 export WM_DECOMP_LIBS
="-lfaceDecompFiniteElement -lfaceDecompositionMotionSolver"
87 export FOAM_APP
=$WM_PROJECT_DIR/applications
88 export FOAM_APPBIN
=$WM_PROJECT_DIR/applications
/bin
/$WM_OPTIONS
89 export FOAM_LIB
=$WM_PROJECT_DIR/lib
90 export FOAM_LIBBIN
=$WM_PROJECT_DIR/lib
/$WM_OPTIONS
91 export FOAM_SRC
=$WM_PROJECT_DIR/src
93 # shared site configuration - similar naming convention as ~OpenFOAM expansion
94 export FOAM_SITE_APPBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/bin
/$WM_OPTIONS
95 export FOAM_SITE_LIBBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/lib
/$WM_OPTIONS
98 export FOAM_USER_APPBIN
=$WM_PROJECT_USER_DIR/applications
/bin
/$WM_OPTIONS
99 export FOAM_USER_LIBBIN
=$WM_PROJECT_USER_DIR/lib
/$WM_OPTIONS
102 export FOAM_TUTORIALS
=$WM_PROJECT_DIR/tutorials
103 export FOAM_UTILITIES
=$FOAM_APP/utilities
104 export FOAM_SOLVERS
=$FOAM_APP/solvers
105 export FOAM_RUN
=$WM_PROJECT_USER_DIR/run
107 # add OpenFOAM scripts and wmake to the path
108 export PATH
=$WM_DIR:$WM_PROJECT_DIR/bin
:$PATH
110 _foamAddPath
$FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
111 # Make sure to pick up dummy versions of external libraries last
112 _foamAddLib
$FOAM_LIBBIN/dummy
113 _foamAddLib
$FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
118 unset compilerBin compilerLib
120 # Select compiler installation
121 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122 # compilerInstall = OpenFOAM | System
123 #compilerInstall=OpenFOAM
124 compilerInstall
=System
126 case "${compilerInstall:-OpenFOAM}" in
128 case "$WM_COMPILER" in
130 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.3
.3/platforms
/$WM_ARCH$WM_COMPILER_ARCH
131 _foamAddLib
$WM_THIRD_PARTY_DIR/mpfr-2.4
.1/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
132 _foamAddLib
$WM_THIRD_PARTY_DIR/gmp-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
135 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.3
.3/platforms
/$WM_ARCH$WM_COMPILER_ARCH
136 _foamAddLib
$WM_THIRD_PARTY_DIR/mpfr-2.4
.1/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
137 _foamAddLib
$WM_THIRD_PARTY_DIR/gmp-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
140 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH
144 # Check that the compiler directory can be found
145 if [ ! -d "$WM_COMPILER_DIR" ]
148 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
149 echo " Cannot find $WM_COMPILER_DIR installation."
150 echo " Please install this compiler version or if you wish to use the system compiler,"
151 echo " change the 'compilerInstall' setting to 'System' in this file"
155 compilerBin
=$WM_COMPILER_DIR/bin
156 compilerLib
=$WM_COMPILER_DIR/lib
$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
160 if [ -d "$compilerBin" ]
162 _foamAddPath
$compilerBin
163 _foamAddLib
$compilerLib
166 unset compilerBin compilerLib compilerInstall
169 case "$WM_COMPILER" in
181 # Communications library
182 # ~~~~~~~~~~~~~~~~~~~~~~
188 if [ -e $WM_THIRD_PARTY_DIR/packages
/openmpi-1.4
.3 ]
190 mpi_version
=openmpi-1.4
.3
191 if [ "$FOAM_VERBOSE" -a "$PS1" ]
193 echo "Using openmpi-1.4.3 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
195 _foamSource
$WM_THIRD_PARTY_DIR/packages
/$mpi_version/platforms
/$WM_OPTIONS/etc
/$mpi_version.sh
197 elif [ -e $WM_THIRD_PARTY_DIR/packages
/openmpi-1.5
]
199 mpi_version
=openmpi-1.5
200 if [ "$FOAM_VERBOSE" -a "$PS1" ]
202 echo "Using openmpi-1.5 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
204 _foamSource
$WM_THIRD_PARTY_DIR/packages
/$mpi_version/platforms
/$WM_OPTIONS/etc
/$mpi_version.sh
207 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
212 mpi_version
=openmpi-system
214 # make sure not the "old" mpi is used
215 # Not sure if this is necessary anymore.
216 # export OPAL_PREFIX=
218 # Make sure OPENMPI_BIN_DIR is set and valid
219 if [ -n "${OPENMPI_BIN_DIR}" ] && [ -d "${OPENMPI_BIN_DIR}" ]
221 # User defined value specified for OPENMPI_BIN_DIR
224 # We assume this path specified by $OPENMPI_BIN_DIR is valid
225 # We assume the command mpicc is located somewhere under this path
226 # We assume the file mpi.h is located somewhere under this path
228 # Otherwise, please double check your openmpi installation, you are
229 # probably missing the openmpi runtime and/or development packages
230 # available for your system.
232 _foamAddPath
$OPENMPI_BIN_DIR
234 # Here, we assume your environment is already set for running
235 # and developping with openmpi.
237 # Initialize OPENMPI_BIN_DIR using the path to mpicc
238 export OPENMPI_BIN_DIR
=$
(dirname `which mpicc`)
241 # Make sure OPENMPI_LIB_DIR is set
242 if [ ! -n "${OPENMPI_LIB_DIR}" ]
244 # Initialize OPENMPI_LIB_DIR using the path to mpicc
245 export OPENMPI_LIB_DIR
="`mpicc --showme:libdirs`"
248 # Make sure the dynamic libraries are accessible
249 [ -n "${OPENMPI_LIB_DIR}" ] && _foamAddLib
$OPENMPI_LIB_DIR
251 export MPI_HOME
=`dirname $OPENMPI_BIN_DIR`
252 export MPI_ARCH_PATH
=$MPI_HOME
253 export OPAL_PREFIX
=$MPI_ARCH_PATH
255 # We initialize the rest of the environment using mpicc --showme:
256 [ ! -n "${OPENMPI_INCLUDE_DIR}" ] && export OPENMPI_INCLUDE_DIR
="`mpicc --showme:incdirs`"
257 [ ! -n "${OPENMPI_COMPILE_FLAGS}" ] && export OPENMPI_COMPILE_FLAGS
="`mpicc --showme:compile`"
258 [ ! -n "${OPENMPI_LINK_FLAGS}" ] && export OPENMPI_LINK_FLAGS
="`mpicc --showme:link`"
261 # WARNING: We assume the file mpi.h will be available under the directories identified
262 # by the variable $OPENMPI_INCLUDE_DIR. Otherwise, please double check your
263 # system openmpi installation.
265 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
266 export PINC
=$OPENMPI_COMPILE_FLAGS
267 export PLIBS
=$OPENMPI_LINK_FLAGS
269 # No longer needed, but we keep this as a reference, just in case...
270 #libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
273 if [ "$FOAM_VERBOSE" -a "$PS1" ]
275 echo "Using system installed OpenMPI:"
276 echo " OPENMPI_BIN_DIR : $OPENMPI_BIN_DIR"
277 echo " OPENMPI_LIB_DIR : $OPENMPI_LIB_DIR"
278 echo " OPENMPI_INCLUDE_DIR : $OPENMPI_INCLUDE_DIR"
279 echo " OPENMPI_COMPILE_FLAGS : $OPENMPI_COMPILE_FLAGS"
280 echo " OPENMPI_LINK_FLAGS : $OPENMPI_LINK_FLAGS"
282 echo " MPI_HOME : $MPI_HOME"
283 echo " MPI_ARCH_PATH : $MPI_ARCH_PATH"
284 echo " OPAL_PREFIX : $OPAL_PREFIX"
286 echo " PLIBS : $PLIBS"
289 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
294 mpi_version
=mpich-1.2
.4
295 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
296 export MPI_ARCH_PATH
=$MPI_HOME/platforms
/$WM_OPTIONS
297 export MPICH_ROOT
=$MPI_ARCH_PATH
299 _foamAddPath
$MPI_ARCH_PATH/bin
300 _foamAddLib
$MPI_ARCH_PATH/lib
302 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
307 export MPI_ARCH_PATH
=/opt
/mpi
308 export MPICH_PATH
=$MPI_ARCH_PATH
309 export MPICH_ROOT
=$MPI_ARCH_PATH
310 export GM_LIB_PATH
=/opt
/gm
/lib64
312 _foamAddPath
$MPI_ARCH_PATH/bin
313 _foamAddLib
$MPI_ARCH_PATH/lib
314 _foamAddLib
$GM_LIB_PATH
316 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpich-gm
320 export MPI_HOME
=/opt
/hpmpi
321 export MPI_ARCH_PATH
=$MPI_HOME
322 export MPICH_ROOT
=$MPI_ARCH_PATH
324 _foamAddPath
$MPI_ARCH_PATH/bin
328 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia32
332 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_amd64
335 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia64
338 echo Unknown processor
type `uname -m` for Linux
342 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/hpmpi
346 export MPI_ARCH_PATH
=/usr
347 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/gamma
351 export MPI_ARCH_PATH
=/opt
/mpi
352 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
356 export MPI_ARCH_PATH
=/opt
/FJSVmpi2
357 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
359 _foamAddPath
$MPI_ARCH_PATH/bin
360 _foamAddLib
$MPI_ARCH_PATH/lib
/sparcv9
361 _foamAddLib
/opt
/FSUNf90
/lib
/sparcv9
362 _foamAddLib
/opt
/FJSVpnidt
/lib
366 export MPI_ARCH_PATH
=/usr
/lib
/mpi
367 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/qsmpi
369 _foamAddPath
$MPI_ARCH_PATH/bin
370 _foamAddLib
$MPI_ARCH_PATH/lib
375 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/dummy
379 _foamAddLib
$FOAM_MPI_LIBBIN
382 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
383 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384 minBufferSize
=20000000
386 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
388 MPI_BUFFER_SIZE
=$minBufferSize
390 export MPI_BUFFER_SIZE
393 # CGAL library if available
394 # ~~~~~~~~~~~~~~~~~~~~~~~~~
395 [ -d "$CGAL_LIB_DIR" ] && _foamAddLib
$CGAL_LIB_DIR
398 # Switch on the hoard memory allocator if available
399 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
400 #if [ -f $FOAM_LIBBIN/libhoard.so ]
402 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
405 # HOARD seems to crash Paraview on Mac OS X 10.6
406 #if [ -f $FOAM_LIBBIN/libhoard.dylib ]
408 # if [ -z "$DYLD_INSERT_LIBRARIES" ]
410 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib
412 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib:$DYLD_INSERT_LIBRARIES
417 # Third party packages
419 # In order to use a pre-installed version of the ThirdParty packages, just set the
420 # appropriate XXX_SYSTEM environment variable for a given package in your prefs.sh
421 # file in order to disable the sourcing of the ThirdParty version of the same package.
423 # Load Mesquite library
424 # ~~~~~~~~~~~~~~~~~~~~~~
425 [ -z "$MESQUITE_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/mesquite-2.1
.2 ] && {
426 _foamSource
$WM_THIRD_PARTY_DIR/packages
/mesquite-2.1
.2/platforms
/$WM_OPTIONS/etc
/mesquite-2.1
.2.sh
428 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " MESQUITE_DIR is initialized to: $MESQUITE_DIR"
433 [ -z "$METIS_SYSTEM" ] && [ -d $WM_THIRD_PARTY_DIR/packages
/metis-5.0pre2
] && {
434 _foamSource
$WM_THIRD_PARTY_DIR/packages
/metis-5.0pre
2/platforms
/$WM_OPTIONS/etc
/metis-5.0pre2.sh
436 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " METIS_DIR is initialized to: $METIS_DIR"
439 # Load ParMetis library
440 # ~~~~~~~~~~~~~~~~~~~~~
441 [ -z "$PARMETIS_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/ParMetis-3.1
.1 ] && {
442 _foamSource
$WM_THIRD_PARTY_DIR/packages
/ParMetis-3.1
.1/platforms
/$WM_OPTIONS/etc
/ParMetis-3.1
.1.sh
444 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMETIS_DIR is initialized to: $PARMETIS_DIR"
447 # Load ParMGridGen library
448 # ~~~~~~~~~~~~~~~~~~~~~~~~~
449 [ -z "$PARMGRIDGEN_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/ParMGridGen-1.0
] && {
450 _foamSource
$WM_THIRD_PARTY_DIR/packages
/ParMGridGen-1.0
/platforms
/$WM_OPTIONS/etc
/ParMGridGen-1.0.sh
452 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMGRIDGEN_DIR is initialized to: $PARMGRIDGEN_DIR"
455 # Load Libccmio library
456 # ~~~~~~~~~~~~~~~~~~~~~
457 [ -z "$LIBCCMIO_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/libccmio-2.6
.1 ] && {
458 _foamSource
$WM_THIRD_PARTY_DIR/packages
/libccmio-2.6
.1/platforms
/$WM_OPTIONS/etc
/libccmio-2.6
.1.sh
460 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LIBCCMIO_DIR is initialized to: $LIBCCMIO_DIR"
463 # Load Scotch library
464 # ~~~~~~~~~~~~~~~~~~~
465 [ -z "$SCOTCH_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/scotch-5.1
.10b
] && {
466 _foamSource
$WM_THIRD_PARTY_DIR/packages
/scotch-5.1
.10b
/platforms
/$WM_OPTIONS/etc
/scotch-5.1
.10b.sh
468 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " SCOTCH_DIR is initialized to: $SCOTCH_DIR"
473 [ -z "$CMAKE_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/cmake-2.8
.3 ] && {
474 _foamSource
$WM_THIRD_PARTY_DIR/packages
/cmake-2.8
.3/platforms
/$WM_OPTIONS/etc
/cmake-2.8
.3.sh
476 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " CMAKE_DIR is initialized to: $CMAKE_DIR"
481 [ -z "$PYTHON_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/Python-2.7
] && {
482 _foamSource
$WM_THIRD_PARTY_DIR/packages
/Python-2.7
/platforms
/$WM_OPTIONS/etc
/Python-2.7.sh
484 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYTHON_DIR is initialized to: $PYTHON_DIR"
489 [ ! -z "$QT_THIRD_PARTY" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/qt-everywhere-opensource-src-4.7
.0 ] && {
490 _foamSource
$WM_THIRD_PARTY_DIR/packages
/qt-everywhere-opensource-src-4.7
.0/platforms
/$WM_OPTIONS/etc
/qt-everywhere-opensource-src-4.7
.0.sh
492 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " QT_DIR is initialized to: $QT_DIR"
497 [ -z "$PARAVIEW_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/ParaView-3.8
.1 ] && {
498 _foamSource
$WM_THIRD_PARTY_DIR/packages
/ParaView-3.8
.1/platforms
/$WM_OPTIONS/etc
/ParaView-3.8
.1.sh
500 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARAVIEW_DIR is initialized to: $PARAVIEW_DIR"
503 # cleanup environment:
504 # ~~~~~~~~~~~~~~~~~~~~
505 unset _foamAddPath _foamAddLib minBufferSize
507 # -----------------------------------------------------------------------------