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_BASE" == "darwin" ]
52 export DYLD_LIBRARY_PATH
=$1:$DYLD_LIBRARY_PATH
58 # Source files, possibly with some verbosity
59 # Yes, this is the same definition as in the file etc/bash
60 # We need that definition available for scripts sourcing
61 # settings.sh directly.
66 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
72 # location of the jobControl directory
73 export FOAM_JOB_DIR
=$WM_PROJECT_INST_DIR/jobControl
76 export WM_DIR
=$WM_PROJECT_DIR/wmake
77 export WM_LINK_LANGUAGE
=c
++
78 export WM_OPTIONS
=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
79 export PATH
=$WM_DIR:$PATH
81 #export WM_DECOMP_INC=-DCELL_DECOMP
82 #export WM_DECOMP_LIBS="-lcellDecompFiniteElement -lcellDecompositionMotionSolver"
83 export WM_DECOMP_INC
=-DFACE_DECOMP
84 export WM_DECOMP_LIBS
="-lfaceDecompFiniteElement -lfaceDecompositionMotionSolver"
87 export FOAM_APP
=$WM_PROJECT_DIR/applications
88 export FOAM_APPBIN
=$WM_PROJECT_DIR/applications
/bin
/$WM_OPTIONS
89 export FOAM_LIB
=$WM_PROJECT_DIR/lib
90 export FOAM_LIBBIN
=$WM_PROJECT_DIR/lib
/$WM_OPTIONS
91 export FOAM_SRC
=$WM_PROJECT_DIR/src
93 # shared site configuration - similar naming convention as ~OpenFOAM expansion
94 export FOAM_SITE_APPBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/bin
/$WM_OPTIONS
95 export FOAM_SITE_LIBBIN
=$WM_PROJECT_INST_DIR/site
/$WM_PROJECT_VERSION/lib
/$WM_OPTIONS
98 export FOAM_USER_APPBIN
=$WM_PROJECT_USER_DIR/applications
/bin
/$WM_OPTIONS
99 export FOAM_USER_LIBBIN
=$WM_PROJECT_USER_DIR/lib
/$WM_OPTIONS
102 export FOAM_TUTORIALS
=$WM_PROJECT_DIR/tutorials
103 export FOAM_UTILITIES
=$FOAM_APP/utilities
104 export FOAM_SOLVERS
=$FOAM_APP/solvers
105 export FOAM_RUN
=$WM_PROJECT_USER_DIR/run
107 # add OpenFOAM scripts and wmake to the path
108 export PATH
=$WM_DIR:$WM_PROJECT_DIR/bin
:$PATH
110 _foamAddPath
$FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
111 # Make sure to pick up dummy versions of external libraries last
112 _foamAddLib
$FOAM_LIBBIN/dummy
113 _foamAddLib
$FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
118 unset compilerBin compilerLib
120 # Select compiler installation
121 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122 # compilerInstall = OpenFOAM | System
124 # We can override the value of compilerInstall from prefs.sh
125 : ${compilerInstall:=System}
127 # Or we can force it right here
128 #compilerInstall=OpenFOAM
129 #compilerInstall=System
131 case "${compilerInstall:-OpenFOAM}" in
133 case "$WM_COMPILER" in
135 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.3
.3/platforms
/$WM_ARCH$WM_COMPILER_ARCH
136 _foamAddLib
$WM_THIRD_PARTY_DIR/mpfr-2.4
.1/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
137 _foamAddLib
$WM_THIRD_PARTY_DIR/gmp-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
140 _foamSource
$WM_THIRD_PARTY_DIR/packages
/mpfr-3.0
.1/platforms
/$WM_OPTIONS/etc
/mpfr-3.0
.1.sh
141 _foamSource
$WM_THIRD_PARTY_DIR/packages
/gmp-5.0
.1/platforms
/$WM_OPTIONS/etc
/gmp-5.0
.1.sh
142 _foamSource
$WM_THIRD_PARTY_DIR/packages
/gcc-4.4
.5/platforms
/$WM_OPTIONS/etc
/gcc-4.4
.5.sh
145 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.3
.3/platforms
/$WM_ARCH$WM_COMPILER_ARCH
146 _foamAddLib
$WM_THIRD_PARTY_DIR/mpfr-2.4
.1/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
147 _foamAddLib
$WM_THIRD_PARTY_DIR/gmp-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH/lib
150 export WM_COMPILER_DIR
=$WM_THIRD_PARTY_DIR/gcc-4.2
.4/platforms
/$WM_ARCH$WM_COMPILER_ARCH
154 # Check that the compiler directory can be found
155 if [ ! -d "$WM_COMPILER_DIR" ]
158 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
159 echo " Cannot find $WM_COMPILER_DIR installation."
160 echo " Please install this compiler version or if you wish to use the system compiler,"
161 echo " change the 'compilerInstall' setting to 'System' in this file"
165 compilerBin
=$WM_COMPILER_DIR/bin
166 compilerLib
=$WM_COMPILER_DIR/lib
$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
170 if [ -d "$compilerBin" ]
172 _foamAddPath
$compilerBin
173 _foamAddLib
$compilerLib
176 unset compilerBin compilerLib compilerInstall
179 case "$WM_COMPILER" in
191 # Communications library
192 # ~~~~~~~~~~~~~~~~~~~~~~
198 if [ -e $WM_THIRD_PARTY_DIR/packages
/openmpi-1.4
.3 ]
200 mpi_version
=openmpi-1.4
.3
201 if [ "$FOAM_VERBOSE" -a "$PS1" ]
203 echo "Using openmpi-1.4.3 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
205 _foamSource
$WM_THIRD_PARTY_DIR/packages
/$mpi_version/platforms
/$WM_OPTIONS/etc
/$mpi_version.sh
207 elif [ -e $WM_THIRD_PARTY_DIR/packages
/openmpi-1.5
]
209 mpi_version
=openmpi-1.5
210 if [ "$FOAM_VERBOSE" -a "$PS1" ]
212 echo "Using openmpi-1.5 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
214 _foamSource
$WM_THIRD_PARTY_DIR/packages
/$mpi_version/platforms
/$WM_OPTIONS/etc
/$mpi_version.sh
217 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
222 mpi_version
=openmpi-system
224 # make sure not the "old" mpi is used
225 # Not sure if this is necessary anymore.
226 # export OPAL_PREFIX=
228 # Make sure OPENMPI_BIN_DIR is set and valid
229 if [ -n "${OPENMPI_BIN_DIR}" ] && [ -d "${OPENMPI_BIN_DIR}" ]
231 # User defined value specified for OPENMPI_BIN_DIR
234 # We assume this path specified by $OPENMPI_BIN_DIR is valid
235 # We assume the command mpicc is located somewhere under this path
236 # We assume the file mpi.h is located somewhere under this path
238 # Otherwise, please double check your openmpi installation, you are
239 # probably missing the openmpi runtime and/or development packages
240 # available for your system.
242 _foamAddPath
$OPENMPI_BIN_DIR
244 # Here, we assume your environment is already set for running
245 # and developping with openmpi.
247 # Initialize OPENMPI_BIN_DIR using the path to mpicc
248 export OPENMPI_BIN_DIR
=$
(dirname `which mpicc`)
251 # Make sure OPENMPI_LIB_DIR is set
252 if [ ! -n "${OPENMPI_LIB_DIR}" ]
254 # Initialize OPENMPI_LIB_DIR using the path to mpicc
255 export OPENMPI_LIB_DIR
="`mpicc --showme:libdirs`"
258 # Make sure the dynamic libraries are accessible
259 [ -n "${OPENMPI_LIB_DIR}" ] && _foamAddLib
$OPENMPI_LIB_DIR
261 export MPI_HOME
=`dirname $OPENMPI_BIN_DIR`
262 export MPI_ARCH_PATH
=$MPI_HOME
263 export OPAL_PREFIX
=$MPI_ARCH_PATH
265 # We initialize the rest of the environment using mpicc --showme:
266 [ ! -n "${OPENMPI_INCLUDE_DIR}" ] && export OPENMPI_INCLUDE_DIR
="`mpicc --showme:incdirs`"
267 [ ! -n "${OPENMPI_COMPILE_FLAGS}" ] && export OPENMPI_COMPILE_FLAGS
="`mpicc --showme:compile`"
268 [ ! -n "${OPENMPI_LINK_FLAGS}" ] && export OPENMPI_LINK_FLAGS
="`mpicc --showme:link`"
271 # WARNING: We assume the file mpi.h will be available under the directories identified
272 # by the variable $OPENMPI_INCLUDE_DIR. Otherwise, please double check your
273 # system openmpi installation.
275 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
276 export PINC
=$OPENMPI_COMPILE_FLAGS
277 export PLIBS
=$OPENMPI_LINK_FLAGS
279 # No longer needed, but we keep this as a reference, just in case...
280 #libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
283 if [ "$FOAM_VERBOSE" -a "$PS1" ]
285 echo " Environment variables defined for OpenMPI:"
286 echo " OPENMPI_BIN_DIR : $OPENMPI_BIN_DIR"
287 echo " OPENMPI_LIB_DIR : $OPENMPI_LIB_DIR"
288 echo " OPENMPI_INCLUDE_DIR : $OPENMPI_INCLUDE_DIR"
289 echo " OPENMPI_COMPILE_FLAGS : $OPENMPI_COMPILE_FLAGS"
290 echo " OPENMPI_LINK_FLAGS : $OPENMPI_LINK_FLAGS"
292 echo " MPI_HOME : $MPI_HOME"
293 echo " MPI_ARCH_PATH : $MPI_ARCH_PATH"
294 echo " OPAL_PREFIX : $OPAL_PREFIX"
296 echo " PLIBS : $PLIBS"
299 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
304 mpi_version
=mpich-1.2
.4
305 export MPI_HOME
=$WM_THIRD_PARTY_DIR/$mpi_version
306 export MPI_ARCH_PATH
=$MPI_HOME/platforms
/$WM_OPTIONS
307 export MPICH_ROOT
=$MPI_ARCH_PATH
309 _foamAddPath
$MPI_ARCH_PATH/bin
310 _foamAddLib
$MPI_ARCH_PATH/lib
312 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/$mpi_version
317 export MPI_ARCH_PATH
=/opt
/mpi
318 export MPICH_PATH
=$MPI_ARCH_PATH
319 export MPICH_ROOT
=$MPI_ARCH_PATH
320 export GM_LIB_PATH
=/opt
/gm
/lib64
322 _foamAddPath
$MPI_ARCH_PATH/bin
323 _foamAddLib
$MPI_ARCH_PATH/lib
324 _foamAddLib
$GM_LIB_PATH
326 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpich-gm
330 export MPI_HOME
=/opt
/hpmpi
331 export MPI_ARCH_PATH
=$MPI_HOME
332 export MPICH_ROOT
=$MPI_ARCH_PATH
334 _foamAddPath
$MPI_ARCH_PATH/bin
338 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia32
342 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_amd64
345 _foamAddLib
$MPI_ARCH_PATH/lib
/linux_ia64
348 echo Unknown processor
type `uname -m` for Linux
352 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/hpmpi
356 export MPI_ARCH_PATH
=/usr
357 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/gamma
361 export MPI_ARCH_PATH
=/opt
/mpi
362 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
366 export MPI_ARCH_PATH
=/opt
/FJSVmpi2
367 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/mpi
369 _foamAddPath
$MPI_ARCH_PATH/bin
370 _foamAddLib
$MPI_ARCH_PATH/lib
/sparcv9
371 _foamAddLib
/opt
/FSUNf90
/lib
/sparcv9
372 _foamAddLib
/opt
/FJSVpnidt
/lib
376 export MPI_ARCH_PATH
=/usr
/lib
/mpi
377 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/qsmpi
379 _foamAddPath
$MPI_ARCH_PATH/bin
380 _foamAddLib
$MPI_ARCH_PATH/lib
385 export FOAM_MPI_LIBBIN
=$FOAM_LIBBIN/dummy
389 _foamAddLib
$FOAM_MPI_LIBBIN
392 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
393 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
394 minBufferSize
=20000000
396 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
398 MPI_BUFFER_SIZE
=$minBufferSize
400 export MPI_BUFFER_SIZE
403 # CGAL library if available
404 # ~~~~~~~~~~~~~~~~~~~~~~~~~
405 [ -d "$CGAL_LIB_DIR" ] && _foamAddLib
$CGAL_LIB_DIR
408 # Switch on the hoard memory allocator if available
409 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410 #if [ -f $FOAM_LIBBIN/libhoard.so ]
412 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
415 # HOARD seems to crash Paraview on Mac OS X 10.6
416 #if [ -f $FOAM_LIBBIN/libhoard.dylib ]
418 # if [ -z "$DYLD_INSERT_LIBRARIES" ]
420 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib
422 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib:$DYLD_INSERT_LIBRARIES
427 # Third party packages
429 # In order to use a pre-installed version of the ThirdParty packages, just set the
430 # appropriate XXX_SYSTEM environment variable for a given package in your prefs.sh
431 # file in order to disable the sourcing of the ThirdParty version of the same package.
433 # Load Mesquite library
434 # ~~~~~~~~~~~~~~~~~~~~~~
435 [ -z "$MESQUITE_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/mesquite-2.1
.2 ] && {
436 _foamSource
$WM_THIRD_PARTY_DIR/packages
/mesquite-2.1
.2/platforms
/$WM_OPTIONS/etc
/mesquite-2.1
.2.sh
438 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " MESQUITE_DIR is initialized to: $MESQUITE_DIR"
443 [ -z "$METIS_SYSTEM" ] && [ -d $WM_THIRD_PARTY_DIR/packages
/metis-5.0pre2
] && {
444 _foamSource
$WM_THIRD_PARTY_DIR/packages
/metis-5.0pre
2/platforms
/$WM_OPTIONS/etc
/metis-5.0pre2.sh
446 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " METIS_DIR is initialized to: $METIS_DIR"
449 # Load ParMetis library
450 # ~~~~~~~~~~~~~~~~~~~~~
451 [ -z "$PARMETIS_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/ParMetis-3.1
.1 ] && {
452 _foamSource
$WM_THIRD_PARTY_DIR/packages
/ParMetis-3.1
.1/platforms
/$WM_OPTIONS/etc
/ParMetis-3.1
.1.sh
454 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMETIS_DIR is initialized to: $PARMETIS_DIR"
457 # Load ParMGridGen library
458 # ~~~~~~~~~~~~~~~~~~~~~~~~~
459 [ -z "$PARMGRIDGEN_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/ParMGridGen-1.0
] && {
460 _foamSource
$WM_THIRD_PARTY_DIR/packages
/ParMGridGen-1.0
/platforms
/$WM_OPTIONS/etc
/ParMGridGen-1.0.sh
462 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMGRIDGEN_DIR is initialized to: $PARMGRIDGEN_DIR"
465 # Load Libccmio library
466 # ~~~~~~~~~~~~~~~~~~~~~
467 [ -z "$LIBCCMIO_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/libccmio-2.6
.1 ] && {
468 _foamSource
$WM_THIRD_PARTY_DIR/packages
/libccmio-2.6
.1/platforms
/$WM_OPTIONS/etc
/libccmio-2.6
.1.sh
470 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LIBCCMIO_DIR is initialized to: $LIBCCMIO_DIR"
473 # Load Scotch library
474 # ~~~~~~~~~~~~~~~~~~~
475 [ -z "$SCOTCH_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/scotch-5.1
.10b
] && {
476 _foamSource
$WM_THIRD_PARTY_DIR/packages
/scotch-5.1
.10b
/platforms
/$WM_OPTIONS/etc
/scotch-5.1
.10b.sh
478 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " SCOTCH_DIR is initialized to: $SCOTCH_DIR"
483 [ -z "$CMAKE_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/cmake-2.8
.3 ] && {
484 _foamSource
$WM_THIRD_PARTY_DIR/packages
/cmake-2.8
.3/platforms
/$WM_OPTIONS/etc
/cmake-2.8
.3.sh
486 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " CMAKE_DIR is initialized to: $CMAKE_DIR"
490 [ -z "$M4_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/m4-1.4
.16 ] && {
491 _foamSource
$WM_THIRD_PARTY_DIR/packages
/m4-1.4
.16/platforms
/$WM_OPTIONS/etc
/m4-1.4
.16.sh
493 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " M4_DIR is initialized to: $M4_DIR"
497 [ -z "$BISON_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/bison-2.4
.3 ] && {
498 _foamSource
$WM_THIRD_PARTY_DIR/packages
/bison-2.4
.3/platforms
/$WM_OPTIONS/etc
/bison-2.4
.3.sh
500 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " BISON_DIR is initialized to: $BISON_DIR"
504 [ -z "$FLEX_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/flex-2.5
.35 ] && {
505 _foamSource
$WM_THIRD_PARTY_DIR/packages
/flex-2.5
.35/platforms
/$WM_OPTIONS/etc
/flex-2.5
.35.sh
507 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " FLEX_DIR is initialized to: $FLEX_DIR"
512 [ -z "$ZOLTAN_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/zoltan_3.5
] && {
513 _foamSource
$WM_THIRD_PARTY_DIR/packages
/zoltan_3.5
/platforms
/$WM_OPTIONS/etc
/zoltan_3.5.sh
515 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " ZOLTAN_DIR is initialized to: $ZOLTAN_DIR"
520 [ -z "$PYTHON_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/Python-2.7
] && {
521 _foamSource
$WM_THIRD_PARTY_DIR/packages
/Python-2.7
/platforms
/$WM_OPTIONS/etc
/Python-2.7.sh
523 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYTHON_DIR is initialized to: $PYTHON_DIR"
528 [ ! -z "$QT_THIRD_PARTY" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/qt-everywhere-opensource-src-4.7
.0 ] && {
529 _foamSource
$WM_THIRD_PARTY_DIR/packages
/qt-everywhere-opensource-src-4.7
.0/platforms
/$WM_OPTIONS/etc
/qt-everywhere-opensource-src-4.7
.0.sh
531 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " QT_DIR is initialized to: $QT_DIR"
536 [ -z "$PARAVIEW_SYSTEM" ] && [ -e $WM_THIRD_PARTY_DIR/packages
/ParaView-3.8
.1 ] && {
537 _foamSource
$WM_THIRD_PARTY_DIR/packages
/ParaView-3.8
.1/platforms
/$WM_OPTIONS/etc
/ParaView-3.8
.1.sh
539 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARAVIEW_DIR is initialized to: $PARAVIEW_DIR"
542 # cleanup environment:
543 # ~~~~~~~~~~~~~~~~~~~~
544 unset _foamAddPath _foamAddLib minBufferSize
546 # -----------------------------------------------------------------------------