1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 1991-2009 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 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 ~/.login or ~/.cshrc
32 #------------------------------------------------------------------------------
34 setenv WM_PROJECT OpenFOAM
35 setenv WM_PROJECT_VERSION 1.6.x
37 ################################################################################
40 # either setenv FOAM_INST_DIR before sourcing this file or set
41 # foamInstall below to where OpenFOAM is installed
43 # Location of FOAM installation
44 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 set foamInstall = $HOME/$WM_PROJECT
46 # set foamInstall = ~$WM_PROJECT
47 # set foamInstall = /usr/local/$WM_PROJECT
48 # set foamInstall = /opt/$WM_PROJECT
50 # END OF (NORMAL) USER EDITABLE PART
51 ################################################################################
53 # note the location for later use (eg, in job scripts)
54 if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
56 # The old dirs to be cleaned from the various environment variables
57 # - remove anything under top-level directory.
58 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
59 set foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
61 # Location of site/user files
62 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
63 setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
64 setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
65 setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
68 # Location of third-party software
69 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
73 # Operating System/Platform
74 # ~~~~~~~~~~~~~~~~~~~~~~~~~
75 # WM_OSTYPE = POSIX | ????
76 if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX
79 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
80 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81 if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc
83 setenv WM_COMPILER_ARCH
84 setenv WM_COMPILER_LIB_ARCH
87 # Compilation options (architecture, precision, optimised, debug or profiling)
88 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89 # WM_ARCH_OPTION = 32 | 64
90 if ( ! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64
92 # WM_PRECISION_OPTION = DP | SP
93 if ( ! $?WM_PRECISION_OPTION ) setenv WM_PRECISION_OPTION DP
95 # WM_COMPILE_OPTION = Opt | Debug | Prof
96 if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt
98 # WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI
99 if ( ! $?WM_MPLIB ) setenv WM_MPLIB OPENMPI
102 # Run options (floating-point signal handling and memory initialisation)
103 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108 # Detect system type and set environment variables
109 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110 setenv WM_ARCH `uname -s`
121 switch ($WM_ARCH_OPTION)
124 setenv WM_COMPILER_ARCH '-64'
127 setenv WM_CFLAGS '-m32 -fPIC'
128 setenv WM_CXXFLAGS '-m32 -fPIC'
129 setenv WM_LDFLAGS '-m32'
133 setenv WM_ARCH linux64
134 setenv WM_COMPILER_LIB_ARCH 64
137 setenv WM_CFLAGS '-m64 -fPIC'
138 setenv WM_CXXFLAGS '-m64 -fPIC'
139 setenv WM_LDFLAGS '-m64'
143 echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
150 setenv WM_ARCH linuxIA64
151 setenv WM_COMPILER I64
155 setenv WM_ARCH SiCortex64
156 setenv WM_COMPILER_LIB_ARCH 64
159 setenv WM_CFLAGS '-mabi=64 -fPIC'
160 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
161 setenv WM_LDFLAGS '-mabi=64 -G0'
166 setenv WM_ARCH linuxPPC64
167 setenv WM_COMPILER_LIB_ARCH 64
170 setenv WM_CFLAGS '-m64 -fPIC'
171 setenv WM_CXXFLAGS '-m64 -fPIC'
172 setenv WM_LDFLAGS '-m64'
176 echo Unknown processor type `uname -m` for Linux
183 setenv WM_ARCH SunOS64
184 setenv WM_COMPILER_LIB_ARCH 64
187 setenv WM_CFLAGS '-mabi=64 -fPIC'
188 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
189 setenv WM_LDFLAGS '-mabi=64 -G0'
190 setenv WM_MPLIB FJMPI
195 echo "Your '$WM_ARCH' operating system is not supported by this release"
196 echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.org"
203 # Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH)
204 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205 set cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
207 if (! $?LD_LIBRARY_PATH ) then
208 setenv LD_LIBRARY_PATH ''
210 if (! $?MANPATH) then
215 set colonPath=`echo "$path" | sed -e 's/ /:/g'`
216 set cleanEnv=`$cleanProg "$colonPath" "$foamOldDirs"`
217 if ( $status == 0 ) then
218 set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
221 #- Clean LD_LIBRARY_PATH
222 setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"`
225 setenv MANPATH `$cleanProg "$MANPATH" "$foamOldDirs"`
228 # Source project setup files
229 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
230 alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Executing: \!*"; source \!*'
232 _foamSource $WM_PROJECT_DIR/etc/settings.csh
233 _foamSource $WM_PROJECT_DIR/etc/aliases.csh
235 # Source user setup files for optional packages
236 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/cshrc
238 _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
239 # _foamSource $WM_PROJECT_DIR/etc/apps/ensight/cshrc
242 # Clean environment paths again. Only remove duplicates
243 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245 set colonPath=`echo "$path" | sed -e 's/ /:/g'`
246 set cleanEnv=`$cleanProg "$colonPath"`
247 if ( $status == 0 ) then
248 set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
251 #- Clean LD_LIBRARY_PATH
252 setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH"`
255 setenv MANPATH `$cleanProg "$MANPATH"`:
258 if ( $?LD_PRELOAD ) then
259 setenv LD_PRELOAD `$cleanProg "$LD_PRELOAD"`
262 # cleanup environment:
263 # ~~~~~~~~~~~~~~~~~~~~
264 unset cleanEnv cleanProg colonPath foamInstall foamOldDirs
267 # -----------------------------------------------------------------------------