Skip to content
Snippets Groups Projects
Commit a820e2d2 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: add explicit note to bashrc,cshrc about using prefs.{sh,csh}

- adjust comment formatting to reduce clutter
parent dd2b3d4e
Branches
Tags
No related merge requests found
......@@ -16,20 +16,30 @@
# Set OpenFOAM environment for POSIX shell (eg, bash,dash,zsh,...)
# Source manually or from the ~/.profile or ~/.bashrc files.
#
# Note
# Many environment variables can be overridden using a <prefs.sh> file
# from one of these locations:
# * user-specific:
# * ~/.OpenFOAM/$WM_PROJECT_VERSION
# * ~/.OpenFOAM
# * group-specific:
# * $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION
# * $WM_PROJECT_SITE/site
# * general:
# * $WM_PROJECT_DIR/etc
#
# Any changes made to this bashrc file may be lost with the next upgrade.
#
#------------------------------------------------------------------------------
export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=plus
################################################################################
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
#
# FOAM_INST_DIR = the parent directory containing the OpenFOAM installation(s).
# - If the OpenFOAM installation has this OpenFOAM-<VERSION>/etc/bashrc, the
# next lines should work when sourced by a BASH or ZSH shell.
# - If this does not produce the desired result, please set one of the fallback
# values to an appropriate path.
#
# [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
......@@ -42,54 +52,55 @@ FOAM_INST_DIR=$HOME/$WM_PROJECT
export FOAM_INST_DIR
unset rc
# The default environment variables below can be overridden in a prefs.sh file
# located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM,
# $FOAM_INST_DIR/site/$WM_PROJECT_VERSION or $FOAM_INST_DIR/site
# Default environment variables.
# Can override with a <prefs.sh> file instead of editing below.
#- Compiler location:
# WM_COMPILER_TYPE = system | ThirdParty
# [WM_COMPILER_TYPE] - Compiler location:
# = system | ThirdParty
export WM_COMPILER_TYPE=system
#- Compiler:
# WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-3] | GccKNL
# | Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-3] | Gcc7[1-2] | GccKNL |
# Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray
export WM_COMPILER=Gcc
#- Memory addressing:
# WM_ARCH_OPTION = 32 | 64
# - on a 64-bit OS this can be 32 or 64
# - on a 32-bit OS addressing is 32-bit and this option is not used
# [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
#- Precision:
# WM_PRECISION_OPTION = DP | SP
# [WM_PRECISION_OPTION] - Floating-point precision:
# = DP | SP
export WM_PRECISION_OPTION=DP
#- Label size:
# WM_LABEL_SIZE = 32 | 64
# [WM_LABEL_SIZE] - Label size in bits:
# = 32 | 64
export WM_LABEL_SIZE=32
#- Optimised, debug, profiling:
# WM_COMPILE_OPTION = Opt | Debug | Prof
# [WM_COMPILE_OPTION] - Optimised, debug, profiling:
# = Opt | Debug | Prof
export WM_COMPILE_OPTION=Opt
#- MPI implementation:
# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI
# | MPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
# [WM_MPLIB] - MPI implementation:
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
export WM_MPLIB=SYSTEMOPENMPI
#- Operating System:
# WM_OSTYPE = POSIX
#export WM_OSTYPE=POSIX
#- Alternative to 'trapFpe' controlDict entry
# for floating-point exceptions (true|false)
# [FOAM_SIGFPE] - Trapping of floating-point exceptions.
# - overrides the 'trapFpe' controlDict entry
# = true | false
#export FOAM_SIGFPE=true
#- Alternative to 'setNaN' controlDict entry
# for memory initialisation (true|false)
# [FOAM_SETNAN] - Memory initialisation as NaN
# - overrides the 'setNaN' controlDict entry
# = true | false
#export FOAM_SETNAN=false
# [WM_OSTYPE] - Operating System Type:
# = POSIX
#export WM_OSTYPE=POSIX
################################################################################
......@@ -139,14 +150,14 @@ _foamEval $@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
#- Clean PATH
# Clean PATH
cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned"
#- Clean LD_LIBRARY_PATH
# Clean LD_LIBRARY_PATH
cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \
&& LD_LIBRARY_PATH="$cleaned"
#- Clean MANPATH
# Clean MANPATH
cleaned=$($foamClean "$MANPATH" "$foamOldDirs") && MANPATH="$cleaned"
export PATH LD_LIBRARY_PATH MANPATH
......@@ -184,18 +195,18 @@ _foamEtc config.sh/FFTW
# Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean PATH
# Clean PATH
cleaned=$($foamClean "$PATH") && PATH="$cleaned"
#- Clean LD_LIBRARY_PATH
# Clean LD_LIBRARY_PATH
cleaned=$($foamClean "$LD_LIBRARY_PATH") && LD_LIBRARY_PATH="$cleaned"
#- Clean MANPATH (trailing ':' to find system pages)
# Clean MANPATH (trailing ':' to find system pages)
cleaned=$($foamClean "$MANPATH") && MANPATH="${cleaned}:"
export PATH LD_LIBRARY_PATH MANPATH
#- Clean LD_PRELOAD
# Clean LD_PRELOAD
if [ -n "$LD_PRELOAD" ]
then
cleaned=$($foamClean "$LD_PRELOAD") && LD_PRELOAD="$cleaned"
......@@ -206,10 +217,10 @@ fi
# Cleanup environment
# ~~~~~~~~~~~~~~~~~~~
#- Functions
# Functions
. $WM_PROJECT_DIR/etc/config.sh/functions
#- Variables (do as last for a clean exit code)
# Variables (do as last for a clean exit code)
unset cleaned foamClean foamOldDirs
#------------------------------------------------------------------------------
......@@ -16,20 +16,30 @@
# Set OpenFOAM environment for C-shell (csh, tcsh).
# Source manually or from the ~/.login or ~/.cshrc files.
#
# Note
# Many environment variables can be overridden using a <prefs.csh> file
# from one of these locations:
# * user-specific:
# * ~/.OpenFOAM/$WM_PROJECT_VERSION
# * ~/.OpenFOAM
# * group-specific:
# * $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION
# * $WM_PROJECT_SITE/site
# * general:
# * $WM_PROJECT_DIR/etc
#
# Any changes made to this cshrc file may be lost with the next upgrade.
#
#------------------------------------------------------------------------------
setenv WM_PROJECT OpenFOAM
setenv WM_PROJECT_VERSION plus
################################################################################
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
#
# FOAM_INST_DIR = the parent directory containing the OpenFOAM installation(s).
# - If the OpenFOAM installation has this OpenFOAM-<VERSION>/etc/cshrc, the
# next lines should work when sourced by a CSH or TCSH shell.
# - If this does not produce the desired result, please set one of the fallback
# values to an appropriate path.
#
# [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation.
# * When this file is located as $WM_PROJECT_DIR/etc/cshrc, the next lines
# should work when sourced by CSH or TCSH shells. If this however fails,
# set one of the fallback values to an appropriate path.
# --
setenv FOAM_INST_DIR `lsof +p $$ |& \
sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc.*@@p'`
# setenv FOAM_INST_DIR $HOME/$WM_PROJECT
......@@ -39,54 +49,55 @@ setenv FOAM_INST_DIR `lsof +p $$ |& \
# END OF (NORMAL) USER EDITABLE PART
################################################################################
# The default environment variables below can be overridden in a prefs.csh file
# located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM,
# $FOAM_INST_DIR/site/$WM_PROJECT_VERSION or $FOAM_INST_DIR/site
# Default environment variables.
# Can override with a <prefs.sh> file instead of editing below.
#- Compiler location:
# WM_COMPILER_TYPE = system | ThirdParty
# [WM_COMPILER_TYPE] - Compiler location:
# = system | ThirdParty
setenv WM_COMPILER_TYPE system
#- Compiler:
# WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-3] | GccKNL
# | Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-3] | Gcc7[1-2] | GccKNL |
# Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray
setenv WM_COMPILER Gcc
#- Memory addressing:
# WM_ARCH_OPTION = 32 | 64
# - on a 64-bit OS this can be 32 or 64
# - on a 32-bit OS addressing is 32-bit and this option is not used
# [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
setenv WM_ARCH_OPTION 64
#- Precision:
# WM_PRECISION_OPTION = DP | SP
# [WM_PRECISION_OPTION] - Floating-point precision:
# = DP | SP
setenv WM_PRECISION_OPTION DP
#- Label size:
# WM_LABEL_SIZE = 32 | 64
# [WM_LABEL_SIZE] - Label size in bits:
# = 32 | 64
setenv WM_LABEL_SIZE 32
#- Optimised, debug, profiling:
# WM_COMPILE_OPTION = Opt | Debug | Prof
# [WM_COMPILE_OPTION] - Optimised, debug, profiling:
# = Opt | Debug | Prof
setenv WM_COMPILE_OPTION Opt
#- MPI implementation:
# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI
# | MPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
# [WM_MPLIB] - MPI implementation:
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
setenv WM_MPLIB SYSTEMOPENMPI
#- Operating System:
# WM_OSTYPE = POSIX
#setenv WM_OSTYPE POSIX
#- Alternative to 'trapFpe' controlDict entry
# for floating-point exceptions (true|false)
# [FOAM_SIGFPE] - Trapping of floating-point exceptions.
# - overrides the 'trapFpe' controlDict entry
# = true | false
#setenv FOAM_SIGFPE true
#- Alternative to 'setNaN' controlDict entry
# for memory initialisation (true|false)
# [FOAM_SETNAN] - Memory initialisation as NaN
# - overrides the 'setNaN' controlDict entry
# = true | false
#setenv FOAM_SETNAN false
# [WM_OSTYPE] - Operating System Type:
# = POSIX
#setenv WM_OSTYPE POSIX
################################################################################
......@@ -180,21 +191,21 @@ end
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
#- prevent local variables from shadowing setenv variables
# Prevent local variables from shadowing setenv variables
unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
if (! $?MANPATH ) setenv MANPATH
#- Clean PATH (path)
# Clean PATH (path)
set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH
# Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
#- Clean MANPATH
# Clean MANPATH
set cleaned=`$foamClean "$MANPATH" "$foamOldDirs"`
if ( $status == 0 ) setenv MANPATH $cleaned
......@@ -223,19 +234,19 @@ _foamEtc config.csh/FFTW
# Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean PATH (path)
# Clean PATH (path)
set cleaned=`$foamClean "$PATH"`
if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH
# Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
#- Clean MANPATH (trailing ':' to find system pages)
# Clean MANPATH (trailing ':' to find system pages)
set cleaned=`$foamClean "$MANPATH"`
if ( $status == 0 ) setenv MANPATH "${cleaned}:"
#- Clean LD_PRELOAD
# Clean LD_PRELOAD
if ( $?LD_PRELOAD ) then
set cleaned=`$foamClean "$LD_PRELOAD"`
if ( $status == 0 ) setenv LD_PRELOAD $cleaned
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment