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 ~/.profile or ~/.bashrc
31 # Should be usable by any POSIX-compliant shell (eg, ksh)
33 #------------------------------------------------------------------------------
35 export WM_PROJECT=OpenFOAM
36 export WM_PROJECT_VERSION=1.6-ext
38 # helps to easily write #ifdefs to detect a dev-version
41 ###############################################################################
44 # either set $FOAM_INST_DIR before sourcing this file or set
45 # $foamInstall below to where OpenFOAM is installed
47 # Location of FOAM installation
48 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 foamInstall=$HOME/$WM_PROJECT
50 # foamInstall=~$WM_PROJECT
51 # foamInstall=/usr/local/$WM_PROJECT
52 # foamInstall=/opt/$WM_PROJECT
54 # END OF (NORMAL) USER EDITABLE PART
55 ################################################################################
57 # note the location for later use (eg, in job scripts)
58 : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
60 # The old dirs to be cleaned from the various environment variables
61 # - remove anything under top-level directory.
62 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
63 foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$USER"
64 if [ "$WM_PROJECT_INST_DIR" != "$FOAM_INST_DIR" ]
66 foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs"
70 # Location of site/user files
71 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
73 export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
74 export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
77 # Location of third-party software
78 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79 export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
82 # Operating System/Platform
83 # ~~~~~~~~~~~~~~~~~~~~~~~~~
84 # WM_OSTYPE = POSIX | ????
85 : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE
88 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
89 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90 : ${WM_COMPILER:=Gcc}; export WM_COMPILER
92 export WM_COMPILER_ARCH=
93 export WM_COMPILER_LIB_ARCH=
96 # Compilation options (architecture, precision, optimised, debug or profiling)
97 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98 export WM_NCOMPPROCS=2
100 # WM_ARCH_OPTION = 32 | 64
101 : ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION
103 # WM_PRECISION_OPTION = DP | SP
104 : ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION
106 # WM_COMPILE_OPTION = Opt | Debug | Prof
107 : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
109 # WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI
110 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
113 # Run options (floating-point signal handling and memory initialisation)
114 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116 # export FOAM_SETNAN=
119 # Detect system type and set environment variables appropriately
120 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121 export WM_ARCH=`uname -s`
133 case $WM_ARCH_OPTION in
135 export WM_COMPILER_ARCH='-64'
136 export WM_CFLAGS='-m32 -fPIC'
137 export WM_CXXFLAGS='-m32 -fPIC'
138 export WM_LDFLAGS='-m32'
142 export WM_COMPILER_LIB_ARCH=64
143 export WM_CFLAGS='-m64 -fPIC'
144 export WM_CXXFLAGS='-m64 -fPIC'
145 export WM_LDFLAGS='-m64'
148 echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
155 export WM_COMPILER=I64
160 export WM_COMPILER_LIB_ARCH=64
161 export WM_CFLAGS='-mabi=64 -fPIC'
162 export WM_CXXFLAGS='-mabi=64 -fPIC'
163 export WM_LDFLAGS='-mabi=64 -G0'
169 export WM_COMPILER_LIB_ARCH=64
170 export WM_CFLAGS='-m64 -fPIC'
171 export WM_CXXFLAGS='-m64 -fPIC'
172 export WM_LDFLAGS='-m64'
176 echo Unknown processor type `uname -m` for Linux
184 export WM_ARCH=darwinPpc
187 export WM_ARCH=darwinIntel
190 echo "This seems to be an Intel-Mac please tell me the output of 'uname -p'. Bernhard."
191 export WM_ARCH=darwinIntel
198 export WM_COMPILER_LIB_ARCH=64
199 export WM_CFLAGS='-mabi=64 -fPIC'
200 export WM_CXXFLAGS='-mabi=64 -fPIC'
201 export WM_LDFLAGS='-mabi=64 -G0'
202 export WM_MPLIB=FJMPI
205 *) # an unsupported operating system
208 Your "$WM_ARCH" operating system is not supported by this release
209 of OpenFOAM. For further assistance, please contact www.openfoam.org
216 # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
217 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218 cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
221 cleanEnv=`$cleanProg "$PATH" "$foamOldDirs"` && PATH="$cleanEnv"
223 #- Clean LD_LIBRARY_PATH
224 cleanEnv=`$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleanEnv"
227 cleanEnv=`$cleanProg "$MANPATH" "$foamCleanDirs"` && MANPATH="$cleanEnv"
229 export PATH LD_LIBRARY_PATH MANPATH
231 # Source project setup files
232 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
237 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
244 _foamSource $WM_PROJECT_DIR/etc/settings.sh
245 _foamSource $WM_PROJECT_DIR/etc/aliases.sh
248 # Source user setup files for optional packages
249 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
251 _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
252 _foamSource $WM_PROJECT_DIR/etc/apps/ensight/bashrc
255 # Clean environment paths again. Only remove duplicates
256 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
258 cleanEnv=`$cleanProg "$PATH"` && PATH="$cleanEnv"
260 #- Clean LD_LIBRARY_PATH
261 cleanEnv=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanEnv"
264 cleanEnv=`$cleanProg "$MANPATH"` && MANPATH="$cleanEnv:"
266 export PATH LD_LIBRARY_PATH MANPATH
269 if [ "$LD_PRELOAD" != "" ]
271 cleanEnv=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanEnv"
276 # cleanup environment:
277 # ~~~~~~~~~~~~~~~~~~~~
278 unset cleanEnv cleanProg foamInstall foamOldDirs
281 # -----------------------------------------------------------------------------