You need to sign in or sign up before continuing.
Newer
Older
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
Henry Weller
committed
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
Mark Olesen
committed
# File
# The OpenFOAM environment for POSIX shell (eg, bash,dash,zsh,...).
# Source manually or from the ~/.bashrc or ~/.profile files.
# Many settings can be overridden using a <prefs.sh> file:
# - Base values (eg, from system admin):
# - $WM_PROJECT_DIR/etc/prefs.sh
# - User or group values (first file found):
# - ~/.OpenFOAM/$WM_PROJECT_VERSION/prefs.sh
# - ~/.OpenFOAM/prefs.sh
# - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.sh
# - $WM_PROJECT_SITE/site/prefs.sh
#
# Environment
# FOAM_VERBOSE (set/unset)
# - add extra verbosity when sourcing files
# FOAM_CONFIG_NOUSER (set/unset)
# - suppress use of user/group configuration files
#
# Note
# Changes made to this bashrc file may be lost with the next upgrade.
#
#------------------------------------------------------------------------------
export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=plus
# [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation.
# \- When this file is located as $WM_PROJECT_DIR/etc/bashrc, the next lines
# should work when sourced by BASH or ZSH shells. If this however fails,
# set one of the fallback values to an appropriate path.
# --
rc="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
[ -n "$rc" ] && FOAM_INST_DIR="$(\cd $(dirname $rc)/../.. && \pwd -L)" || \
FOAM_INST_DIR="$HOME/$WM_PROJECT"
# FOAM_INST_DIR="/opt/$WM_PROJECT"
# FOAM_INST_DIR="/usr/local/$WM_PROJECT"
Mark Olesen
committed
#
# END OF (NORMAL) USER EDITABLE PART
################################################################################
: # Extra safety - if the user commented out all fallback values
unset rc
# Configuration environment variables.
# Should override via <prefs.sh> file instead of editing this file.
# [WM_COMPILER_TYPE] - Compiler location:
# = system | ThirdParty
export WM_COMPILER_TYPE=system
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | Gcc8[12] | GccKNL |
# Clang | Clang3[7-9] | Clang[4-6]0 | Icc | IccKNL | Cray | Arm
export WM_COMPILER=Gcc
# [WM_ARCH_OPTION] - Memory addressing:
# = 32 | 64
# * on a 64-bit OS this can be 32 or 64
# * on a 32-bit OS, it is always 32-bit and this option is ignored
export WM_ARCH_OPTION=64
# [WM_PRECISION_OPTION] - Floating-point precision:
# = DP | SP
export WM_PRECISION_OPTION=DP
# [WM_LABEL_SIZE] - Label size in bits:
# = 32 | 64
# [WM_COMPILE_OPTION] - Optimised, debug, profiling:
# = Opt | Debug | Prof
export WM_COMPILE_OPTION=Opt
# [WM_MPLIB] - MPI implementation:
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
export WM_MPLIB=SYSTEMOPENMPI
#------------------------------------------------------------------------------
# (legacy / advanced)
#
# [FOAM_SIGFPE] - Trap floating-point exceptions.
# - overrides the 'trapFpe' controlDict entry
# = true | false
#export FOAM_SIGFPE=true
# [FOAM_SETNAN] - Initialize memory with NaN
# - overrides the 'setNaN' controlDict entry
# = true | false
#export FOAM_SETNAN=false
# [WM_OSTYPE] - Operating System Type:
# = POSIX
#export WM_OSTYPE=POSIX
################################################################################
# Old directories to be cleaned from PATH, LD_LIBRARY_PATH
foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
$HOME/$WM_PROJECT/$USER $FOAM_USER_APPBIN $FOAM_USER_LIBBIN \
$WM_PROJECT_SITE $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN"
# Location of installation and third-party software
export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# [WM_PROJECT_SITE] - Location of site-specific (group) files
# default (unset) implies WM_PROJECT_INST_DIR/site
if [ -d "$WM_PROJECT_SITE" ]
then
export WM_PROJECT_SITE
else
unset WM_PROJECT_SITE
fi
# [WM_PROJECT_USER_DIR] - Location of user files
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
unset WM_SHELL_FUNCTIONS
. $WM_PROJECT_DIR/etc/config.sh/functions
# Overrides via <prefs.sh>
# 1. other (system) values
_foamEtc -mode=o prefs.sh
# 2. user or group values (unless disabled)
[ -z "$FOAM_CONFIG_NOUSER" ] && _foamEtc -mode=ug prefs.sh
# Evaluate command-line parameters and record settings for later.
# These can be used to set/unset values, specify additional files etc.
FOAM_SETTINGS="$@"
if [ -z "$FOAM_SETTINGS" ]
then
unset FOAM_SETTINGS
else
export FOAM_SETTINGS
_foamEval "$@"
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
Mark Olesen
committed
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export PATH MANPATH LD_LIBRARY_PATH
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
_foamClean LD_LIBRARY_PATH "$foamOldDirs"
# Setup for OpenFOAM compilation etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config settings
# Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi
_foamEtc -config paraview -- "$@" # Pass through for evaluation
_foamEtc -config vtk
_foamEtc -config ensight
_foamEtc -config gperftools
## _foamEtc -config ADIOS
_foamEtc -config CGAL
_foamEtc -config scotch
_foamEtc -config FFTW
if [ -d "$WM_PROJECT_DIR/doc/man1" ]
then
_foamAddMan "$WM_PROJECT_DIR/doc"
fi
# Interactive shell
if /usr/bin/tty -s 2>/dev/null
then
_foamEtc -config aliases
[ "${BASH_VERSINFO:-0}" -ge 4 ] && _foamEtc -config bash_completion
Mark Olesen
committed
# Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export PATH MANPATH LD_LIBRARY_PATH
_foamClean PATH
_foamClean MANPATH
_foamClean LD_LIBRARY_PATH
# Add trailing ':' for system manpages
if [ -n "$MANPATH" ]
then
MANPATH="${MANPATH}:"
fi
if [ -n "$LD_PRELOAD" ]
Mark Olesen
committed
then
export LD_PRELOAD
_foamClean LD_PRELOAD
# Cleanup temporary information
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Unload shell functions
. $WM_PROJECT_DIR/etc/config.sh/functions
# Variables (done as the last statement for a clean exit code)
unset FOAM_INST_DIR # Old variable name (OpenFOAM-v1606) - now unneeded
unset cleaned foamOldDirs
#------------------------------------------------------------------------------