Cosmetic improvements.
[OpenFOAM-1.6.x.git] / etc / settings.sh
bloba5ade71d225772b207874ffdf5fc571e56a49952
1 #----------------------------------*-sh-*--------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 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
19 # for more details.
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
25 # Script
26 # etc/settings.sh
28 # Description
29 # Startup file for OpenFOAM
30 # Sourced from OpenFOAM-??/etc/bashrc
32 #------------------------------------------------------------------------------
34 # prefix to PATH
35 _foamAddPath()
37 while [ $# -ge 1 ]
39 export PATH=$1:$PATH
40 shift
41 done
44 # prefix to LD_LIBRARY_PATH
45 _foamAddLib()
47 while [ $# -ge 1 ]
49 export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
50 shift
51 done
55 # location of the jobControl directory
56 export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
58 # wmake configuration
59 export WM_DIR=$WM_PROJECT_DIR/wmake
60 export WM_LINK_LANGUAGE=c++
61 export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
63 # base configuration
64 export FOAM_APP=$WM_PROJECT_DIR/applications
65 export FOAM_APPBIN=$WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
66 export FOAM_LIB=$WM_PROJECT_DIR/lib
67 export FOAM_LIBBIN=$WM_PROJECT_DIR/lib/$WM_OPTIONS
68 export FOAM_SRC=$WM_PROJECT_DIR/src
70 # shared site configuration - similar naming convention as ~OpenFOAM expansion
71 export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS
72 export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS
74 # user configuration
75 export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
76 export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
78 # convenience
79 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
80 export FOAM_UTILITIES=$FOAM_APP/utilities
81 export FOAM_SOLVERS=$FOAM_APP/solvers
82 export FOAM_RUN=$WM_PROJECT_USER_DIR/run
84 # add OpenFOAM scripts and wmake to the path
85 export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
87 _foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
88 # Make sure to pick up dummy versions of external libraries last
89 _foamAddLib $FOAM_LIBBIN/dummy
90 _foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
93 # Compiler settings
94 # ~~~~~~~~~~~~~~~~~
95 unset compilerBin compilerLib
97 # Select compiler installation
98 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99 # compilerInstall = OpenFOAM | System
100 compilerInstall=OpenFOAM
102 case "${compilerInstall:-OpenFOAM}" in
103 OpenFOAM)
104 case "$WM_COMPILER" in
105 Gcc)
106 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
107 _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
108 _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
110 Gcc43)
111 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
112 _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
113 _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
115 Gcc42)
116 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH
118 esac
120 # Check that the compiler directory can be found
121 if [ ! -d "$WM_COMPILER_DIR" ]
122 then
123 echo
124 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
125 echo " Cannot find $WM_COMPILER_DIR installation."
126 echo " Please install this compiler version or if you wish to use the system compiler,"
127 echo " change the 'compilerInstall' setting to 'System' in this file"
128 echo
131 compilerBin=$WM_COMPILER_DIR/bin
132 compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
134 esac
136 if [ -d "$compilerBin" ]
137 then
138 _foamAddPath $compilerBin
139 _foamAddLib $compilerLib
142 unset compilerBin compilerLib compilerInstall
144 # Communications library
145 # ~~~~~~~~~~~~~~~~~~~~~~
147 unset MPI_ARCH_PATH
149 case "$WM_MPLIB" in
150 OPENMPI)
151 mpi_version=openmpi-1.3.3
152 export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
153 export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS
155 # Tell OpenMPI where to find its install directory
156 export OPAL_PREFIX=$MPI_ARCH_PATH
158 _foamAddPath $MPI_ARCH_PATH/bin
159 _foamAddLib $MPI_ARCH_PATH/lib
161 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
162 unset mpi_version
165 SYSTEMOPENMPI)
166 mpi_version=openmpi-system
168 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
169 export PINC=`mpicc --showme:compile`
170 export PLIBS=`mpicc --showme:link`
171 libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
173 if [ "$FOAM_VERBOSE" -a "$PS1" ]
174 then
175 echo "Using system installed MPI:"
176 echo " compile flags : $PINC"
177 echo " link flags : $PLIBS"
178 echo " libmpi dir : $libDir"
181 _foamAddLib $libDir
184 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
185 unset mpi_version
188 MPICH)
189 mpi_version=mpich-1.2.4
190 export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
191 export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS
192 export MPICH_ROOT=$MPI_ARCH_PATH
194 _foamAddPath $MPI_ARCH_PATH/bin
195 _foamAddLib $MPI_ARCH_PATH/lib
197 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
198 unset mpi_version
201 MPICH-GM)
202 export MPI_ARCH_PATH=/opt/mpi
203 export MPICH_PATH=$MPI_ARCH_PATH
204 export MPICH_ROOT=$MPI_ARCH_PATH
205 export GM_LIB_PATH=/opt/gm/lib64
207 _foamAddPath $MPI_ARCH_PATH/bin
208 _foamAddLib $MPI_ARCH_PATH/lib
209 _foamAddLib $GM_LIB_PATH
211 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
214 HPMPI)
215 export MPI_HOME=/opt/hpmpi
216 export MPI_ARCH_PATH=$MPI_HOME
217 export MPICH_ROOT=$MPI_ARCH_PATH
219 _foamAddPath $MPI_ARCH_PATH/bin
221 case `uname -m` in
222 i686)
223 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
226 x86_64)
227 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
229 ia64)
230 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
233 echo Unknown processor type `uname -m` for Linux
235 esac
237 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/hpmpi
240 GAMMA)
241 export MPI_ARCH_PATH=/usr
242 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/gamma
245 MPI)
246 export MPI_ARCH_PATH=/opt/mpi
247 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi
250 FJMPI)
251 export MPI_ARCH_PATH=/opt/FJSVmpi2
252 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi
254 _foamAddPath $MPI_ARCH_PATH/bin
255 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
256 _foamAddLib /opt/FSUNf90/lib/sparcv9
257 _foamAddLib /opt/FJSVpnidt/lib
260 QSMPI)
261 export MPI_ARCH_PATH=/usr/lib/mpi
262 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/qsmpi
264 _foamAddPath $MPI_ARCH_PATH/bin
265 _foamAddLib $MPI_ARCH_PATH/lib
270 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/dummy
272 esac
274 _foamAddLib $FOAM_MPI_LIBBIN
277 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
278 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
279 minBufferSize=20000000
281 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
282 then
283 MPI_BUFFER_SIZE=$minBufferSize
285 export MPI_BUFFER_SIZE
288 # CGAL library if available
289 # ~~~~~~~~~~~~~~~~~~~~~~~~~
290 [ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
293 # Switch on the hoard memory allocator if available
294 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
295 #if [ -f $FOAM_LIBBIN/libhoard.so ]
296 #then
297 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
301 # cleanup environment:
302 # ~~~~~~~~~~~~~~~~~~~~
303 unset _foamAddPath _foamAddLib minBufferSize
305 # -----------------------------------------------------------------------------