1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | foam-extend: Open Source CFD
4 # \\ / O peration | Version: 3.2
5 # \\ / A nd | Web: http://www.foam-extend.org
6 # \\/ M anipulation | For copyright notice see file Copyright
7 #------------------------------------------------------------------------------
9 # This file is part of foam-extend.
11 # foam-extend 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 3 of the License, or (at your
14 # option) any later version.
16 # foam-extend is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 # Startup file for FOAM
29 # Sourced from ~/.login or ~/.cshrc
31 #------------------------------------------------------------------------------
33 setenv WM_PROJECT foam
35 setenv WM_PROJECT_VERSION 3.2
37 # helps to easily write #ifdefs to detect a foam-extend version
40 ###############################################################################
43 # either setenv FOAM_INST_DIR before sourcing this file or set
44 # foamInstall below to where FOAM is installed
46 # Location of FOAM installation
47 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48 set foamInstall = $HOME/$WM_PROJECT
49 # set foamInstall = ~$WM_PROJECT
50 # set foamInstall = /usr/local/$WM_PROJECT
51 # set foamInstall = /opt/$WM_PROJECT
53 # END OF (NORMAL) USER EDITABLE PART
54 ###############################################################################
56 # note the location for later use (eg, in job scripts)
57 if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
59 # The old dirs to be cleaned from the various environment variables
60 # - remove anything under top-level directory.
61 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
62 set foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
64 # Location of site/user files
65 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
66 setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
67 setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_FORK-$WM_PROJECT_VERSION
68 setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
71 # Location of third-party software
72 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 #setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
74 setenv WM_THIRD_PARTY_DIR $WM_PROJECT_DIR/ThirdParty
76 # Enabling the usage of third-party software
77 # This can be overriden in prefs.sh
78 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 setenv WM_THIRD_PARTY_USE_CMAKE_322 1
84 setenv WM_THIRD_PARTY_USE_OPENMPI_165 1
88 setenv WM_THIRD_PARTY_USE_METIS_510 1
89 setenv WM_THIRD_PARTY_USE_PARMGRIDGEN_10 1
90 setenv WM_THIRD_PARTY_USE_LIBCCMIO_261 1
91 setenv WM_THIRD_PARTY_USE_MESQUITE_212 1
92 setenv WM_THIRD_PARTY_USE_SCOTCH_604 1
93 setenv WM_THIRD_PARTY_USE_PARMETIS_403 1
94 setenv WM_THIRD_PARTY_USE_PYFOAM_064 1
95 setenv WM_THIRD_PARTY_USE_HWLOC_1101 1
99 #setenv WM_THIRD_PARTY_USE_QT_486 1
100 setenv WM_THIRD_PARTY_USE_PARAVIEW_431 1
103 # Source files, possibly with some verbosity
104 alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; source \!*'
106 # Add in preset user or site preferences:
107 if ( -e $WM_PROJECT_DIR/etc/prefs.csh ) then
108 _foamSource $WM_PROJECT_DIR/etc/prefs.csh
110 if ($?FOAM_VERBOSE && $?prompt) echo "No prefs.csh found"
113 # Evaluate command-line parameters
117 # name= -> unsetenv name
118 eval "unsetenv $argv[1]:s/=//"
121 # name=value -> setenv name value
122 eval "setenv $argv[1]:s/=/ /"
129 # Operating System/Platform
130 # ~~~~~~~~~~~~~~~~~~~~~~~~~
131 # WM_OSTYPE = POSIX | ????
132 if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX
135 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
136 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137 if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc
138 #setenv WM_COMPILER Gcc
139 #setenv WM_COMPILER Icc
141 setenv WM_COMPILER_ARCH
142 setenv WM_COMPILER_LIB_ARCH
145 # Compilation options (architecture, precision, optimised, debug or profiling)
146 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
147 # WM_ARCH_OPTION = 32 | 64
148 if ( ! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64
150 # WM_PRECISION_OPTION = LDP | DP | SP
151 if ( ! $?WM_PRECISION_OPTION ) setenv WM_PRECISION_OPTION DP
153 # WM_COMPILE_OPTION = Opt | Debug | Prof
154 if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt
155 #setenv WM_COMPILE_OPTION Opt
156 #setenv WM_COMPILE_OPTION Debug
158 # WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI | MVAPICH2
159 if ( ! $?WM_MPLIB ) setenv WM_MPLIB OPENMPI
161 # WM_NCOMPPROCS = <number of processes to use>
162 # Warning: Need to use a complete path for foamGetSystemInfo because the PATH
163 # environment variable is not properly initialized yet.
164 if ( ! $?WM_NCOMPPROCS ) setenv WM_NCOMPPROCS `$WM_PROJECT_DIR/bin/foamGetSystemInfo -nbrCores`
166 # Run options (floating-point signal handling and memory initialisation)
167 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172 # Detect system type and set environment variables
173 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174 setenv WM_ARCH `uname -s`
185 switch ($WM_ARCH_OPTION)
188 setenv WM_COMPILER_ARCH '-64'
189 setenv WM_CFLAGS '-m32 -fPIC'
190 setenv WM_CXXFLAGS '-m32 -fPIC'
191 setenv WM_LDFLAGS '-m32'
195 setenv WM_ARCH linux64
196 setenv WM_COMPILER_LIB_ARCH 64
197 setenv WM_CFLAGS '-m64 -fPIC'
198 setenv WM_CXXFLAGS '-m64 -fPIC'
199 setenv WM_LDFLAGS '-m64'
203 echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
210 setenv WM_ARCH linuxIA64
211 setenv WM_COMPILER I64
215 setenv WM_ARCH SiCortex64
216 setenv WM_COMPILER_LIB_ARCH 64
217 setenv WM_CFLAGS '-mabi=64 -fPIC'
218 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
219 setenv WM_LDFLAGS '-mabi=64 -G0'
224 setenv WM_ARCH linuxPPC64
225 setenv WM_COMPILER_LIB_ARCH 64
226 setenv WM_CFLAGS '-m64 -fPIC'
227 setenv WM_CXXFLAGS '-m64 -fPIC'
228 setenv WM_LDFLAGS '-m64'
232 setenv WM_ARCH linuxARM7
233 setenv WM_COMPILER_LIB_ARCH 32
236 setenv WM_CFLAGS '-fPIC -mfloat-abi=hard'
237 setenv WM_CXXFLAGS '-fPIC -mfloat-abi=hard'
238 setenv WM_LDFLAGS '-mfloat-abi=hard'
242 echo Unknown processor type `uname -m` for Linux
249 # this makes certain things easier
250 setenv WM_ARCH_BASE darwin
252 # Remove limit on number of open files
257 setenv WM_ARCH darwinPpc
260 setenv WM_ARCH darwinIntel
263 echo "This seems to be an Intel-Mac please tell me the output of 'uname -p'. Bernhard."
264 setenv WM_ARCH darwinIntel
267 switch ($WM_ARCH_OPTION)
269 setenv WM_CFLAGS '-m32 -fPIC'
270 setenv WM_CXXFLAGS '-m32 -fPIC'
271 setenv WM_LDFLAGS '-m32'
274 setenv WM_ARCH ${WM_ARCH}64
275 setenv WM_CFLAGS '-m64 -fPIC'
276 setenv WM_CXXFLAGS '-m64 -fPIC'
277 setenv WM_LDFLAGS '-m64'
280 echo "Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64"
284 # Make sure that binaries use the best features of the used OS-Version
285 # We need to get rid of the revision number from this string. eg turn "10.7.5" into "10.7"
286 set v=`sw_vers -productVersion | sed 's/\./ /g'`
287 setenv MACOSX_DEPLOYMENT_TARGET "$v[1].$v[2]"
289 # Use Mac-Ports-Compiler instead of Apple-gcc-4.2
290 if ( ! $?compilerInstall ) setenv compilerInstall System
291 if ( $compilerInstall == "System" ) then
292 switch ($WM_COMPILER)
294 setenv WM_CC 'gcc-mp-4.3'
295 setenv WM_CXX 'g++-mp-4.3'
298 setenv WM_CC 'gcc-mp-4.4'
299 setenv WM_CXX 'g++-mp-4.4'
302 setenv WM_CC 'gcc-mp-4.5'
303 setenv WM_CXX 'g++-mp-4.5'
306 #setenv WM_COMPILER ""
312 setenv WM_ARCH SunOS64
313 setenv WM_COMPILER_LIB_ARCH 64
314 setenv WM_CFLAGS '-mabi=64 -fPIC'
315 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
316 setenv WM_LDFLAGS '-mabi=64 -G0'
317 setenv WM_MPLIB FJMPI
322 echo "Your '$WM_ARCH' operating system is not supported by this release"
323 echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.org"
330 # Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH)
331 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332 set cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
334 if (! $?LD_LIBRARY_PATH ) then
335 setenv LD_LIBRARY_PATH ''
337 if (! $?MANPATH) then
342 set colonPath=`echo "$path" | sed -e 's/ /:/g'`
343 set cleanEnv=`$cleanProg "$colonPath" "$foamOldDirs"`
344 if ( $status == 0 ) then
345 set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
348 #- Clean LD_LIBRARY_PATH
349 setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"`
352 setenv MANPATH `$cleanProg "$MANPATH" "$foamOldDirs"`
355 # Source project setup files
356 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
357 _foamSource $WM_PROJECT_DIR/etc/settings.csh
358 _foamSource $WM_PROJECT_DIR/etc/aliases.csh
360 # Source user setup files for optional packages
361 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
362 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/cshrc
363 #_foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
364 # _foamSource $WM_PROJECT_DIR/etc/apps/ensight/cshrc
367 # Clean environment paths again. Only remove duplicates
368 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
370 set colonPath=`echo "$path" | sed -e 's/ /:/g'`
371 set cleanEnv=`$cleanProg "$colonPath"`
372 if ( $status == 0 ) then
373 set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
376 #- Clean LD_LIBRARY_PATH
377 setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH"`
380 setenv MANPATH `$cleanProg "$MANPATH"`:
383 if ( $?LD_PRELOAD ) then
384 setenv LD_PRELOAD `$cleanProg "$LD_PRELOAD"`
387 #- Clean DYLD_LIBRARY_PATH
388 if ( $?DYLD_LIBRARY_PATH ) then
389 setenv DYLD_LIBRARY_PATH `$cleanProg "$DYLD_LIBRARY_PATH"`
392 # cleanup environment:
393 # ~~~~~~~~~~~~~~~~~~~~
394 unset cleanEnv cleanProg colonPath foamInstall foamOldDirs
397 # -----------------------------------------------------------------------------