1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 2004-2011 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 ~/.login or ~/.cshrc
31 #------------------------------------------------------------------------------
33 setenv WM_PROJECT OpenFOAM
34 setenv WM_PROJECT_VERSION 2.0.x
36 ################################################################################
37 # USER EDITABLE PART: Changes made here may be lost with the next upgrade
39 # either setenv FOAM_INST_DIR before sourcing this file or set
40 # 'foamInstall' below to where OpenFOAM is installed
42 # Location of the OpenFOAM installation
43 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44 set foamInstall = $HOME/$WM_PROJECT
45 # set foamInstall = ~$WM_PROJECT
46 # set foamInstall = /opt/$WM_PROJECT
47 # set foamInstall = /usr/local/$WM_PROJECT
49 # END OF (NORMAL) USER EDITABLE PART
50 ################################################################################
53 # These are the defaults for this version which should generally be
54 # overridden from the prefs.csh file or from command-line specification
56 #- note the location for later use (eg, in job scripts)
57 if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
60 # foamCompiler= system | ThirdParty (OpenFOAM)
61 set foamCompiler=system
64 # WM_COMPILER = Gcc | Gcc43 | Gcc44 | Gcc45 | Gcc46 | Clang | Icc (Intel icc)
65 setenv WM_COMPILER Gcc
66 setenv WM_COMPILER_ARCH # defined but empty
67 unsetenv WM_COMPILER_LIB_ARCH
70 # WM_ARCH_OPTION = 32 | 64
71 setenv WM_ARCH_OPTION 64
74 # WM_PRECISION_OPTION = DP | SP
75 setenv WM_PRECISION_OPTION DP
77 #- Optimised, debug, profiling:
78 # WM_COMPILE_OPTION = Opt | Debug | Prof
79 setenv WM_COMPILE_OPTION Opt
81 #- MPI implementation:
82 # WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI
83 # | GAMMA | MPI | QSMPI
84 setenv WM_MPLIB OPENMPI
87 # WM_OSTYPE = POSIX | ???
88 setenv WM_OSTYPE POSIX
90 #- Floating-point signal handling:
94 #- memory initialisation:
99 ################################################################################
101 # The old dirs to be cleaned from the various environment variables
102 # - remove anything under top-level directory.
103 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
104 set foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
105 if ( $?WM_PROJECT_INST_DIR ) then
106 if ( "$WM_PROJECT_INST_DIR" != "$FOAM_INST_DIR" ) then
107 set foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs"
112 # Location of installation
113 # ~~~~~~~~~~~~~~~~~~~~~~~~
114 setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
115 setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
117 # Location of third-party software
118 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119 setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
121 # Location of site-specific templates etc
122 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123 # unset is equivalent to $WM_PROJECT_INST_DIR/site
124 if ( $?WM_PROJECT_SITE ) then
125 set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs"
126 if ( ! -d "$WM_PROJECT_SITE" ) unsetenv WM_PROJECT_SITE
128 unsetenv WM_PROJECT_SITE
131 # Location of user files
132 # ~~~~~~~~~~~~~~~~~~~~~~
133 setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
136 # Source files, possibly with some verbosity
137 alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* != "") source \!*'
139 # Add in preset user or site preferences:
140 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh`
142 # Evaluate command-line parameters and record settings for later
143 # these can be used to set/unset values, or specify alternative pref files
144 setenv FOAM_SETTINGS "${*}"
148 # stray option (not meant for us here) -> get out
152 # name= -> unsetenv name
153 if ($?FOAM_VERBOSE && $?prompt) echo "unsetenv $argv[1]:s/=//"
154 eval "unsetenv $argv[1]:s/=//"
157 # name=value -> setenv name value
158 if ($?FOAM_VERBOSE && $?prompt) echo "setenv $argv[1]:s/=/ /"
159 eval "setenv $argv[1]:s/=/ /"
162 # filename: source it
166 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -silent "$1"`
174 # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
175 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176 set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
178 #- prevent local variables from shadowing setenv variables
179 unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD
181 if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH ''
182 if (! $?MANPATH) setenv MANPATH ''
185 set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
186 if ( $status == 0 ) setenv PATH $cleaned
188 #- Clean LD_LIBRARY_PATH
189 set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
190 if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
193 set cleaned=`$foamClean "$MANPATH" "$foamOldDirs"`
194 if ( $status == 0 ) setenv MANPATH $cleaned
197 # Source project setup files
198 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
199 _foamSource $WM_PROJECT_DIR/etc/config/settings.csh
200 _foamSource $WM_PROJECT_DIR/etc/config/aliases.csh
202 # Source user setup files for optional packages
203 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
204 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.csh`
205 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.csh`
208 # Clean environment paths again. Only remove duplicates
209 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211 set cleaned=`$foamClean "$PATH"`
212 if ( $status == 0 ) setenv PATH $cleaned
214 #- Clean LD_LIBRARY_PATH
215 set cleaned=`$foamClean "$LD_LIBRARY_PATH"`
216 if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
218 #- Clean MANPATH (trailing ':' to find system pages)
219 set cleaned=`$foamClean "$MANPATH"`:
220 if ( $status == 0 ) setenv MANPATH "$cleaned"
223 if ( $?LD_PRELOAD ) then
224 set cleaned=`$foamClean "$LD_PRELOAD"`
225 if ( $status == 0 ) setenv LD_PRELOAD $cleaned
228 # cleanup environment:
229 # ~~~~~~~~~~~~~~~~~~~~
230 unset cleaned foamClean foamInstall foamOldDirs
233 # ----------------------------------------------------------------- end-of-file