bashrc 5.85 KB
Newer Older
1
2
3
4
#----------------------------------*-sh-*--------------------------------------
# =========                 |
# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
#  \\    /   O peration     |
OpenFOAM bot's avatar
OpenFOAM bot committed
5
6
7
8
#   \\  /    A nd           | Copyright (C) 2016-2019 OpenCFD Ltd.
#    \\/     M anipulation  |
#------------------------------------------------------------------------------
#                           | Copyright (C) 2011-2016 OpenFOAM Foundation
9
10
#------------------------------------------------------------------------------
# License
11
12
#     This file is part of OpenFOAM, licensed under GNU General Public License
#     <http://www.gnu.org/licenses/>.
13
#
14
# File
15
#     etc/bashrc
16
17
#
# Description
18
19
#     The OpenFOAM environment for POSIX shell (eg, bash,dash,zsh,...).
#     Source manually or from the ~/.bashrc or ~/.profile files.
20
#
21
#     Many settings can be overridden using a <prefs.sh> file:
22
#
23
24
#       - Base values (eg, from system admin):
#         -  $WM_PROJECT_DIR/etc/prefs.sh
25
#
26
#       - User or group values (first file found):
27
#         -  ~/.OpenFOAM/$FOAM_API/prefs.sh
28
#         -  ~/.OpenFOAM/prefs.sh
29
#         -  $WM_PROJECT_SITE/$FOAM_API/etc/prefs.sh
30
#         -  $WM_PROJECT_SITE/etc/prefs.sh
31
#
32
33
34
35
36
# Environment
#     FOAM_VERBOSE (set/unset)
#         - add extra verbosity when sourcing files
#     FOAM_CONFIG_NOUSER (set/unset)
#         - suppress use of user/group configuration files
37
38
#     WM_PROJECT_SITE (optional directory)
#         - local site-specific directory, uses WM_PROJECT_DIR/site if unset
39
40
41
42
#
# Note
#     Changes made to this bashrc file may be lost with the next upgrade.
#
43
44
45
#------------------------------------------------------------------------------

export WM_PROJECT=OpenFOAM
46
export WM_PROJECT_VERSION=plus
47

48
# [projectDir] - directory containing this OpenFOAM version.
49
# \- When this file is located as $WM_PROJECT_DIR/etc/bashrc, the next lines
50
51
#    should work when sourced by BASH or ZSH shells. If this however fails,
#    set one of the fallback values to an appropriate path.
52
#
53
54
55
56
57
58
59
60
#    This can be removed if an absolute path is provided for WM_PROJECT_DIR
#    later on in this file
# --
projectDir="${BASH_SOURCE:-${ZSH_NAME:+$0}}";
[ -n "$projectDir" ] && projectDir="$(\cd $(dirname $projectDir)/.. && \pwd -L)" ||\
projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# projectDir="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# projectDir="/usr/local/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
61
62
# END OF (NORMAL) USER EDITABLE PART
################################################################################
63
: # Safety statement (if the user removed all fallback values)
64

65
66
# Configuration environment variables.
# Should override via <prefs.sh> file instead of editing this file.
67

68
69
# [WM_COMPILER_TYPE] - Compiler location:
# = system | ThirdParty
70
export WM_COMPILER_TYPE=system
71

72
# [WM_COMPILER] - Compiler:
73
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-5] | Gcc7[1-4] | Gcc8[12] |
74
#   Clang | Clang3[7-9] | Clang[4-6]0 | Icc | Cray | Arm | Pgi
75
76
export WM_COMPILER=Gcc

77
# [WM_PRECISION_OPTION] - Floating-point precision:
78
# = DP | SP | SPDP
79
80
export WM_PRECISION_OPTION=DP

81
82
# [WM_LABEL_SIZE] - Label size in bits:
# = 32 | 64
83
84
export WM_LABEL_SIZE=32

85
# [WM_COMPILE_OPTION] - Optimised, debug, profiling, other:
86
# = Opt | Debug | Prof
87
88
# Other is processor or packaging specific, for example
# = OptKNL
89
90
export WM_COMPILE_OPTION=Opt

91
92
93
# [WM_MPLIB] - MPI implementation:
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
#   HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
94
# Also possible to use INTELMPI-xyz etc and define your own wmake rule
95
export WM_MPLIB=SYSTEMOPENMPI
96
97


98
#------------------------------------------------------------------------------
99
# (advanced / legacy)
100

101
# [FOAM_SIGFPE] - Trap floating-point exceptions.
102
103
#               - overrides the 'trapFpe' controlDict entry
# = true | false
104
#export FOAM_SIGFPE=true
105

106
# [FOAM_SETNAN] - Initialize memory with NaN
107
108
#               - overrides the 'setNaN' controlDict entry
# = true | false
109
#export FOAM_SETNAN=false
110

111
112
113
# [FOAM_CODE_TEMPLATES] - dynamicCode templates
# - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
##export FOAM_CODE_TEMPLATES="$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"
114

115
116
117
118
# [FOAM_JOB_DIR] - location of jobControl
#                - unset: equivalent to ~/.OpenFOAM/jobControl
# export FOAM_JOB_DIR="$HOME/.OpenFOAM/jobControl"

119
120
121
# [WM_OSTYPE] - Operating System Type
# = POSIX
#export WM_OSTYPE=POSIX
122

123
124
125
126
# [WM_ARCH_OPTION] - compiling with -m32 option on 64-bit system
# = 32 | 64
#   * on a 64-bit OS this can be 32 or 64
#   * on a 32-bit OS this option is ignored (always 32-bit)
127
#export WM_ARCH_OPTION=64
128

129
130
################################################################################

131
# Capture values of old directories to be cleaned from PATH, LD_LIBRARY_PATH
Henry Weller's avatar
Henry Weller committed
132
133
foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
    $HOME/$WM_PROJECT/$USER $FOAM_USER_APPBIN $FOAM_USER_LIBBIN \
134
    $WM_PROJECT_SITE $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN"
135

136
137
# [WM_PROJECT_DIR] - Location of this OpenFOAM version
export WM_PROJECT_DIR="$projectDir"
138

139
# [WM_PROJECT_USER_DIR] - Location of user files
140
export WM_PROJECT_USER_DIR="$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION"
141

142
# [WM_PROJECT_SITE] - Location of site-specific (group) files
143
144
145
# Default (unset) implies WM_PROJECT_DIR/site
# Normally defined in calling environment

146

147
148
# Finalize setup of OpenFOAM environment for POSIX shell
if [ -d "$WM_PROJECT_DIR" ]
149
then
150
151
152
153
154
    if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
    then
        echo "source $WM_PROJECT_DIR/etc/config.sh/setup" 1>&2
    fi
    . "$WM_PROJECT_DIR/etc/config.sh/setup" "$@"
155
else
156
157
    echo "Error: did not locate installation path for $WM_PROJECT-$WM_PROJECT_VERSION" 1>&2
    echo "No directory: $WM_PROJECT_DIR" 1>&2
158
fi
159

160
161
# Cleanup variables (done as final statement for a clean exit code)
unset foamOldDirs projectDir
162

163
#------------------------------------------------------------------------------