Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / etc / settings.sh
blob5507b251ba4d068bb0e1a1e081e20ea9bae53c5f
1 #----------------------------------*-sh-*--------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright held by original author
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 if [ "$WM_ARCH" == "darwinIntel" ]
51 then
52 export DYLD_LIBRARY_PATH=$1:$DYLD_LIBRARY_PATH
54 shift
55 done
59 # location of the jobControl directory
60 export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
62 # wmake configuration
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"
73 # base configuration
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
84 # user configuration
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
88 # convenience
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
103 # Compiler settings
104 # ~~~~~~~~~~~~~~~~~
105 unset compilerBin compilerLib
107 # Select compiler installation
108 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109 # compilerInstall = OpenFOAM | System
110 #compilerInstall=OpenFOAM
111 compilerInstall=System
113 case "${compilerInstall:-OpenFOAM}" in
114 OpenFOAM)
115 case "$WM_COMPILER" in
116 Gcc)
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
121 Gcc43)
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
126 Gcc42)
127 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH
129 esac
131 # Check that the compiler directory can be found
132 if [ ! -d "$WM_COMPILER_DIR" ]
133 then
134 echo
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"
139 echo
142 compilerBin=$WM_COMPILER_DIR/bin
143 compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
145 esac
147 if [ -d "$compilerBin" ]
148 then
149 _foamAddPath $compilerBin
150 _foamAddLib $compilerLib
153 unset compilerBin compilerLib compilerInstall
156 case "$WM_COMPILER" in
157 Gcc)
158 export WM_CC='gcc'
159 export WM_CXX='g++'
161 Icc)
162 export WM_CC='icc'
163 export WM_CXX='icpc'
165 esac
168 # Communications library
169 # ~~~~~~~~~~~~~~~~~~~~~~
171 unset MPI_ARCH_PATH
173 case "$WM_MPLIB" in
174 OPENMPI)
175 if [ "$WM_ARCH" == "darwinIntel" ]
176 then
177 mpi_version=openmpi-system
178 export MPI_HOME=/usr
179 export MPI_ARCH_PATH=/usr
181 unset OPAL_PREFIX
182 else
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
195 unset mpi_version
198 SYSTEMOPENMPI)
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" ]
207 then
208 echo "Using system installed MPI:"
209 echo " compile flags : $PINC"
210 echo " link flags : $PLIBS"
211 echo " libmpi dir : $libDir"
214 _foamAddLib $libDir
217 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
218 unset mpi_version
221 MPICH)
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
231 unset mpi_version
234 MPICH-GM)
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
247 HPMPI)
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
254 case `uname -m` in
255 i686)
256 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
259 x86_64)
260 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
262 ia64)
263 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
266 echo Unknown processor type `uname -m` for Linux
268 esac
270 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/hpmpi
273 GAMMA)
274 export MPI_ARCH_PATH=/usr
275 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/gamma
278 MPI)
279 export MPI_ARCH_PATH=/opt/mpi
280 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi
283 FJMPI)
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
293 QSMPI)
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
305 esac
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 ]
315 then
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 ]
329 #then
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 ]
335 #then
336 # if [ -z "$DYLD_INSERT_LIBRARIES" ]
337 # then
338 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib
339 # else
340 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib:$DYLD_INSERT_LIBRARIES
341 # fi
344 # cleanup environment:
345 # ~~~~~~~~~~~~~~~~~~~~
346 unset _foamAddPath _foamAddLib minBufferSize
348 # -----------------------------------------------------------------------------