1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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
55 # make directories if they don't already exist
60 [ -d $1 ] || mkdir
-p $1
66 # location of the jobControl directory
67 export FOAM_JOB_DIR
=$WM_PROJECT_INST_DIR/jobControl
70 export WM_DIR
=$WM_PROJECT_DIR/wmake
71 export WM_LINK_LANGUAGE
=c
++
72 export WM_OPTIONS
=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
75 export FOAM_SRC
=$WM_PROJECT_DIR/src
76 export FOAM_LIB
=$WM_PROJECT_DIR/lib
77 export FOAM_LIBBIN
=$WM_PROJECT_DIR/lib
/$WM_OPTIONS
78 export FOAM_APP
=$WM_PROJECT_DIR/applications
79 export FOAM_APPBIN
=$WM_PROJECT_DIR/applications
/bin
/$WM_OPTIONS
82 export FOAM_USER_LIBBIN
=$WM_PROJECT_USER_DIR/lib
/$WM_OPTIONS
83 export FOAM_USER_APPBIN
=$WM_PROJECT_USER_DIR/applications
/bin
/$WM_OPTIONS
86 export FOAM_TUTORIALS
=$WM_PROJECT_DIR/tutorials
87 export FOAM_UTILITIES
=$FOAM_APP/utilities
88 export FOAM_SOLVERS
=$FOAM_APP/solvers
89 export FOAM_RUN
=$WM_PROJECT_USER_DIR/run
91 # add OpenFOAM scripts and wmake to the path
92 export PATH
=$WM_DIR:$WM_PROJECT_DIR/bin
:$PATH
94 _foamAddPath
$FOAM_APPBIN $FOAM_USER_APPBIN
95 _foamAddLib
$FOAM_LIBBIN $FOAM_USER_LIBBIN
97 # create these directories if necessary:
98 _foamMkDir
$FOAM_LIBBIN $FOAM_USER_LIBBIN $FOAM_APPBIN $FOAM_USER_APPBIN
103 unset compilerBin compilerLib
105 # Select compiler installation
106 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107 # compilerInstall = OpenFOAM | System
108 compilerInstall
=OpenFOAM
110 case "$compilerInstall" in
112 case "$WM_COMPILER" in
114 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.3
.1/platforms
/$WM_ARCH$WM_COMPILER_ARCH
117 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH
121 # Check that the compiler directory can be found
122 if [ ! -d "$WM_COMPILER_DIR" ]
125 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
126 echo " Cannot find $WM_COMPILER_DIR installation."
127 echo " Please install this compiler version or if you wish to use the system compiler,"
128 echo " change the 'compilerInstall' setting to 'System' in this file"
132 compilerBin
=$WM_COMPILER_DIR/bin
133 compilerLib
=$WM_COMPILER_DIR/lib
$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
137 if [ -d "$compilerBin" ]
139 _foamAddPath
$compilerBin
140 _foamAddLib
$compilerLib
143 unset compilerBin compilerLib compilerInstall
145 # Communications library
146 # ~~~~~~~~~~~~~~~~~~~~~~
152 mpi_version
=openmpi-1.2
.6
153 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
154 export MPI_ARCH_PATH
=$MPI_HOME/platforms
/$WM_OPTIONS
156 # Tell OpenMPI where to find its install directory
157 export OPAL_PREFIX
=$MPI_ARCH_PATH
159 _foamAddPath
$MPI_ARCH_PATH/bin
160 _foamAddLib
$MPI_ARCH_PATH/lib
162 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
167 mpi_version
=lam-7.1
.4
168 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
169 export MPI_ARCH_PATH
=$MPI_HOME/platforms
/$WM_OPTIONS
170 export LAMHOME
=$WM_THIRD_PARTY_DIR/$mpi_version
171 # note: LAMHOME is deprecated, should probably point to MPI_ARCH_PATH too
173 _foamAddPath
$MPI_ARCH_PATH/bin
174 _foamAddLib
$MPI_ARCH_PATH/lib
176 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
181 mpi_version
=mpich-1.2
.4
182 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
183 export MPI_ARCH_PATH
=$MPI_HOME/platforms
/$WM_OPTIONS
184 export MPICH_ROOT
=$MPI_ARCH_PATH
186 _foamAddPath
$MPI_ARCH_PATH/bin
187 _foamAddLib
$MPI_ARCH_PATH/lib
189 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
194 export MPI_ARCH_PATH
=/opt
/mpi
195 export MPICH_PATH
=$MPI_ARCH_PATH
196 export MPICH_ROOT
=$MPI_ARCH_PATH
197 export GM_LIB_PATH
=/opt
/gm
/lib64
199 _foamAddPath
$MPI_ARCH_PATH/bin
200 _foamAddLib
$MPI_ARCH_PATH/lib
201 _foamAddLib
$GM_LIB_PATH
203 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpich-gm
207 export MPI_HOME
=/opt
/hpmpi
208 export MPI_ARCH_PATH
=$MPI_HOME
209 export MPICH_ROOT
=$MPI_ARCH_PATH
211 _foamAddPath
$MPI_ARCH_PATH/bin
215 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia32
219 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_amd64
222 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia64
225 echo Unknown processor
type `uname -m` for Linux
229 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/hpmpi
233 export MPI_ARCH_PATH
=/usr
234 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/gamma
238 export MPI_ARCH_PATH
=/opt
/mpi
239 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
243 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/dummy
247 _foamAddLib
$FOAM_MPI_LIBBIN
250 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
251 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252 minBufferSize
=20000000
254 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
256 MPI_BUFFER_SIZE
=$minBufferSize
258 export MPI_BUFFER_SIZE
261 # CGAL library if available
262 # ~~~~~~~~~~~~~~~~~~~~~~~~~
263 [ -d "$CGAL_LIB_DIR" ] && _foamAddLib
$CGAL_LIB_DIR
266 # Switch on the hoard memory allocator if available
267 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
268 #if [ -f $FOAM_LIBBIN/libhoard.so ]; then
269 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
273 # cleanup environment:
274 # ~~~~~~~~~~~~~~~~~~~~
275 unset _foamAddPath _foamAddLib _foamMkDir minBufferSize
277 # -----------------------------------------------------------------------------