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" == "darwinIntel" ]
52 export DYLD_LIBRARY_PATH
=$1:$DYLD_LIBRARY_PATH
59 # location of the jobControl directory
60 export FOAM_JOB_DIR
=$WM_PROJECT_INST_DIR/jobControl
63 export WM_DIR
=$WM_PROJECT_DIR/wmake
64 export WM_LINK_LANGUAGE
=c
++
65 export WM_OPTIONS
=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
66 export PATH
=$WM_DIR:$PATH
68 #export WM_DECOMP_INC=-DCELL_DECOMP
69 #export WM_DECOMP_LIBS="-lcellDecompFiniteElement -lcellDecompositionMotionSolver"
70 export WM_DECOMP_INC
=-DFACE_DECOMP
71 export WM_DECOMP_LIBS
="-lfaceDecompFiniteElement -lfaceDecompositionMotionSolver"
74 export FOAM_APP
=$WM_PROJECT_DIR/applications
75 export FOAM_APPBIN
=$WM_PROJECT_DIR/applications
/bin
/$WM_OPTIONS
76 export FOAM_LIB
=$WM_PROJECT_DIR/lib
77 export FOAM_LIBBIN
=$WM_PROJECT_DIR/lib
/$WM_OPTIONS
78 export FOAM_SRC
=$WM_PROJECT_DIR/src
80 # shared site configuration - similar naming convention as ~OpenFOAM expansion
81 export FOAM_SITE_APPBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/bin
/$WM_OPTIONS
82 export FOAM_SITE_LIBBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/lib
/$WM_OPTIONS
85 export FOAM_USER_APPBIN
=$WM_PROJECT_USER_DIR/applications
/bin
/$WM_OPTIONS
86 export FOAM_USER_LIBBIN
=$WM_PROJECT_USER_DIR/lib
/$WM_OPTIONS
89 export FOAM_TUTORIALS
=$WM_PROJECT_DIR/tutorials
90 export FOAM_UTILITIES
=$FOAM_APP/utilities
91 export FOAM_SOLVERS
=$FOAM_APP/solvers
92 export FOAM_RUN
=$WM_PROJECT_USER_DIR/run
94 # add OpenFOAM scripts and wmake to the path
95 export PATH
=$WM_DIR:$WM_PROJECT_DIR/bin
:$PATH
97 _foamAddPath
$FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
98 # Make sure to pick up dummy versions of external libraries last
99 _foamAddLib
$FOAM_LIBBIN/dummy
100 _foamAddLib
$FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
105 unset compilerBin compilerLib
107 # Select compiler installation
108 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109 # compilerInstall = OpenFOAM | System
110 #compilerInstall=OpenFOAM
111 compilerInstall
=System
113 case "${compilerInstall:-OpenFOAM}" in
115 case "$WM_COMPILER" in
117 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.3
.3/platforms
/$WM_ARCH$WM_COMPILER_ARCH
118 _foamAddLib
$WM_THIRD_PARTY_DIR/mpfr-2.4
.1/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
119 _foamAddLib
$WM_THIRD_PARTY_DIR/gmp-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
122 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.3
.3/platforms
/$WM_ARCH$WM_COMPILER_ARCH
123 _foamAddLib
$WM_THIRD_PARTY_DIR/mpfr-2.4
.1/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
124 _foamAddLib
$WM_THIRD_PARTY_DIR/gmp-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
127 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH
131 # Check that the compiler directory can be found
132 if [ ! -d "$WM_COMPILER_DIR" ]
135 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
136 echo " Cannot find $WM_COMPILER_DIR installation."
137 echo " Please install this compiler version or if you wish to use the system compiler,"
138 echo " change the 'compilerInstall' setting to 'System' in this file"
142 compilerBin
=$WM_COMPILER_DIR/bin
143 compilerLib
=$WM_COMPILER_DIR/lib
$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
147 if [ -d "$compilerBin" ]
149 _foamAddPath
$compilerBin
150 _foamAddLib
$compilerLib
153 unset compilerBin compilerLib compilerInstall
156 case "$WM_COMPILER" in
168 # Communications library
169 # ~~~~~~~~~~~~~~~~~~~~~~
175 if [ "$WM_ARCH" == "darwinIntel" ]
177 mpi_version
=openmpi-system
179 export MPI_ARCH_PATH
=/usr
183 mpi_version
=openmpi-1.4
.1
184 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
185 export MPI_ARCH_PATH
=$MPI_HOME/platforms
/$WM_OPTIONS
187 # Tell OpenMPI where to find its install directory
188 export OPAL_PREFIX
=$MPI_ARCH_PATH
190 _foamAddPath
$MPI_ARCH_PATH/bin
191 _foamAddLib
$MPI_ARCH_PATH/lib
194 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
199 mpi_version
=openmpi-system
201 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
202 export PINC
=`mpicc --showme:compile`
203 export PLIBS
=`mpicc --showme:link`
204 libDir
=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
206 if [ "$FOAM_VERBOSE" -a "$PS1" ]
208 echo "Using system installed MPI:"
209 echo " compile flags : $PINC"
210 echo " link flags : $PLIBS"
211 echo " libmpi dir : $libDir"
217 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
222 mpi_version
=mpich-1.2
.4
223 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
224 export MPI_ARCH_PATH
=$MPI_HOME/platforms
/$WM_OPTIONS
225 export MPICH_ROOT
=$MPI_ARCH_PATH
227 _foamAddPath
$MPI_ARCH_PATH/bin
228 _foamAddLib
$MPI_ARCH_PATH/lib
230 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
235 export MPI_ARCH_PATH
=/opt
/mpi
236 export MPICH_PATH
=$MPI_ARCH_PATH
237 export MPICH_ROOT
=$MPI_ARCH_PATH
238 export GM_LIB_PATH
=/opt
/gm
/lib64
240 _foamAddPath
$MPI_ARCH_PATH/bin
241 _foamAddLib
$MPI_ARCH_PATH/lib
242 _foamAddLib
$GM_LIB_PATH
244 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpich-gm
248 export MPI_HOME
=/opt
/hpmpi
249 export MPI_ARCH_PATH
=$MPI_HOME
250 export MPICH_ROOT
=$MPI_ARCH_PATH
252 _foamAddPath
$MPI_ARCH_PATH/bin
256 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia32
260 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_amd64
263 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia64
266 echo Unknown processor
type `uname -m` for Linux
270 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/hpmpi
274 export MPI_ARCH_PATH
=/usr
275 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/gamma
279 export MPI_ARCH_PATH
=/opt
/mpi
280 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
284 export MPI_ARCH_PATH
=/opt
/FJSVmpi2
285 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
287 _foamAddPath
$MPI_ARCH_PATH/bin
288 _foamAddLib
$MPI_ARCH_PATH/lib
/sparcv9
289 _foamAddLib
/opt
/FSUNf90
/lib
/sparcv9
290 _foamAddLib
/opt
/FJSVpnidt
/lib
294 export MPI_ARCH_PATH
=/usr
/lib
/mpi
295 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/qsmpi
297 _foamAddPath
$MPI_ARCH_PATH/bin
298 _foamAddLib
$MPI_ARCH_PATH/lib
303 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/dummy
307 _foamAddLib
$FOAM_MPI_LIBBIN
310 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
311 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
312 minBufferSize
=20000000
314 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
316 MPI_BUFFER_SIZE
=$minBufferSize
318 export MPI_BUFFER_SIZE
321 # CGAL library if available
322 # ~~~~~~~~~~~~~~~~~~~~~~~~~
323 [ -d "$CGAL_LIB_DIR" ] && _foamAddLib
$CGAL_LIB_DIR
326 # Switch on the hoard memory allocator if available
327 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328 #if [ -f $FOAM_LIBBIN/libhoard.so ]
330 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
333 # HOARD seems to crash Paraview on Mac OS X 10.6
334 #if [ -f $FOAM_LIBBIN/libhoard.dylib ]
336 # if [ -z "$DYLD_INSERT_LIBRARIES" ]
338 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib
340 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib:$DYLD_INSERT_LIBRARIES
344 # cleanup environment:
345 # ~~~~~~~~~~~~~~~~~~~~
346 unset _foamAddPath _foamAddLib minBufferSize
348 # -----------------------------------------------------------------------------