1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 1991-2010 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
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your 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, see <http://www.gnu.org/licenses/>.
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-??/etc/bashrc
31 #------------------------------------------------------------------------------
43 # prefix to LD_LIBRARY_PATH
48 export LD_LIBRARY_PATH
=$1:$LD_LIBRARY_PATH
58 export MANPATH
=$1:$MANPATH
64 # location of the jobControl directory
65 export FOAM_JOB_DIR
=$WM_PROJECT_INST_DIR/jobControl
68 export WM_DIR
=$WM_PROJECT_DIR/wmake
69 export WM_LINK_LANGUAGE
=c
++
70 export WM_OPTIONS
=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
73 export FOAM_APP
=$WM_PROJECT_DIR/applications
74 export FOAM_APPBIN
=$WM_PROJECT_DIR/applications
/bin
/$WM_OPTIONS
75 export FOAM_LIB
=$WM_PROJECT_DIR/lib
76 export FOAM_LIBBIN
=$WM_PROJECT_DIR/lib
/$WM_OPTIONS
77 export FOAM_SRC
=$WM_PROJECT_DIR/src
79 # shared site configuration - similar naming convention as ~OpenFOAM expansion
80 export FOAM_SITE_APPBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/bin
/$WM_OPTIONS
81 export FOAM_SITE_LIBBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/lib
/$WM_OPTIONS
84 export FOAM_USER_APPBIN
=$WM_PROJECT_USER_DIR/applications
/bin
/$WM_OPTIONS
85 export FOAM_USER_LIBBIN
=$WM_PROJECT_USER_DIR/lib
/$WM_OPTIONS
88 export FOAM_TUTORIALS
=$WM_PROJECT_DIR/tutorials
89 export FOAM_UTILITIES
=$FOAM_APP/utilities
90 export FOAM_SOLVERS
=$FOAM_APP/solvers
91 export FOAM_RUN
=$WM_PROJECT_USER_DIR/run
93 # add OpenFOAM scripts and wmake to the path
94 export PATH
=$WM_DIR:$WM_PROJECT_DIR/bin
:$PATH
96 _foamAddPath
$FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
97 # Make sure to pick up dummy versions of external libraries last
98 _foamAddLib
$FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy
102 unset gcc_version gmp_version mpfr_version mpc_version
105 # Select compiler installation
106 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107 # compilerInstall = OpenFOAM | system
108 : ${compilerInstall:=system}
110 case "${compilerInstall:-OpenFOAM}" in
112 case "$WM_COMPILER" in
114 gcc_version
=gcc-4.4
.3
115 gmp_version
=gmp-5.0
.1
116 mpfr_version
=mpfr-2.4
.2
119 gcc_version
=gcc-4.5
.0
120 gmp_version
=gmp-5.0
.1
121 mpfr_version
=mpfr-2.4
.2
122 mpc_version
=mpc-0.8
.1
125 gcc_version
=gcc-4.4
.3
126 gmp_version
=gmp-5.0
.1
127 mpfr_version
=mpfr-2.4
.2
130 gcc_version
=gcc-4.3
.3
131 gmp_version
=gmp-4.2
.4
132 mpfr_version
=mpfr-2.4
.1
136 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
137 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
138 echo " Please check your settings"
143 if [ -n "$gcc_version" ]
145 gccDir
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
146 gmpDir
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
147 mpfrDir
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
148 mpcDir
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
150 # Check that the compiler directory can be found
151 [ -d "$gccDir" ] ||
{
153 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
154 echo " Cannot find $gccDir installation."
155 echo " Please install this compiler version or if you wish to use the system compiler,"
156 echo " change the 'compilerInstall' setting to 'system' in this file"
160 _foamAddMan
$gccDir/man
161 _foamAddPath
$gccDir/bin
163 # 64-bit needs lib64, but 32-bit needs lib (not lib32)
164 if [ "$WM_ARCH_OPTION" = 64 ]
166 _foamAddLib
$gccDir/lib
$WM_COMPILER_LIB_ARCH
168 _foamAddLib
$gccDir/lib
171 # add in gmp/mpfr libraries
172 _foamAddLib
$gmpDir/lib
173 _foamAddLib
$mpfrDir/lib
175 # add in mpc libraries (not need for older gcc)
176 if [ -n "$mpc_version" ]
178 _foamAddLib
$mpcDir/lib
181 # used by boost/CGAL:
182 export MPFR_ARCH_PATH
=$mpfrDir
184 unset gcc_version gccDir
185 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
193 boost_version
=boost_1_42_0
194 cgal_version
=CGAL-3.5
.1
196 export BOOST_ARCH_PATH
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER/$boost_version
197 export CGAL_ARCH_PATH
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER/$cgal_version
199 # enabled if CGAL is available
200 if [ -d "$CGAL_ARCH_PATH" ]
202 if [ -d "$BOOST_ARCH_PATH" ]
204 _foamAddLib
$BOOST_ARCH_PATH/lib
206 unset BOOST_ARCH_PATH
208 _foamAddLib
$CGAL_ARCH_PATH/lib
210 unset BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH
213 unset boost_version cgal_version
216 # Communications library
217 # ~~~~~~~~~~~~~~~~~~~~~~
219 unset MPI_ARCH_PATH MPI_HOME
223 mpi_version
=openmpi-1.4
.1
224 export MPI_ARCH_PATH
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER/$mpi_version
226 # Tell OpenMPI where to find its install directory
227 export OPAL_PREFIX
=$MPI_ARCH_PATH
229 _foamAddPath
$MPI_ARCH_PATH/bin
230 _foamAddLib
$MPI_ARCH_PATH/lib
231 _foamAddMan
$MPI_ARCH_PATH/man
233 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
238 # use the system installed openmpi, get library directory via mpicc
239 mpi_version
=openmpi-system
241 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
242 export PINC
="`mpicc --showme:compile`"
243 export PLIBS
="`mpicc --showme:link`"
244 libDir
=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
246 if [ "$FOAM_VERBOSE" -a "$PS1" ]
248 echo "Using system installed MPI:"
249 echo " compile flags : $PINC"
250 echo " link flags : $PLIBS"
251 echo " libmpi dir : $libDir"
256 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
257 unset mpi_version libDir
261 mpi_version
=mpich2-1.1
.1p1
262 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
263 export MPI_ARCH_PATH
=$WM_THIRD_PARTY_DIR/platforms
/$WM_ARCH$WM_COMPILER/$mpi_version
265 _foamAddPath
$MPI_ARCH_PATH/bin
266 _foamAddLib
$MPI_ARCH_PATH/lib
267 _foamAddMan
$MPI_ARCH_PATH/share
/man
269 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
274 export MPI_ARCH_PATH
=/opt
/mpi
275 export MPICH_PATH
=$MPI_ARCH_PATH
276 export GM_LIB_PATH
=/opt
/gm
/lib64
278 _foamAddPath
$MPI_ARCH_PATH/bin
279 _foamAddLib
$MPI_ARCH_PATH/lib
280 _foamAddLib
$GM_LIB_PATH
282 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpich-gm
286 export MPI_HOME
=/opt
/hpmpi
287 export MPI_ARCH_PATH
=$MPI_HOME
289 _foamAddPath
$MPI_ARCH_PATH/bin
293 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia32
297 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_amd64
300 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia64
303 echo Unknown processor
type `uname -m` for Linux
307 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/hpmpi
311 export MPI_ARCH_PATH
=/opt
/mpi
312 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
316 export MPI_ARCH_PATH
=/opt
/FJSVmpi2
317 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
319 _foamAddPath
$MPI_ARCH_PATH/bin
320 _foamAddLib
$MPI_ARCH_PATH/lib
/sparcv9
321 _foamAddLib
/opt
/FSUNf90
/lib
/sparcv9
322 _foamAddLib
/opt
/FJSVpnidt
/lib
326 export MPI_ARCH_PATH
=/usr
/lib
/mpi
327 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/qsmpi
329 _foamAddPath
$MPI_ARCH_PATH/bin
330 _foamAddLib
$MPI_ARCH_PATH/lib
335 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/dummy
339 _foamAddLib
$FOAM_MPI_LIBBIN
342 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
343 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344 : ${minBufferSize:=20000000}
346 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
348 MPI_BUFFER_SIZE
=$minBufferSize
350 export MPI_BUFFER_SIZE
353 # Enable the hoard memory allocator if available
354 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
355 #if [ -f $FOAM_LIBBIN/libhoard.so ]
357 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
361 # cleanup environment:
362 # ~~~~~~~~~~~~~~~~~~~~
363 unset _foamAddPath _foamAddLib _foamAddMan compilerInstall minBufferSize
365 # ----------------------------------------------------------------- end-of-file