Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / etc / bashrc
blob965a082652c5eee6ce2d99b33efdec13ad8d5585
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/bashrc
28 # Description
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
39 export FOAM_DEV=1
41 ###############################################################################
42 # USER EDITABLE PART
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" ]
65 then
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 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115 export FOAM_SIGFPE=
116 # export FOAM_SETNAN=
119 # Detect system type and set environment variables appropriately
120 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121 export WM_ARCH=`uname -s`
123 case $WM_ARCH in
124 Linux)
125     WM_ARCH=linux
127     # compiler specifics
128     case `uname -m` in
129     i686)
130         ;;
132     x86_64)
133         case $WM_ARCH_OPTION in
134         32)
135             export WM_COMPILER_ARCH='-64'
136             export WM_CFLAGS='-m32 -fPIC'
137             export WM_CXXFLAGS='-m32 -fPIC'
138             export WM_LDFLAGS='-m32'
139             ;;
140         64)
141             WM_ARCH=linux64
142             export WM_COMPILER_LIB_ARCH=64
143             export WM_CFLAGS='-m64 -fPIC'
144             export WM_CXXFLAGS='-m64 -fPIC'
145             export WM_LDFLAGS='-m64'
146             ;;
147         *)
148             echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
149             ;;
150         esac
151         ;;
153     ia64)
154         WM_ARCH=linuxIA64
155         export WM_COMPILER=I64
156         ;;
158     mips64)
159         WM_ARCH=SiCortex64
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'
164         export WM_MPLIB=MPI
165         ;;
167     ppc64)
168         WM_ARCH=linuxPPC64
169         export WM_COMPILER_LIB_ARCH=64
170         export WM_CFLAGS='-m64 -fPIC'
171         export WM_CXXFLAGS='-m64 -fPIC'
172         export WM_LDFLAGS='-m64'
173         ;;
175     *)
176         echo Unknown processor type `uname -m` for Linux
177         ;;
178     esac
179     ;;
181 Darwin)
182     case `uname -p` in
183     powerpc)
184         export WM_ARCH=darwinPpc
185         ;;
186     i386)
187         export WM_ARCH=darwinIntel
188         ;;
189     *)
190         echo "This seems to be an Intel-Mac please tell me the output of 'uname -p'. Bernhard."
191         export WM_ARCH=darwinIntel
192         ;;
193     esac
194     ;;
196 SunOS)
197     WM_ARCH=SunOS64
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
203     ;;
205 *)      # an unsupported operating system
206     cat <<USAGE
208     Your "$WM_ARCH" operating system is not supported by this release
209     of OpenFOAM. For further assistance, please contact www.openfoam.org
211 USAGE
212     ;;
213 esac
216 # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
217 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218 cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
220 #- Clean PATH
221 cleanEnv=`$cleanProg "$PATH" "$foamOldDirs"` && PATH="$cleanEnv"
223 #- Clean LD_LIBRARY_PATH
224 cleanEnv=`$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleanEnv"
226 #- Clean MANPATH
227 cleanEnv=`$cleanProg "$MANPATH" "$foamCleanDirs"` && MANPATH="$cleanEnv"
229 export PATH LD_LIBRARY_PATH MANPATH
231 # Source project setup files
232 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
233 _foamSource()
235    while [ $# -ge 1 ]
236    do
237       [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
238       . $1
239       shift
240    done
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 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
257 #- Clean PATH
258 cleanEnv=`$cleanProg "$PATH"` && PATH="$cleanEnv"
260 #- Clean LD_LIBRARY_PATH
261 cleanEnv=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanEnv"
263 #- Clean MANPATH
264 cleanEnv=`$cleanProg "$MANPATH"` && MANPATH="$cleanEnv:"
266 export PATH LD_LIBRARY_PATH MANPATH
268 #- Clean LD_PRELOAD
269 if [ "$LD_PRELOAD" != "" ]
270 then
271     cleanEnv=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanEnv"
272     export LD_PRELOAD
276 # cleanup environment:
277 # ~~~~~~~~~~~~~~~~~~~~
278 unset cleanEnv cleanProg foamInstall foamOldDirs
279 unset _foamSource
281 # -----------------------------------------------------------------------------