mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- Use the OPENFOAM define (eg, 1806, 1812), which normally corresponds
to a major release, to define an API level. This remains consistent
within a release cycle and means that it is possible to manage
several sub-versions and continue to have a consistent lookup.
The current API value is updated automatically during the build
and cached as meta data for later use, even when the wmake/ directory
is missing or OpenFOAM has not yet be initialized.
The version information reported on program start or with -help
usage adjusted to reflect this. The build tag from git now also
carries the date as being more meaningful to trace than a hash
value.
- Update etc/bashrc and etc/cshrc to obtain the project directory
directly instead of via its prefix directory. The value obtained
corresponds to an absolute path, from which the prefix directory
can be obtained.
The combination of these changes removes the reliance on any
particular directory naming convention.
For example,
With an 1812 version (API level):
WM_PROJECT_VERSION=myVersion
installed as /some/path/somewhere/openfoam-mySandbox
This makes the -prefix, -foamInstall, -projectVersion, -version
values of foamEtcFiles, and similar entries for foamConfigurePaths
superfluous.
WM_PROJECT_INST_DIR is no longer required or used
ENH: improve handling and discovery of ThirdParty
- improve the flexibility and reusability of ThirdParty packs to cover
various standard use cases:
1. Unpacking initial release tar files with two parallel directories
- OpenFOAM-v1812/
- ThirdParty-v1812/
2. With an adjusted OpenFOAM directory name, for whatever reason
- OpenFOAM-v1812-myCustom/
- openfoam-1812-other-info/
3. Operating with/without ThirdParty directory
To handle these use cases, the following discovery is used.
Note PROJECT = the OpenFOAM directory `$WM_PROJECT_DIR`
PREFIX = the parent directory
VERSION = `$WM_PROJECT_VERSION`
API = `$WM_PROJECT_API`, as per `foamEtcFiles -show-api`
0. PROJECT/ThirdParty
- for single-directory installations
1. PREFIX/ThirdParty-VERSION
- this corresponds to the traditional approach
2. PREFIX/ThirdParty-vAPI
- allows for an updated value of VERSION (eg, v1812-myCustom)
without requiring a renamed ThirdParty. The API value
would still be '1812' and the original ThirdParty-v1812/
would be found.
3. PREFIX/ThirdParty-API
- this is the same as the previous example, but using an unadorned
API value. This also makes sense if the chosen version name also
uses the unadorned API value in its naming
(eg, 1812-patch190131, 1812.19W03)
4. PREFIX/ThirdParty-common
- permits maximum reuse for various versions, but only for
experienced user who are aware of potential version
incompatibilities
Directory existence is checked as is the presence of an Allwmake file
or a platforms/ directory. This reduces the potential of false positive
matches and limits the selection to directories that are either
with sources (has the Allwmake file), or pre-compiled binaries (has
the platforms/ directory).
If none of the explored directories are found to be suitable,
it reverts to using a PROJECT/ThirdParty dummy location since
this is within the project source tree and can be trusted to
have no negative side-effects.
ENH: add csh support to foamConfigurePaths
- this removes the previously experienced inconsistence in config file
contents.
REMOVED: foamExec
- was previously used when switching versions and before the
bashrc/cshrc discovery logic was added. It is now obsolete.
177 lines
6.0 KiB
Bash
177 lines
6.0 KiB
Bash
#----------------------------------*-sh-*--------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / 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/>.
|
|
#
|
|
# File
|
|
# etc/cshrc
|
|
#
|
|
# Description
|
|
# The OpenFOAM environment for C-shell (csh, tcsh).
|
|
# Source manually or from the ~/.cshrc or ~/.login files.
|
|
#
|
|
# Many settings can be overridden using a <prefs.csh> file:
|
|
#
|
|
# - Base values (eg, from system admin):
|
|
# - $WM_PROJECT_DIR/etc/prefs.csh
|
|
#
|
|
# - User or group values (first file found):
|
|
# - ~/.OpenFOAM/$WM_PROJECT_API/prefs.csh
|
|
# - ~/.OpenFOAM/prefs.csh
|
|
# - $WM_PROJECT_SITE/$WM_PROJECT_API/etc/prefs.csh
|
|
# - $WM_PROJECT_SITE/prefs.csh
|
|
#
|
|
# Environment
|
|
# FOAM_VERBOSE (set/unset)
|
|
# - add extra verbosity when sourcing files
|
|
# FOAM_CONFIG_NOUSER (set/unset)
|
|
# - suppress use of user/group configuration files
|
|
# WM_PROJECT_SITE (optional directory)
|
|
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
|
|
#
|
|
# Note
|
|
# Changes made to this cshrc file may be lost with the next upgrade.
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
|
|
setenv WM_PROJECT OpenFOAM
|
|
setenv WM_PROJECT_VERSION plus
|
|
|
|
# [projectDir] - 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.
|
|
#
|
|
# This can be removed if an absolute path is provided for WM_PROJECT_DIR
|
|
# later on in this file.
|
|
# --
|
|
# If the directory naming does not match WM_PROJECT, need to change here
|
|
set projectName="$WM_PROJECT"
|
|
set projectDir=`lsof +p $$ |& \
|
|
sed -n -e 's@^[^/]*@@; s@\(/'"$projectName"'[^/]*\)/etc/cshrc[^/]*@\1@p'`
|
|
|
|
# set projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
|
|
# set projectDir="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
|
|
# set projectDir="/usr/local/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
|
|
# END OF (NORMAL) USER EDITABLE PART
|
|
################################################################################
|
|
|
|
# Configuration environment variables.
|
|
# Should override via <prefs.csh> file instead of editing this file.
|
|
|
|
# [WM_COMPILER_TYPE] - Compiler location:
|
|
# = system | ThirdParty
|
|
setenv 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
|
|
setenv 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
|
|
setenv WM_ARCH_OPTION 64
|
|
|
|
# [WM_PRECISION_OPTION] - Floating-point precision:
|
|
# = DP | SP
|
|
setenv WM_PRECISION_OPTION DP
|
|
|
|
# [WM_LABEL_SIZE] - Label size in bits:
|
|
# = 32 | 64
|
|
setenv WM_LABEL_SIZE 32
|
|
|
|
# [WM_COMPILE_OPTION] - Optimised, debug, profiling:
|
|
# = Opt | Debug | Prof
|
|
setenv WM_COMPILE_OPTION Opt
|
|
|
|
# [WM_MPLIB] - MPI implementation:
|
|
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
|
|
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
|
|
setenv WM_MPLIB SYSTEMOPENMPI
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
# (advanced / legacy)
|
|
#
|
|
# [FOAM_SIGFPE] - Trap floating-point exceptions.
|
|
# - overrides the 'trapFpe' controlDict entry
|
|
# = true | false
|
|
#setenv FOAM_SIGFPE true
|
|
|
|
# [FOAM_SETNAN] - Initialize memory with NaN
|
|
# - overrides the 'setNaN' controlDict entry
|
|
# = true | false
|
|
#setenv FOAM_SETNAN false
|
|
|
|
# [FOAM_CODE_TEMPLATES] - dynamicCode templates
|
|
# - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
|
|
##setenv FOAM_CODE_TEMPLATES "$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"
|
|
|
|
# [FOAM_JOB_DIR] - location of jobControl
|
|
# - unset: equivalent to ~/.OpenFOAM/jobControl
|
|
#setenv FOAM_JOB_DIR "$HOME/.OpenFOAM/jobControl"
|
|
|
|
# [WM_OSTYPE] - Operating System Type
|
|
# = POSIX
|
|
#setenv WM_OSTYPE POSIX
|
|
|
|
################################################################################
|
|
|
|
# Old directories to be cleaned from PATH, LD_LIBRARY_PATH
|
|
set foamOldDirs=
|
|
if ( $?WM_PROJECT_DIR ) then
|
|
set foamOldDirs="$foamOldDirs $WM_PROJECT_DIR"
|
|
endif
|
|
if ( $?WM_THIRD_PARTY_DIR ) then
|
|
set foamOldDirs="$foamOldDirs $WM_THIRD_PARTY_DIR"
|
|
endif
|
|
if ( $?WM_PROJECT ) then
|
|
set foamOldDirs="$foamOldDirs $HOME/$WM_PROJECT/$LOGNAME"
|
|
endif
|
|
if ( $?FOAM_SITE_APPBIN ) then
|
|
set foamOldDirs="$foamOldDirs $FOAM_SITE_APPBIN"
|
|
endif
|
|
if ( $?FOAM_SITE_LIBBIN ) then
|
|
set foamOldDirs="$foamOldDirs $FOAM_SITE_LIBBIN"
|
|
endif
|
|
|
|
# [WM_PROJECT_DIR] - Location of this OpenFOAM version
|
|
setenv WM_PROJECT_DIR "$projectDir"
|
|
|
|
# [WM_PROJECT_USER_DIR] - Location of user files
|
|
setenv WM_PROJECT_USER_DIR "$HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION"
|
|
|
|
# [WM_PROJECT_SITE] - Location of site-specific (group) files
|
|
# Default (unset) implies WM_PROJECT_DIR/site
|
|
# Normally defined in calling environment
|
|
|
|
if ( $?WM_PROJECT_SITE ) then
|
|
set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs"
|
|
if ( ! -d "$WM_PROJECT_SITE" ) unsetenv WM_PROJECT_SITE
|
|
else
|
|
unsetenv WM_PROJECT_SITE
|
|
endif
|
|
|
|
|
|
# Finalize setup of OpenFOAM environment
|
|
if ( -d "$WM_PROJECT_DIR" ) then
|
|
if ($?FOAM_VERBOSE && $?prompt) echo "source $WM_PROJECT_DIR/etc/config.csh/setup"
|
|
source "$WM_PROJECT_DIR/etc/config.csh/setup" "${*}"
|
|
else
|
|
echo "Error: did not locate installation path for $WM_PROJECT-$WM_PROJECT_VERSION"
|
|
echo "No directory: $WM_PROJECT_DIR"
|
|
endif
|
|
|
|
# Cleanup variables (done as final statement for a clean exit code)
|
|
unset foamOldDirs projectDir projectName
|
|
|
|
#------------------------------------------------------------------------------
|