Compare commits

...

28 Commits

Author SHA1 Message Date
55b49ac0d0 CONFIG: bump patch level 2020-04-06 08:34:58 +02:00
a8b6d01b87 CONFIG: relocate wmake binaries into project platforms/tools (#1647)
- can aid when creating source-only or binary-only packages
2020-04-06 08:32:42 +02:00
8075804b18 COMP: add -pthread compile/link dependency for std::thread (#614) 2020-04-06 08:30:11 +02:00
a88e67f2e1 BUG: potential divide-by-zero in x3d surface output (#1212)
- eg, for a uniform field and auto range.
2020-04-03 15:38:58 +02:00
b4229841c0 BUG: Extension of commit d16f1312cb 2020-04-03 09:30:43 +01:00
d16f1312cb BUG: P1 model - read qr field if present - see #1659 2020-04-01 10:29:28 +01:00
ba8d45c82d CONFIG: forces.cfg - updated output controls. See #1642 2020-03-18 18:21:32 +00:00
80e4033810 CONFIG: bump patch level 2020-03-16 14:56:50 +01:00
794ab39742 BUG: missing output for foamDictionary -includes (closes #1635)
- log to stdout when explicitly enabled
2020-03-16 14:54:25 +01:00
fe17c8ad5f CONFIG: improve prefix matching for system libraries (#1607)
- missed detection of system libraries when installed with multiarch
  paths like /usr/lib/x86_64-linux-gnu

CONFIG: improve handling of group/user config files (#928)

- changed bashrc handling of FOAM_CONFIG_NOUSER to use
  FOAM_CONFIG_MODE instead. Propagate into foamEtcFile to make this
  a stickier control.

  This change allows better control, but also enables cluster
  installations to define their own value within the OpenFOAM prefs.sh
  file to prevent users accidentally mis-configuring things if
  necessary.

- remove undocumented handling of an (a)ll mode in foamEtcFile to
  avoid potential pitfalls.

- add support for FOAM_CONFIG_ETC handling.
  This allows injection of an extra search layer when finding
  project etc files

ENH: improvements to foamConfigurePaths (#928)

- handle FOAM_CONFIG_ETC implicitly, or explicitly with the new
  -etc option.

STYLE: more explicit wording in foamConfigurePaths usage (#1602)

- document that an absolute path (eg, -scotch-path) overrides/ignores
  the equivalent ThirdParty setting (eg, -scotch)

- longer options -system-compiler and -third-compiler for -system
  and -third, respectively. Clearer as to their purpose.

- adjust the location sanity check to look for META-INFO directory.
2020-03-16 12:03:58 +01:00
ac8b64df46 CONFIG: support FOAM_EXTRA_CXXFLAGS (#1256)
- allows custom tuning of compilation parameters
2020-03-16 12:03:58 +01:00
ba3a31af95 ENH: openfoam shell session - improved and relocated
- '-c' option (as per shell), '-Dkey[=value]' option to provide
  preferences via the command-line. For example,

      etc/openfoam -DWM_COMPILER=Clang -int64  ./Allwmake -j -s -l

  These can also be combined with other options. Eg,

      etc/openfoam -DWM_COMPILER=Clang \
          -c 'wmake -show-path-cxx -show-cxxflags'

- relocated from bin/tools/ => etc/ for easier access

- bin/tools/openfoam.in : for autoconfig-style installation

- Auto-detect if the shell script was executed with openfoam and
  interpret accordingly.

  Simple example,

      --------------
      #!/usr/bin/openfoam
      cd "${0%/*}" || exit   # Run -*-sh-*- from this dir

      blockMesh
      simpleFoam
      --------------

   Note it is NOT currently possible to provide any other parameters
   this way. Eg,

      `#!/usr/bin/openfoam -sp` (NOT)

   This will either fail to run, or result in infinite recursion.
2020-03-16 12:03:57 +01:00
69a61bf835 BUG: objToVTK - corrected for empty lines in obj file. See #1632 2020-03-16 10:21:34 +00:00
989fda3b18 BUG: BSpline - only snap to points at ends and not intermediate knots. See #1628 2020-03-13 10:43:10 +00:00
28d24fefbc CONFIG: bump patch level 2020-03-12 11:34:14 +01:00
161c66df17 BUG: incorrect EnSight lagrangian fields in parallel (fixes #1629) 2020-03-12 11:13:23 +01:00
418248709f BUG: Corrected update of T field for energyJump[AMI]FvPatchScalarField. See #1624 2020-03-11 17:47:19 +00:00
6f230a8b67 COMP: Corrections for icc compiler. Fixes #1608 2020-03-03 17:00:35 +00:00
ca28377642 BUG: Resolve circular call to ::write(Ostream&). See #1617 2020-03-03 11:17:11 +00:00
79cf72d573 BUG: foamListTimes does not remove collated directories (fixes #1588)
- also now report any verbosity on stderr

- fix similar collated directories issue for foamRestoreFields
2020-02-14 17:44:49 +01:00
a65b9fdd7c BUG: file format mangled by collated format (fixes #1587)
- incorrectly set BINARY format in the construction of the received
  data (a side-effect of the parameter ordering).

  Now use the same default parameters as IFstream and set the correct
  filename subsequent to construction.
2020-02-13 09:04:13 +01:00
92214eb4af CONFIG: misedit of csh mpi settings with foamConfigurePaths 2020-02-12 21:28:30 +01:00
ff19bedbc3 BUG: SPDP mode: guaranteeing initial value. Fixes #1590.
In differing precisions the PrecisionAdaptor will copy
the input array element by element and this can trigger
NaN detection.
2020-02-12 16:54:05 +00:00
49e63378f8 TUT: corrected link to online case. Fixes #1584 2020-02-10 11:44:20 +00:00
a100b49606 BUG: csh ignores additional parameters (fixes #1582) 2020-02-05 10:27:38 +01:00
e53419c025 ENH: Pstream: use native reduce in SPDP mode. Fixes #1574. 2020-02-03 11:29:06 +00:00
81015889f2 CONFIG: provide separate default settings for clang/gcc (fixes #1566)
- the foamConfigurePaths script is quite simplistic and aggressive in
  what it changes. This was particularly evident when using it to
  change gcc/clang versions.

  Restructured the corresponding compiler settings to define default
  versions (eg, "default_gcc_version") that limits the scope of
  changes performed by foamConfigurePaths and makes it easier to
  understand if changing manually.
2020-02-03 11:05:04 +01:00
d3bcc71b64 COMP: avoid -Wstringop-truncation warning
- the gcc c++/9 includes now inline strncpy, which obliterates
  the previous method of suppressing the warning.
  Now simply allocate additional space for the nul character.

COMP: silence some icc warnings
2020-01-31 13:32:24 +01:00
95 changed files with 1742 additions and 823 deletions

View File

@ -1,2 +1,2 @@
api=1912
patch=200129
patch=200403

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -128,6 +128,8 @@ int main(int argc, char *argv[])
std::ifstream OBJfile(objName);
Info<< "Processing file " << objName << endl;
if (!OBJfile.good())
{
FatalErrorInFunction
@ -145,13 +147,14 @@ int main(int argc, char *argv[])
label lineNo = 0;
while (OBJfile.good())
{
string line = getLine(OBJfile);
const string line = getLine(OBJfile);
lineNo++;
if (line.empty()) continue;
// Read first word
IStringStream lineStream(line);
word cmd;
lineStream >> cmd;
word cmd(lineStream);
if (cmd == "v")
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,7 +39,7 @@ Usage
Options:
- \par -processor
List times from processor0/ directory
Times from processor0/ directory
- \par -rm
Remove selected time directories
@ -58,9 +58,30 @@ Note
#include "profiling.H"
#include "timeSelector.H"
#include "TimePaths.H"
#include "ListOps.H"
#include "stringOps.H"
using namespace Foam;
// Many ways to name processor directories
//
// Uncollated | "processor0", "processor1" ...
// Collated (old) | "processors"
// Collated (new) | "processors<N>"
// Host collated | "processors<N>_<low>-<high>"
const regExp matcher("processors?[0-9]+(_[0-9]+-[0-9]+)?");
bool isProcessorDir(const string& dir)
{
return
(
dir.starts_with("processor")
&& (dir == "processors" || matcher.match(dir))
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
@ -95,7 +116,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const bool removeFiles(args.found("rm"));
const bool verbose(args.found("verbose"));
bool verbose(args.found("verbose"));
// Get times list from the master processor and subset based on
@ -116,6 +137,7 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
// Obtain time directory names from "processor0/" only
timePaths = autoPtr<TimePaths>::New
(
args.rootPath(),
@ -140,10 +162,34 @@ int main(int argc, char *argv[])
{
if (nProcs)
{
fileNameList procDirs
(
Foam::readDir
(
args.path(),
fileName::DIRECTORY,
false, // No gzip anyhow
false // Do not follow linkts
)
);
inplaceSubsetList(procDirs, isProcessorDir);
// Perhaps not needed
/// Foam::sort(procDirs, stringOps::natural_sort());
if (verbose)
{
Info<< "Removing " << nTimes
<< " processor time directories" << endl;
InfoErr
<< "Removing " << nTimes
<< " times in " << procDirs.size()
<< " processor directories" << endl;
}
// No processor directories? - silence verbosity
if (procDirs.empty())
{
verbose = false;
}
forAllReverse(timeDirs, timei)
@ -152,25 +198,15 @@ int main(int argc, char *argv[])
if (verbose)
{
Info<< " rm " << timeName
InfoErr
<< " rm " << timeName
<< " [" << (nTimes - timei) << '/' << nTimes << ']'
<< endl;
}
fileName path(args.path()/"processors"/timeName);
rmDir(path, true);
for (label proci=0; proci<nProcs; ++proci)
for (const fileName& procDir : procDirs)
{
path =
(
args.path()
/ ("processor" + Foam::name(proci))
/ timeName
);
rmDir(path, true);
rmDir(args.path()/procDir/timeName, true);
}
}
}
@ -178,7 +214,8 @@ int main(int argc, char *argv[])
{
if (verbose)
{
Info<< "Removing " << nTimes
InfoErr
<< "Removing " << nTimes
<< " time directories" << endl;
}
@ -188,7 +225,8 @@ int main(int argc, char *argv[])
if (verbose)
{
Info<< " rm " << timeName
InfoErr
<< " rm " << timeName
<< " [" << (nTimes - timei) << '/' << nTimes << ']'
<< endl;
}
@ -199,6 +237,7 @@ int main(int argc, char *argv[])
}
else
{
// List times: one per line
for (const instant& t : timeDirs)
{
Info<< t.name() << nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,7 +30,7 @@ Group
grpMiscUtilities
Description
Restore field names by removing the ending.
Adjust (restore) field names by removing the ending.
The fields are selected automatically or can be specified as optional
command arguments.
@ -63,9 +63,30 @@ Usage
#include "timeSelector.H"
#include "Enum.H"
#include "TimePaths.H"
#include "ListOps.H"
#include "stringOps.H"
using namespace Foam;
// Many ways to name processor directories
//
// Uncollated | "processor0", "processor1" ...
// Collated (old) | "processors"
// Collated (new) | "processors<N>"
// Host collated | "processors<N>_<low>-<high>"
const regExp matcher("processors?[0-9]+(_[0-9]+-[0-9]+)?");
bool isProcessorDir(const string& dir)
{
return
(
dir.starts_with("processor")
&& (dir == "processors" || matcher.match(dir))
);
}
//- The known and support types of operations
enum restoreMethod
{
@ -311,7 +332,6 @@ int main(int argc, char *argv[])
}
// Obtain time directory names from "processor0/" only
timePaths = autoPtr<TimePaths>::New
(
args.rootPath(),
@ -329,10 +349,77 @@ int main(int argc, char *argv[])
const instantList timeDirs(timeSelector::select(timePaths->times(), args));
fileNameList procDirs;
label leadProcIdx = -1;
if (timeDirs.empty())
{
Info<< "no times selected" << nl;
Info<< "No times selected" << nl;
}
else if (nProcs)
{
procDirs =
Foam::readDir
(
args.path(),
fileName::DIRECTORY,
false, // No gzip anyhow
false // Do not follow linkts
);
inplaceSubsetList(procDirs, isProcessorDir);
// Perhaps not needed
Foam::sort(procDirs, stringOps::natural_sort());
// Decide who will be the "leading" processor for obtaining names
// - processor0
// - processors<N>
// - processors<N>_0-<high>
// Uncollated
leadProcIdx = procDirs.find("processor0");
if (!procDirs.empty())
{
if (leadProcIdx < 0)
{
// Collated (old)
leadProcIdx = procDirs.find("processors");
}
if (leadProcIdx < 0)
{
// Collated (new)
leadProcIdx = procDirs.find("processors" + Foam::name(nProcs));
}
if (leadProcIdx < 0)
{
// Host-collated
const std::string prefix
(
"processors" + Foam::name(nProcs) + "_0-"
);
forAll(procDirs, idx)
{
if (procDirs[idx].starts_with(prefix))
{
leadProcIdx = idx;
break;
}
}
}
// Just default to anything (safety)
if (leadProcIdx < 0)
{
leadProcIdx = 0;
}
}
}
for (const instant& t : timeDirs)
{
@ -341,28 +428,28 @@ int main(int argc, char *argv[])
Info<< "\nTime = " << timeName << nl;
label count = 0;
wordList files;
if (nProcs)
{
const wordHashSet files
(
getFiles(args.path()/"processor0", timeName)
);
if (leadProcIdx >= 0)
{
files = getFiles(args.path()/procDirs[leadProcIdx], timeName);
}
for (label proci=0; proci < nProcs; ++proci)
for (const fileName& procDir : procDirs)
{
count += restoreFields
(
method,
args.path()/("processor" + Foam::name(proci))/timeName,
files,
args.path()/procDir/timeName,
wordHashSet(files),
targetNames
);
}
}
else
{
wordList files;
if (Pstream::master())
{
files = getFiles(args.path(), timeName);

View File

@ -33,7 +33,13 @@
# \endcode
#
# Environment
# - WM_PROJECT_SITE (unset defaults to PROJECT/site)
# FOAM_CONFIG_ETC
# Alternative etc directory for shipped files
#
# FOAM_CONFIG_MODE
# Fallback search mode for etc files. Unset is the same as "ugo".
#
# WM_PROJECT_SITE (unset defaults to PROJECT/site)
#
# Note
# This script must exist in the project 'bin' directory
@ -46,8 +52,8 @@
printHelp() {
cat<<USAGE
Usage: foamEtcFile [OPTION] fileName [-- args]
foamEtcFile [OPTION] [-list|-list-test] [fileName]
Usage: ${0##*/} [OPTION] fileName [-- args]
${0##*/} [OPTION] [-list|-list-test] [fileName]
options:
-all (-a) Return all files (otherwise stop after the first match)
@ -106,6 +112,20 @@ projectDir="$(\cd $(dirname $binDir) && \pwd -L)" # Project dir
userDir="$HOME/.OpenFOAM" # As per foamVersion.H
groupDir="${WM_PROJECT_SITE:-$projectDir/site}" # As per foamVersion.H
optMode=ugo # Default search = 'ugo'
# Environment overrides
case "$FOAM_CONFIG_MODE" in ([ugo]*) optMode="$FOAM_CONFIG_MODE" ;; esac
# Verify validity of FOAM_CONFIG_ETC
if [ -n "$FOAM_CONFIG_ETC" ]
then
if [ ! -d "$FOAM_CONFIG_ETC" ] || [ "$FOAM_CONFIG_ETC" = "$projectDir/etc" ]
then
# Bad directory or redundant value
unset FOAM_CONFIG_ETC
fi
fi
#-------------------------------------------------------------------------------
@ -163,7 +183,6 @@ getPatchLevel()
#-------------------------------------------------------------------------------
optMode=ugo # Default mode is always 'ugo'
unset shellOutput verboseOutput
unset optAll optConfig optList projectApi
@ -208,7 +227,7 @@ do
-config)
optConfig=true
;;
-mode=[ugoa]*)
-mode=[ugo]*)
optMode="${1#*=}"
;;
-m | -mode)
@ -216,7 +235,7 @@ do
shift
# Sanity check. Handles missing argument too.
case "$optMode" in
([ugoa]*)
([ugo]*)
;;
(*)
die "invalid mode '$optMode'"
@ -259,7 +278,6 @@ done
# Establish the API value
[ -n "$projectApi" ] || projectApi=$(getApi)
# Split arguments into filename (for searching) and trailing bits for shell eval
# Silently remove leading ~OpenFOAM/ (as per Foam::findEtcFile)
nArgs=$#
@ -293,23 +311,23 @@ fi
# Define the various places to be searched:
unset dirList
case "$optMode" in (*[au]*) # (A)ll or (U)ser
case "$optMode" in (*[u]*) # (U)ser
dirList="$dirList $userDir/$projectApi $userDir"
;;
esac
case "$optMode" in (*[ag]*) # (A)ll or (G)roup == site
case "$optMode" in (*[g]*) # (G)roup == site
dirList="$dirList $groupDir/$projectApi/etc $groupDir/etc"
;;
esac
case "$optMode" in (*[ao]*) # (A)ll or (O)ther == shipped
dirList="$dirList $projectDir/etc"
case "$optMode" in (*[o]*) # (O)ther == shipped
dirList="$dirList $FOAM_CONFIG_ETC $projectDir/etc"
;;
esac
set -- $dirList
[ "$#" -ge 1 ] || die "No directories to scan. Programming error?"
[ "$#" -ge 1 ] || die "No directories to scan. Programming or user error?"
exitCode=2 # Fallback is a FileNotFound error
@ -318,7 +336,7 @@ exitCode=2 # Fallback is a FileNotFound error
#
# Special handling of config.sh/ , config.csh/ directories
if [ -n "$optConfig" -a -n "$shellOutput" -a -n "$fileName" ]
if [ -n "$optConfig" ] && [ -n "$shellOutput" ] && [ -n "$fileName" ]
then
case "$shellOutput" in
csh*)

View File

@ -33,7 +33,7 @@
# or {user,site} locations and copy it into the case directory.
#
# Environment
# FOAM_API
# FOAM_CONFIG_ETC
# WM_PROJECT_DIR
# WM_PROJECT_SITE
#
@ -81,9 +81,7 @@ die()
#-------------------------------------------------------------------------------
projectDir="$WM_PROJECT_DIR" # Project dir
userDir="$HOME/.OpenFOAM" # As per foamVersion.H
groupDir="${WM_PROJECT_SITE:-$projectDir/site}" # As per foamVersion.H
projectApi="$FOAM_API"
unset projectApi
#-------------------------------------------------------------------------------
@ -163,20 +161,12 @@ then
fi
# No api specified -with-api= or from environment (FOAM_API)
if [ -z "$projectApi" ]
then
projectApi="$(foamEtcFile -show-api 2>/dev/null)"
fi
# The places to be searched.
# Like foamEtcFile, but "etc/caseDicts/" for the projectDir
# Define the various places to be searched.
# Similar to foamEtcFile, but with etc/caseDicts/ for the projectDir
# Filter out nonexistent directories later
searchDirs="${projectApi:+$userDir/$projectApi} $userDir \
${projectApi:+$groupDir/$projectApi/etc} $groupDir/etc \
$projectDir/etc/caseDicts";
searchDirs="\
$("$projectDir"/bin/foamEtcFile -list-test -mode=ug ${projectApi:+-with-api=$projectApi} 2>/dev/null) \
$("$projectDir"/bin/foamEtcFile -list -mode=o caseDicts 2>/dev/null)";
## echo "Using <$searchDirs>" 1>&2

View File

@ -7,6 +7,7 @@
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -38,8 +39,6 @@
#------------------------------------------------------------------------------
Script="${0##*/}"
toolsDir="${0%/*}/tools"
groupDir="${WM_PROJECT_SITE:-${WM_PROJECT_DIR:-<unknown>}/site}"
userDir="$HOME/.OpenFOAM"
usage() {
exec 1>&2
@ -91,13 +90,9 @@ cat <<HELP
The value taken will be the first (non-space)word after this column.
The database ($Script.db) will taken from these locations:
.
$userDir/$FOAM_API/
$userDir/
$groupDir/$FOAM_API/etc/
$groupDir/etc/
$WM_PROJECT_DIR/etc/
$toolsDir
./
$(foamEtcFile -list | sed -e 's#^# #')
$toolsDir
option -quiet : suppresses the default information and only prints the
extracted variables.

View File

@ -7,6 +7,7 @@
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# Copyright (C) 2015-2017 OpenFOAM Foundation
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -32,7 +33,7 @@
#
#------------------------------------------------------------------------------
Script=${0##*/}
DIR="$FOAM_ETC/codeTemplates/app"
DIR="$WM_PROJECT_DIR/etc/codeTemplates/app"
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done

View File

@ -7,6 +7,7 @@
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# Copyright (C) 2015-2017 OpenFOAM Foundation
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -32,7 +33,7 @@
#
#------------------------------------------------------------------------------
Script=${0##*/}
DIR="$FOAM_ETC/codeTemplates/BC"
DIR="$WM_PROJECT_DIR/etc/codeTemplates/BC"
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done

View File

@ -7,6 +7,7 @@
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# Copyright (C) 2016-2017 OpenFOAM Foundation
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -33,7 +34,7 @@
#
#------------------------------------------------------------------------------
Script=${0##*/}
DIR="$FOAM_ETC/codeTemplates/functionObject"
DIR="$WM_PROJECT_DIR/etc/codeTemplates/functionObject"
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done

View File

@ -7,11 +7,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# foamConfigurePaths
@ -20,15 +19,22 @@
# Adjust hardcoded installation versions and paths
# in etc/{bashrc,cshrc} and etc/config.{sh,csh}/
#
# Requires
# - sed
# - bin/foamEtcFile
#
# Environment
# FOAM_CONFIG_ETC
# Alternative etc directory for shipped files
#
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
printHelp() {
cat<<USAGE
usage: ${0##*/} options
usage: $0 options
Basic
-etc=DIR set FOAM_CONFIG_ETC for alternative project files
-project-path DIR specify 'WM_PROJECT_DIR' (eg, /opt/openfoam1806-patch1)
-version VER specify project version (eg, v1806)
-sp | -SP | -float32 single precision (WM_PRECISION_OPTION)
@ -37,13 +43,13 @@ Basic
-int32 | -int64 the 'WM_LABEL_SIZE'
Compiler
-system NAME specify 'system' compiler to use (eg, Gcc, Icc,...)
-third NAME specify 'ThirdParty' compiler to use (eg, Clang40,...)
-gcc VER specify 'gcc_version' for ThirdParty Gcc
-clang VER specify 'clang_version' for ThirdParty Clang
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
-system-compiler NAME The 'system' compiler to use (eg, Gcc, Clang, Icc,...)
-third-compiler NAME The 'ThirdParty' compiler to use (eg, Clang40,...)
-gcc VER The 'default_gcc_version' for ThirdParty Gcc
-clang VER The 'default_clang_version' for ThirdParty Clang
gmp-VERSION For ThirdParty gcc (gmp-system for system library)
mpfr-VERSION For ThirdParty gcc (mpfr-system for system library)
mpc-VERSION For ThirdParty gcc (mpc-system for system library)
MPI
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc)
@ -51,22 +57,24 @@ MPI
-openmpi-system use system openmpi
-openmpi-third use ThirdParty openmpi (using default version)
Components
ThirdParty versions
-adios VER specify 'adios2_version'
-adios-path DIR specify 'ADIOS2_ARCH_PATH'
-boost VER specify 'boost_version'
-boost-path DIR specify 'BOOST_ARCH_PATH'
-cgal ver specify 'cgal_version'
-cgal-path DIR specify 'CGAL_ARCH_PATH'
-cmake VER specify 'cmake_version'
-fftw VER specify 'fffw_version'
-fftw-path DIR specify 'FFTW_ARCH_PATH'
-kahip VER specify 'KAHIP_VERSION'
-kahip-path DIR specify 'KAHIP_ARCH_PATH'
-metis ver specify 'METIS_VERSION'
-metis-path DIR specify 'METIS_ARCH_PATH'
-scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4)
-scotch-path DIR specify 'SCOTCH_ARCH_PATH' (eg, /opt/scotch_6.0.4)
Components specified by absolute path
-adios-path DIR Path for 'ADIOS2_ARCH_PATH' (overrides -adios)
-boost-path DIR Path for 'BOOST_ARCH_PATH' (overrides -boost)
-cgal-path DIR Path for 'CGAL_ARCH_PATH' (overrides -cgal)
-fftw-path DIR Path for 'FFTW_ARCH_PATH' (overrides -fftw)
-kahip-path DIR Path for 'KAHIP_ARCH_PATH' (overrides -kahip)
-metis-path DIR Path for 'METIS_ARCH_PATH' (overrides -metis)
-scotch-path DIR Path for 'SCOTCH_ARCH_PATH' (overrides -scotch)
Graphics
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system)
@ -93,11 +101,14 @@ Equivalent options:
-paraview-path --paraviewInstall | -paraviewInstall
-scotch --scotchVersion | -scotchVersion
-scotch-path --scotchArchPath | -scotchArchPath
-system-compiler -system
-third-compiler -third
USAGE
exit 1
exit 0 # clean exit
}
# Report error and exit
die()
{
@ -106,7 +117,7 @@ die()
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo "See '$0 -help' for usage"
echo
exit 1
}
@ -114,8 +125,23 @@ die()
# -----------------------------------------------------------------------------
# Check that it appears to be an OpenFOAM installation
[ -f etc/bashrc -a -d etc/config.sh ] || \
usage "Please run from top-level directory of installation"
if [ -f etc/bashrc ] && [ -d "META-INFO" ]
then
echo "Configuring OpenFOAM" 1>&2
else
die "Please run from the OpenFOAM top-level installation directory" \
"No etc/bashrc or META-INFO/ found"
fi
# Use foamEtcFile to locate files, but only edit shipped files
if [ -x bin/foamEtcFile ]
then
_foamEtc() {
./bin/foamEtcFile -mode=o "$@"
}
else
die "No bin/foamEtcFile found in installation"
fi
# Check if argument matches the expected input. Respects case.
@ -212,6 +238,28 @@ replaceCsh()
done
}
# Locate file with foamEtcFile -mode=o and forward to replace()
replaceEtc()
{
local file="$1"
shift
file=$(_foamEtc "$file")
replace $file "$@"
}
# Locate file with foamEtcFile -mode=o and forward to replaceCsh()
replaceEtcCsh()
{
local file="$1"
shift
file=$(_foamEtc "$file")
replaceCsh $file "$@"
}
# Get the option's value (argument), or die on missing or empty argument
# $1 option
# $2 value
@ -276,22 +324,55 @@ while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help* | --help*)
usage
printHelp
;;
'')
# Discard empty arguments
;;
-debug-list)
# Undocumented (experimental)
# TDB: List files that can be edited by this script
cat << CONFIG_SH
etc/bashrc
etc/config.sh/adios2
etc/config.sh/compiler
etc/config.sh/paraview
etc/config.sh/vtk
etc/config.sh/CGAL
etc/config.sh/FFTW
etc/config.sh/metis
etc/config.sh/kahip
etc/config.sh/scotch
CONFIG_SH
cat << CONFIG_CSH
etc/cshrc
etc/config.csh/adios2
etc/config.csh/compiler
etc/config.csh/paraview
etc/config.csh/vtk
etc/config.csh/CGAL
etc/config.csh/FFTW
CONFIG_CSH
exit 0
;;
## Basic ##
-etc=*)
# Define FOAM_CONFIG_ETC for finding files
export FOAM_CONFIG_ETC="${1#*=}"
;;
-project-path)
# Replace WM_PROJECT_DIR=...
optionValue=$(getOptionValue "$@")
replace etc/bashrc WM_PROJECT_DIR "\"$optionValue\""
replaceCsh etc/cshrc WM_PROJECT_DIR "\"$optionValue\""
replaceEtc bashrc WM_PROJECT_DIR "\"$optionValue\""
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optionValue\""
removeBashMagic etc/bashrc
removeCshMagic etc/cshrc
removeBashMagic $(_foamEtc bashrc)
removeCshMagic $(_foamEtc cshrc)
adjusted=true
shift
@ -300,8 +381,8 @@ do
-version | -foamVersion | --projectVersion)
# Replace WM_PROJECT_VERSION=...
optionValue=$(getOptionValue "$@")
replace etc/bashrc WM_PROJECT_VERSION "$optionValue"
replaceCsh etc/cshrc WM_PROJECT_VERSION "$optionValue"
replaceEtc bashrc WM_PROJECT_VERSION "$optionValue"
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optionValue"
adjusted=true
shift
;;
@ -315,30 +396,30 @@ do
-sp | -SP | -float32)
# Replace WM_PRECISION_OPTION=...
replace etc/bashrc WM_PRECISION_OPTION "SP"
replaceCsh etc/cshrc WM_PRECISION_OPTION "SP"
replaceEtc bashrc WM_PRECISION_OPTION "SP"
replaceEtcCsh cshrc WM_PRECISION_OPTION "SP"
adjusted=true
;;
-dp | -DP | -float64)
# Replace WM_PRECISION_OPTION=...
replace etc/bashrc WM_PRECISION_OPTION "DP"
replaceCsh etc/cshrc WM_PRECISION_OPTION "DP"
replaceEtc bashrc WM_PRECISION_OPTION "DP"
replaceEtcCsh cshrc WM_PRECISION_OPTION "DP"
adjusted=true
;;
-spdp | -SPDP)
# Replace WM_PRECISION_OPTION=...
replace etc/bashrc WM_PRECISION_OPTION "SPDP"
replaceCsh etc/cshrc WM_PRECISION_OPTION "SPDP"
replaceEtc bashrc WM_PRECISION_OPTION "SPDP"
replaceEtcCsh cshrc WM_PRECISION_OPTION "SPDP"
adjusted=true
;;
-int32 | -int64)
# Replace WM_LABEL_SIZE=...
optionValue="${1#-int}"
replace etc/bashrc WM_LABEL_SIZE "$optionValue"
replaceCsh etc/cshrc WM_LABEL_SIZE "$optionValue"
replaceEtc bashrc WM_LABEL_SIZE "$optionValue"
replaceEtcCsh cshrc WM_LABEL_SIZE "$optionValue"
adjusted=true
;;
@ -346,43 +427,43 @@ do
## Compiler ##
-clang)
# Replace clang_version=...
# Replace default_clang_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/compiler clang_version "$optionValue"
replace etc/config.csh/compiler clang_version "$optionValue"
replaceEtc config.sh/compiler default_clang_version "$optionValue"
replaceEtc config.csh/compiler default_clang_version "$optionValue"
adjusted=true
shift
;;
-gcc)
# Replace gcc_version=...
# Replace default_gcc_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/compiler gcc_version "$optionValue"
replace etc/config.csh/compiler gcc_version "$optionValue"
replaceEtc config.sh/compiler default_gcc_version "$optionValue"
replaceEtc config.csh/compiler default_gcc_version "$optionValue"
adjusted=true
shift
;;
-system)
-system-compiler | -system)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@")
replace etc/bashrc \
replaceEtc bashrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optionValue"
replaceCsh etc/cshrc \
replaceEtcCsh cshrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optionValue"
adjusted=true
shift
;;
-third | -ThirdParty)
-third-compiler | -third | -ThirdParty)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@")
replace etc/bashrc \
replaceEtc bashrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optionValue"
replaceCsh etc/cshrc \
replaceEtcCsh cshrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optionValue"
adjusted=true
@ -391,22 +472,22 @@ do
gmp-[4-9]* | gmp-system)
# gcc-related package
replace etc/config.sh/compiler gmp_version "$1"
replace etc/config.csh/compiler gmp_version "$1"
replaceEtc config.sh/compiler default_gmp_version "$1"
replaceEtc config.csh/compiler default_gmp_version "$1"
adjusted=true
;;
mpfr-[2-9]* | mpfr-system)
# gcc-related package
replace etc/config.sh/compiler mpfr_version "$1"
replace etc/config.csh/compiler mpfr_version "$1"
replaceEtc config.sh/compiler default_mpfr_version "$1"
replaceEtc config.csh/compiler default_mpfr_version "$1"
adjusted=true
;;
mpc-[0-9]* | mpc-system)
# gcc-related package
replace etc/config.sh/compiler mpc_version "$1"
replace etc/config.csh/compiler mpc_version "$1"
replaceEtc config.sh/compiler default_mpc_version "$1"
replaceEtc config.csh/compiler default_mpc_version "$1"
adjusted=true
;;
@ -416,8 +497,8 @@ do
-mpi)
# Explicitly set WM_MPLIB=...
optionValue=$(getOptionValue "$@")
replace etc/bashrc WM_MPLIB "$optionValue"
replaceCsh etc/bashrc WM_MPLIB "$optionValue"
replaceEtc bashrc WM_MPLIB "$optionValue"
replaceEtcCsh cshrc WM_MPLIB "$optionValue"
optMpi=system
adjusted=true
shift
@ -432,34 +513,34 @@ do
_matches "$optMpi" "$expected" || \
die "'$1' has bad value: '$optMpi'"
_inlineSed etc/config.sh/mpi \
_inlineSed $(_foamEtc config.sh/mpi) \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optMpi" \
"Replaced 'FOAM_MPI=$expected' setting by 'FOAM_MPI=$optMpi'"
_inlineSed etc/config.csh/mpi \
_inlineSed $(_foamEtc config.csh/mpi) \
"FOAM_MPI $expected" \
"FOAM_MPI $optMpi" \
"Replaced 'FOAM_MPI $expected' setting by 'FOAM_MPI $optMpi'"
replace etc/bashrc WM_MPLIB OPENMPI
replaceCsh etc/cshrc WM_MPLIB OPENMPI
replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI
adjusted=true
shift
;;
-openmpi-system)
# Explicitly set WM_MPLIB=SYSTEMOPENMPI
replace etc/bashrc WM_MPLIB SYSTEMOPENMPI
replaceCsh etc/cshrc WM_MPLIB SYSTEMOPENMPI
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI
optMpi=system
adjusted=true
;;
-openmpi-third)
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi
replace etc/bashrc WM_MPLIB OPENMPI
replaceCsh etc/cshrc WM_MPLIB OPENMPI
replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI
optMpi=third
adjusted=true
;;
@ -470,8 +551,8 @@ do
-adios | -adios2)
# Replace adios2_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/adios2 adios2_version "$optionValue"
replace etc/config.csh/adios2 adios2_version "$optionValue"
replaceEtc config.sh/adios2 adios2_version "$optionValue"
replaceEtc config.csh/adios2 adios2_version "$optionValue"
adjusted=true
shift
;;
@ -479,8 +560,8 @@ do
-adios-path | -adios2-path)
# Replace ADIOS2_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
replaceCsh etc/config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
;;
@ -488,8 +569,8 @@ do
-boost)
# Replace boost_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/CGAL boost_version "$optionValue"
replace etc/config.csh/CGAL boost_version "$optionValue"
replaceEtc config.sh/CGAL boost_version "$optionValue"
replaceEtc config.csh/CGAL boost_version "$optionValue"
adjusted=true
shift
;;
@ -497,8 +578,8 @@ do
-boost-path)
# Replace BOOST_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
replaceCsh etc/config.csh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
replaceEtc config.sh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
replaceEtcCsh config.csh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
;;
@ -506,8 +587,8 @@ do
-cgal)
# Replace cgal_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/CGAL cgal_version "$optionValue"
replace etc/config.csh/CGAL cgal_version "$optionValue"
replaceEtc config.sh/CGAL cgal_version "$optionValue"
replaceEtc config.csh/CGAL cgal_version "$optionValue"
adjusted=true
shift
;;
@ -515,8 +596,8 @@ do
-cgal-path)
# Replace CGAL_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/CGAL CGAL_ARCH_PATH "$optionValue"
replaceCsh etc/config.csh/CGAL CGAL_ARCH_PATH "$optionValue"
replaceEtc config.sh/CGAL CGAL_ARCH_PATH "$optionValue"
replaceEtcCsh config.csh/CGAL CGAL_ARCH_PATH "$optionValue"
adjusted=true
shift
;;
@ -524,8 +605,8 @@ do
-fftw)
# Replace fftw_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/FFTW fftw_version "$optionValue"
replace etc/config.csh/FFTW fftw_version "$optionValue"
replaceEtc config.sh/FFTW fftw_version "$optionValue"
replaceEtc config.csh/FFTW fftw_version "$optionValue"
adjusted=true
shift
;;
@ -533,8 +614,8 @@ do
-fftw-path)
# Replace FFTW_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
replaceCsh etc/config.csh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
replaceEtc config.sh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
replaceEtcCsh config.csh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
;;
@ -542,8 +623,8 @@ do
-cmake)
# Replace cmake_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/paraview cmake_version "$optionValue"
replace etc/config.csh/paraview cmake_version "$optionValue"
replaceEtc config.sh/paraview cmake_version "$optionValue"
replaceEtc config.csh/paraview cmake_version "$optionValue"
adjusted=true
shift
;;
@ -551,7 +632,7 @@ do
-kahip)
# Replace KAHIP_VERSION=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/kahip KAHIP_VERSION "$optionValue"
replaceEtc config.sh/kahip KAHIP_VERSION "$optionValue"
adjusted=true
shift
;;
@ -559,7 +640,7 @@ do
-kahip-path)
# Replace KAHIP_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
;;
@ -567,7 +648,7 @@ do
-metis)
# Replace METIS_VERSION=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/metis METIS_VERSION "$optionValue"
replaceEtc config.sh/metis METIS_VERSION "$optionValue"
adjusted=true
shift
;;
@ -575,7 +656,7 @@ do
-metis-path)
# Replace METIS_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
;;
@ -583,7 +664,7 @@ do
-scotch | -scotchVersion | --scotchVersion)
# Replace SCOTCH_VERSION=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/scotch SCOTCH_VERSION "$optionValue"
replaceEtc config.sh/scotch SCOTCH_VERSION "$optionValue"
adjusted=true
shift
;;
@ -591,7 +672,7 @@ do
-scotch-path | -scotchArchPath | --scotchArchPath)
# Replace SCOTCH_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
;;
@ -606,8 +687,8 @@ do
_matches "$optionValue" "$expected" || \
[ "$optionValue" != "${optionValue%system}" ] || \
die "'$1' has bad value: '$optionValue'"
replace etc/config.sh/paraview ParaView_VERSION "$optionValue"
replace etc/config.csh/paraview ParaView_VERSION "$optionValue"
replaceEtc config.sh/paraview ParaView_VERSION "$optionValue"
replaceEtc config.csh/paraview ParaView_VERSION "$optionValue"
adjusted=true
shift
;;
@ -615,8 +696,8 @@ do
-paraview-qt)
# Replace ParaView_QT=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/paraview ParaView_QT "$optionValue"
replace etc/config.csh/paraview ParaView_QT "$optionValue"
replaceEtc config.sh/paraview ParaView_QT "$optionValue"
replaceEtc config.csh/paraview ParaView_QT "$optionValue"
adjusted=true
shift
;;
@ -624,8 +705,8 @@ do
-paraview-path | -paraviewInstall | --paraviewInstall)
# Replace ParaView_DIR=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/paraview ParaView_DIR \""$optionValue\""
replaceCsh etc/config.csh/paraview ParaView_DIR \""$optionValue\""
replaceEtc config.sh/paraview ParaView_DIR \""$optionValue\""
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optionValue\""
adjusted=true
shift
;;
@ -633,8 +714,8 @@ do
-vtk)
# Replace vtk_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/vtk vtk_version "$optionValue"
replace etc/config.csh/vtk vtk_version "$optionValue"
replaceEtc config.sh/vtk vtk_version "$optionValue"
replaceEtc config.csh/vtk vtk_version "$optionValue"
adjusted=true
shift
;;
@ -642,8 +723,8 @@ do
-mesa)
# Replace mesa_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/vtk mesa_version "$optionValue"
replace etc/config.csh/vtk mesa_version "$optionValue"
replaceEtc config.sh/vtk mesa_version "$optionValue"
replaceEtc config.csh/vtk mesa_version "$optionValue"
adjusted=true
shift
;;

View File

@ -7,23 +7,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2016-2017 CINECA
# Copyright (C) 2017-2019 OpenCFD Ltd.
# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# foamCreateModuleInclude
@ -134,15 +121,24 @@ syspath() {
# Frontend: do all basic sanity checks in the front-end only
if [ -z "$optBackend" ]
then
# Check that it appears to be an OpenFOAM installation
[ -d "$projectDir" -a -f "$projectDir/etc/bashrc" ] || \
die "Incorrect projectDir? $projectDir"
# Check preloads
for file in "$preloads"
do
[ -f "$file" ] || echo "No such file to preload: $file" 1>&2
done
if [ -n "$preloads" ]
then
for file in $preloads
do
[ -f "$file" ] || echo "No such file to preload: $file" 1>&2
done
fi
# Check that it appears to be an OpenFOAM installation
# could also check [ -d "$projectDir/META-INFO" ]
if [ -d "$projectDir" ] && [ -f "etc/bashrc" ]
then
echo "Appears to be an OpenFOAM installation" 1>&2
else
die "Incorrect OpenFOAM projectDir?" \
" $projectDir"
fi
# Call itself with clean environment.
# Tag the start/end of the original PATH, MANPATH, LD_LIBRARY_PATH
@ -234,6 +230,9 @@ unset FOAM_INST_DIR WM_PROJECT_INST_DIR
unset WM_PROJECT_USER_DIR WM_THIRD_PARTY_DIR
unset SCOTCH_VERSION
# Probably don't want these either
unset FOAM_CONFIG_MODE
# Also remove user directories as being unreliable
@ -283,7 +282,7 @@ unalias util 2>/dev/null
#------------------------------------------------
# Generalize environment.
# This needs rethinking since it largely duplicates logic from the etc/config.sh/settings
# Needs rethinking, it largely duplicates logic from etc/config.sh/settings
rewriteEnv()
{
sed \

View File

@ -6,11 +6,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# tools/lib-dir [OPTION] DIR [LIBEXT]
@ -135,7 +134,7 @@ then
fi
# 2) Use fallback if the previous failed
if [ -z "$resolved" -a -n "$alt" ]
if [ -z "$resolved" ] && [ -n "$alt" ]
then
# Fallback
case "$alt" in

View File

@ -1,193 +0,0 @@
#!/bin/bash
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# openfoam [args]
#
# Description
# Open an interactive bash session with an OpenFOAM environment,
# or run an OpenFOAM application (with arguments) after first sourcing
# the OpenFOAM etc/bashrc file from the project directory.
#
# This script normally exists in $WM_PROJECT_DIR/bin/tools but can also
# be modified to use a hard-coded PROJECT_DIR entry and placed elsewhere
# in the filesystem (eg, /usr/bin).
#
#------------------------------------------------------------------------------
# Hard-coded value (eg, with autoconfig)
projectDir="@PROJECT_DIR@"
if [ -z "$projectDir" ] || [ "${projectDir#@}" != "$projectDir" ]
then
# Auto-detect from location
toolsDir="${0%/*}" # The bin/tools dir
projectDir="${toolsDir%/bin/tools}" # Project dir
case "$projectDir" in
(/bin | /usr/bin | /usr/local/bin)
# This shouldn't happen.
# If copied to a system dir, should also be using hard-coded values!
echo "Warning: suspicious looking project dir: $projectDir" 1>&2
;;
("$toolsDir")
# Eg, called as ./openfoam etc - need to try harder
projectDir="$(\cd $(dirname $0)/../.. && \pwd -L)" || unset projectDir
;;
esac
fi
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: ${0##*/} [OPTION] [application ...]
options:
-prefix=DIR Specify alternative OpenFOAM directory
-sp Single precision
-dp Double precision
-spdp Mixed single/double precision
-int32 | -int64 The label-size
-help Print the usage
Open an interactive bash session with an OpenFOAM environment,
or run an OpenFOAM application (with arguments) after first sourcing
the OpenFOAM etc/bashrc file from the project directory:
($projectDir)
For more information: www.OpenFOAM.com
USAGE
exit 1
}
#-------------------------------------------------------------------------------
# Only preserve settings for non-interactive?
if [ "$#" -eq 0 ]
then
unset _foamSettings FOAM_SETTINGS
else
_foamSettings="$FOAM_SETTINGS"
fi
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
usage
;;
-prefix=* | -foam=*)
projectDir="${1#*=}"
;;
-sp | -SP)
# WM_PRECISION_OPTION=...
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=SP"
;;
-dp | -DP)
# WM_PRECISION_OPTION=...
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=DP"
;;
-spdp | -SPDP)
# WM_PRECISION_OPTION=...
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=SPDP"
;;
-int32 | -int64)
# WM_LABEL_SIZE=...
_foamSettings="$_foamSettings${_foamSettings:+ }WM_LABEL_SIZE=${1#-int}"
;;
--)
shift
break
;;
-*)
echo "Error: unknown option: '$1'" 1>&2
exit 1
;;
*)
break
;;
esac
shift
done
#-------------------------------------------------------------------------------
# Remove current OpenFOAM environment
if [ -d "$WM_PROJECT_DIR" ] && [ -f "$WM_PROJECT_DIR/etc/config.sh/unset" ]
then
. "$WM_PROJECT_DIR/etc/config.sh/unset"
fi
[ -d "$projectDir" ] || {
echo "Error: no project dir: $projectDir" 1>&2
exit 2
}
_foamSourceBashEnv="$projectDir/etc/bashrc"
if [ "$#" -eq 0 ]
then
# Interactive shell
_foamSourceBashEnv="$projectDir/bin/tools/source-bashrc"
fi
[ -f "$_foamSourceBashEnv" ] || {
echo "Error: file not found: $_foamSourceBashEnv" 1>&2
exit 2
}
if [ "$#" -eq 0 ]
then
# Source user ~/.bashrc and OpenFOAM etc/bashrc.
# 1) Can either use a tmp file, or 2) chain off to a dedicated file
# We use a dedicated file.
if [ -n "$_foamSettings" ]
then
export FOAM_SETTINGS="$_foamSettings"
fi
## echo "Source with $_foamSourceBashEnv with '$FOAM_SETTINGS'" 1>&2
# Interactive shell (newer bash can use --init-file instead of --rcfile)
exec bash --rcfile "$_foamSourceBashEnv" -i
else
# Non-interactive
# Source bashrc within a function to preserve command-line arguments
# - this will not have aliases, but working non-interactively anyhow
sourceBashrc()
{
. "$_foamSourceBashEnv" $_foamSettings
}
sourceBashrc
exec "$@"
fi
#------------------------------------------------------------------------------

26
bin/tools/openfoam.in Normal file
View File

@ -0,0 +1,26 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# openfoam [options] [args]
#
# Description
# Forwarding to the OpenFOAM etc/openfoam bash session script.
#
#------------------------------------------------------------------------------
# Hard-coded directory path (eg, autoconfig)
projectDir="@PROJECT_DIR@"
exec "$projectDir"/etc/openfoam "$@"
#------------------------------------------------------------------------------

View File

@ -5,34 +5,36 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019 OpenCFD Ltd.
# Copyright (C) 2019-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# bin/tools/source-bashrc
#
# Description
# Source user ~/.bashrc and OpenFOAM etc/bashrc
# Source user ~/.bashrc and OpenFOAM etc/bashrc.
# Not normally sourced manually, but from bash with the --rcfile option.
#
# This file is normally not sourced manually,
# but from bash with the --rcfile option.
#------------------------------------------------------------------------------
# Hard-coded value (eg, with autoconfig)
# Hard-coded directory path (eg, autoconfig)
projectDir="@PROJECT_DIR@"
if [ -z "$projectDir" ] || [ "${projectDir#@}" != "$projectDir" ]
then
# Auto-detect (as per OpenFOAM etc/bashrc)
# Auto-detect location (as per OpenFOAM etc/bashrc)
# --
# Assuming this file is $WM_PROJECT_DIR/bin/tools/source-bashrc,
# the next lines should work when sourced by BASH or ZSH shells.
# --
projectDir="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
[ -n "$projectDir" ] && projectDir="$(\cd $(dirname $projectDir)/../.. && \pwd -L)" || unset projectDir
if [ -n "$projectDir" ]
then
projectDir="$(\cd "$(dirname "$projectDir")"/../.. && \pwd -L)" || \
unset projectDir
fi
fi
#------------------------------------------------------------------------------
@ -66,7 +68,7 @@ then
# Some feedback
if [ -n "$PS1" ] && [ -d "$WM_PROJECT_DIR" ]
then
info="$(foamEtcFile -show-patch 2>/dev/null)"
info="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch 2>/dev/null)"
# echo "Using: OpenFOAM-$WM_PROJECT_VERSION ($FOAM_API${info:+ patch=$info}) - visit www.openfoam.com" 1>&2
echo "Using: OpenFOAM-$WM_PROJECT_VERSION${info:+ (patch=$info)} - visit www.openfoam.com" 1>&2

70
doc/openfoam.1.in Normal file
View File

@ -0,0 +1,70 @@
.TH "OPENFOAM" 1 "OpenFOAM-version" "www.openfoam.com" "OpenFOAM Commands Manual"
.SH NAME
openfoam \- OpenFOAM bash(1) session
.SH SYNOPSIS
\fBopenfoam\fR [\fIOPTIONS\fR] [\fIapplication ...\fR]
.SH DESCRIPTION
Activate an \fBOpenFOAM\fR environment in an interactive or
non-interactive bash(1) session.
If no application is given, an interactive bash session will be used.
If an application (optionally with arguments) is provided, the
OpenFOAM \fIetc/bashrc\fR file will be sourced from the project directory
prior to running the application.
.SH OPTIONS
.TP
\fB\-c\fR \fIcommand\fR
Execute shell commands with OpenFOAM environment
.TP
\fB\-D\fR\fIkey=[value]\fR
Define key/value to pass as a preference
.TP
\fB\-sp\fR
Use single precision for scalar-size
.TP
\fB\-dp\fR
Use double precision for scalar-size
.TP
\fB\-spdp\fR
Use single precision for scalar-size, double for solve-scalar size
.TP
\fB\-int32\fR
Use 32-bit label-size
.TP
\fB\-int64\fR
Use 64-bit label-size
.TP
\fB\-prefix=DIR\fR
Specify alternative OpenFOAM project directory
.TP
\fB\-show-api\fR | \fB\-version\fR
Print META-INFO api value and exit
.TP
\fB\-show-patch\fR
Print META-INFO patch value and exit
.TP
\fB\-show-prefix\fR
Print project directory and exit
.TP
\fB\-help\fR
Print the usage
.SH ARGUMENTS
If arguments remain after option processing, the first argument is
assumed to be an application with options and arguments.
.SH FILES
The \fIetc/bashrc\fR file from the OpenFOAM project directory supplies
the environment settings.
.SH "SEE ALSO"
Online documentation https://www.openfoam.com/documentation/
.SH COPYRIGHT
Copyright \(co 2020 OpenCFD Ltd.

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/bashrc
@ -30,11 +29,22 @@
# - $WM_PROJECT_SITE/$FOAM_API/etc/prefs.sh
# - $WM_PROJECT_SITE/etc/prefs.sh
#
# Some settings can also be overridden on the command-line when
# sourcing this file. For example,
#
# . /path/etc/bashrc WM_COMPILER=Clang WM_LABEL_SIZE=64
#
# Environment
# FOAM_CONFIG_ETC
# - alternative/additional location for OpenFOAM etc/ directory
#
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
# - no influence on OpenFOAM applications, just the config files
#
# 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
#
@ -132,6 +142,11 @@ projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# * on a 32-bit OS this option is ignored (always 32-bit)
#export WM_ARCH_OPTION=64
# [FOAM_EXTRA_CXXFLAGS]
# Additional compilation flags - do not inherit from the environment.
# Set after sourcing or via <prefs.sh> to avoid surprises.
unset FOAM_EXTRA_CXXFLAGS
################################################################################
# NO (NORMAL) USER EDITING BELOW HERE

View File

@ -9,8 +9,13 @@
type forces;
libs ("libforces.so");
writeControl timeStep;
writeInterval 1;
// How often force and moment volume fields will be written
writeControl writeTime; // none
// How often the forces force.dat and moment.dat data files are updated
// Note: .dat files are always updated on writeControl times
executeControl timeStep;
executeInterval 1;
log off;

View File

@ -8,9 +8,10 @@
Description
Solves a transport equation for a scalar field.
The name of the scalar field is specified in this file. A sample scalar
field file, that must be initialised for the case, typically in the 0
directory, is available in $FOAM_ETC/caseDicts/solvers/scalarTransport.
The name of the scalar field is specified in this file.
A sample scalar field file, that must be initialised for the case,
typically in the 0 directory,
is available in tetc/caseDicts/solvers/scalarTransport
\*---------------------------------------------------------------------------*/

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/compiler
@ -24,14 +23,19 @@
switch ("$WM_COMPILER_TYPE")
case ThirdParty:
# Default versions of GMP, MPFR, MPC - override as necessary
# Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
set gmp_version=gmp-system
set mpfr_version=mpfr-system
set mpc_version=mpc-system
set default_clang_version=llvm-3.7.1
set default_gcc_version=gcc-4.8.5
set default_gmp_version=gmp-system
set default_mpfr_version=mpfr-system
set default_mpc_version=mpc-system
switch ("$WM_COMPILER")
case Gcc:
set gcc_version="$default_gcc_version"
breaksw
case Gcc48*:
set gcc_version=gcc-4.8.5
breaksw
@ -95,7 +99,10 @@ case ThirdParty:
case Gcc92*:
set gcc_version=gcc-9.2.0
breaksw
case Clang:
set clang_version="$default_clang_version"
breaksw
case Clang37*:
set clang_version=llvm-3.7.1
breaksw
@ -126,6 +133,7 @@ case ThirdParty:
case Clang90*:
set clang_version=llvm-9.0.0
breaksw
default:
/bin/cat << UNKNOWN_COMPILER
===============================================================================
@ -143,4 +151,7 @@ UNKNOWN_COMPILER
breaksw
endsw
unset default_gcc_version default_clang_version
unset default_gmp_version default_mpfr_version default_mpc_version
#------------------------------------------------------------------------------

View File

@ -9,15 +9,17 @@
# Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.csh/example/compiler
# - sourced by OpenFOAM-*/etc/config.csh/settings
#
# Description
# Example of fine tuning ThirdParty compiler settings for OpenFOAM
# Older example of fine tuning compiler settings for OpenFOAM
#
# The preferred mechanism is now with a "compiler-$WM_COMPILER" file
# in one of the etc/ directories.
#
#------------------------------------------------------------------------------
@ -26,7 +28,7 @@ eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -config -mode=o compiler`
# Modify/override compiler settings
switch ("$WM_COMPILER")
case Gcc70:
case Gcc70*:
set gcc_version=gcc-7.0.0
set gmp_version=gmp-6.1.2
set mpfr_version=mpfr-3.1.5

View File

@ -0,0 +1,28 @@
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.csh/example/compiler-Gcc92
# - sourced by OpenFOAM-*/etc/config.csh/compiler
#
# Description
# Example of fine tuning compiler settings with a hook
#
#------------------------------------------------------------------------------
# Modify/override compiler settings
set gcc_version=gcc-9.2.0
set gmp_version=gmp-6.2.0
set mpfr_version=mpfr-4.0.2
set mpc_version=mpc-1.1.0
#------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/functions
@ -36,25 +35,13 @@ alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
# Echo values when FOAM_VERBOSE is on, no-op otherwise
if ($?FOAM_VERBOSE && $?prompt) then
alias _foamEcho 'echo \!*'
else
alias _foamEcho 'true'
endif
# Source an etc file, possibly with some verbosity
if ($?FOAM_VERBOSE && $?prompt) then
if ($?FOAM_CONFIG_NOUSER) then
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose -mode=o \!*`'
else
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
endif
alias _foamEcho 'echo \!*'
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
else
if ($?FOAM_CONFIG_NOUSER) then
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -mode=o \!*`'
else
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
endif
alias _foamEcho 'true'
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
endif

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/settings

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/setup
@ -19,10 +18,11 @@
# Finalize setup of OpenFOAM environment for C-shell (csh, tcsh)
#
# Environment
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
#
# FOAM_VERBOSE (set/unset)
# - add extra verbosity when sourcing files
# FOAM_CONFIG_NOUSER (set/unset)
# - suppress use of user/group configuration files
#
#------------------------------------------------------------------------------
@ -78,18 +78,25 @@ endif
# Overrides via <prefs.csh>
# 1. other (system) values
# 1. Always use (O)ther values from the OpenFOAM project etc/ directory
_foamEtc -mode=o prefs.csh
# 2. user or group values (unless disabled)
if (! $?FOAM_CONFIG_NOUSER ) then
_foamEtc -mode=ug prefs.csh
# 2. (U)ser or (G)roup values (unless disabled). Could use some more work
if ($?FOAM_CONFIG_MODE) then
set configMode="${FOAM_CONFIG_MODE:s/o//}" # Already handled O(ther)
else
set configMode="ug"
endif
# Is the remainder valid - has U(ser) or G(roup)?
switch ("$configMode")
case *[ug]*:
_foamEtc -mode="$configMode" prefs.csh
breaksw
endsw
# Capture and evaluate any command-line parameters
# These can be used to set/unset values, specify additional files etc.
setenv FOAM_SETTINGS "${*}"
setenv FOAM_SETTINGS "$argv[*]"
while ( $#argv > 0 )
switch ($argv[1])
@ -120,6 +127,16 @@ while ( $#argv > 0 )
shift
end
# The prefs may have injected a FOAM_CONFIG_ETC value.
# Verify that it makes sense before continuing.
if ( $?FOAM_CONFIG_ETC ) then
if ( ! -d "$FOAM_CONFIG_ETC" ) then
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC"
else if ( "$FOAM_CONFIG_ETC" == "$WM_PROJECT_DIR/etc" ) then
unsetenv FOAM_CONFIG_ETC
endif
endif
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/unset
@ -46,20 +45,15 @@ endif
unsetenv WM_ARCH
unsetenv WM_ARCH_OPTION
unsetenv WM_CC
unsetenv WM_CFLAGS
unsetenv WM_COMPILER
unsetenv WM_COMPILER_ARCH
unsetenv WM_COMPILER_TYPE
unsetenv WM_COMPILER_LIB_ARCH
unsetenv WM_COMPILE_OPTION
unsetenv WM_CXX
unsetenv WM_CXXFLAGS
unsetenv WM_DIR
unsetenv WM_HOSTS
unsetenv WM_LABEL_OPTION
unsetenv WM_LABEL_SIZE
unsetenv WM_LDFLAGS
unsetenv WM_MPLIB
unsetenv WM_NCOMPPROCS
unsetenv WM_OPTIONS
@ -75,6 +69,11 @@ unsetenv WM_PROJECT_VERSION
unsetenv WM_SCHEDULER
unsetenv WM_THIRD_PARTY_DIR
# Older variables
# Before 1906
unsetenv WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS
#------------------------------------------------------------------------------
# Unset FOAM_* environment variables
@ -83,9 +82,12 @@ unsetenv FOAM_API
unsetenv FOAM_APPBIN
unsetenv FOAM_APP
unsetenv FOAM_CODE_TEMPLATES
unsetenv FOAM_CONFIG_ETC
unsetenv FOAM_CONFIG_MODE
unsetenv FOAM_ETC
unsetenv FOAM_EXTRA_CXXFLAGS
unsetenv FOAM_EXTRA_LDFLAGS
unsetenv FOAM_EXT_LIBBIN
unsetenv FOAM_INST_DIR
unsetenv FOAM_JOB_DIR
unsetenv FOAM_LIBBIN
unsetenv FOAM_MPI
@ -102,6 +104,10 @@ unsetenv FOAM_USER_APPBIN
unsetenv FOAM_USER_LIBBIN
unsetenv FOAM_UTILITIES
# Old variables
# Before 1812
unsetenv FOAM_INST_DIR
#------------------------------------------------------------------------------
# Unset MPI-related environment variables

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/compiler
@ -24,13 +23,21 @@
case "$WM_COMPILER_TYPE" in
ThirdParty)
# Default versions of GMP, MPFR, MPC - override as necessary
gmp_version=gmp-system
mpfr_version=mpfr-system
mpc_version=mpc-system
# Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
default_clang_version=llvm-3.7.1
default_gcc_version=gcc-4.8.5
default_gmp_version=gmp-system
default_mpfr_version=mpfr-system
default_mpc_version=mpc-system
gmp_version="$default_gmp_version"
mpfr_version="$default_mpfr_version"
mpc_version="$default_mpc_version"
case "$WM_COMPILER" in
Gcc |\
Gcc) gcc_version="$default_gcc_version" ;;
Gcc48*) gcc_version=gcc-4.8.5 ;;
Gcc49*) gcc_version=gcc-4.9.4 ;;
Gcc51*) gcc_version=gcc-5.1.0 ;;
@ -54,7 +61,7 @@ ThirdParty)
Gcc91*) gcc_version=gcc-9.1.0 ;;
Gcc92*) gcc_version=gcc-9.2.0 ;;
Clang |\
Clang) clang_version="$default_clang_version" ;;
Clang37*) clang_version=llvm-3.7.1 ;;
Clang38*) clang_version=llvm-3.8.1 ;;
Clang39*) clang_version=llvm-3.9.1 ;;
@ -83,4 +90,7 @@ UNKNOWN_COMPILER
;;
esac
unset default_gcc_version default_clang_version
unset default_gmp_version default_mpfr_version default_mpc_version
#------------------------------------------------------------------------------

View File

@ -9,15 +9,17 @@
# Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.sh/example/compiler
# - sourced by OpenFOAM-*/etc/config.sh/settings
#
# Description
# Example of fine tuning compiler versions and settings for OpenFOAM
# Older example of fine tuning compiler settings for OpenFOAM.
#
# The preferred mechanism is now with a "compiler-$WM_COMPILER" file
# in one of the etc/ directories.
#
#------------------------------------------------------------------------------
@ -26,18 +28,12 @@ eval $($WM_PROJECT_DIR/bin/foamEtcFile -sh -config -mode=o compiler)
# Modify/override compiler settings
case "$WM_COMPILER" in
Gcc70)
Gcc70*)
gcc_version=gcc-7.0.0
gmp_version=gmp-6.1.2
mpfr_version=mpfr-3.1.5
mpc_version=mpc-1.0.3
;;
Gcc48u)
# Example of using the system GCC 4.8 in Ubuntu 15.10. Keep in mind you
# will also need to create the respective directory in "wmake/rules"
export CC='gcc-4.8'
export CXX='g++-4.8'
;;
esac
#------------------------------------------------------------------------------

View File

@ -0,0 +1,28 @@
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.sh/example/compiler-Gcc92
# - sourced by OpenFOAM-*/etc/config.sh/compiler
#
# Description
# Example of fine tuning compiler settings with a hook
#
#------------------------------------------------------------------------------
# Modify/override compiler settings
gcc_version=gcc-9.2.0
gmp_version=gmp-6.2.0
mpfr_version=mpfr-4.0.2
mpc_version=mpc-1.1.0
#------------------------------------------------------------------------------

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2018 OpenCFD Ltd.
# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/functions
@ -39,32 +38,25 @@ then
{
foamVar_name="$1"
shift
eval "$($foamClean -sh-env=$foamVar_name $@)"
eval "$($foamClean -sh-env="$foamVar_name" "$@")"
unset "foamVar_name"
}
# Echo values to stderr when FOAM_VERBOSE is on, no-op otherwise
unset -f _foamEcho 2>/dev/null
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
_foamEcho() { echo "$@" 1>&2; }
else
_foamEcho() { true; }
fi
# Source an etc file, possibly with some verbosity
# - use eval to avoid intermediate variables (ksh doesn't have 'local')
unset -f _foamEcho 2>/dev/null
unset -f _foamEtc 2>/dev/null
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
_foamEtc()
{
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
_foamEcho() { echo "$@" 1>&2; }
_foamEtc() {
eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh-verbose "$@")";
}
else
_foamEtc()
{
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
_foamEcho() { true; }
_foamEtc() {
eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh "$@")";
}
fi
@ -162,7 +154,7 @@ then
# - use lib-dir script instead of rewriting
_foamAddLibAuto()
{
eval "$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $@)";
eval "$("$WM_PROJECT_DIR"/bin/tools/lib-dir -sh "$@")";
}
fi

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/paraview
@ -109,7 +108,7 @@ case "$ParaView_VERSION" in
(system)
unset PV_PLUGIN_PATH
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} -config paraview-system)"
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh -config paraview-system)"
;;
(*)

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/settings

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/setup
@ -19,15 +18,16 @@
# Finalize setup of OpenFOAM environment for POSIX shell.
#
# Environment
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
#
# FOAM_VERBOSE (set/unset)
# - add extra verbosity when sourcing files
# FOAM_CONFIG_NOUSER (set/unset)
# - suppress use of user/group configuration files
#
#------------------------------------------------------------------------------
# [FOAM_API] - The API level for the project
export FOAM_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)"
export FOAM_API=$("$WM_PROJECT_DIR/bin/foamEtcFile" -show-api)
# The installation parent directory
prefixDir="${WM_PROJECT_DIR%/*}"
@ -83,11 +83,22 @@ fi
# Overrides via <prefs.sh>
# 1. other (system) values
# 1. Always use O(ther) values from the OpenFOAM project etc/ directory
_foamEtc -mode=o prefs.sh
# 2. user or group values (unless disabled)
[ -z "$FOAM_CONFIG_NOUSER" ] && _foamEtc -mode=ug prefs.sh
# 2. (U)ser or (G)roup values (unless disabled).
unset configMode
if [ -z "$FOAM_CONFIG_MODE" ]
then
configMode="ug"
else
case "$FOAM_CONFIG_MODE" in (*[u]*) configMode="${configMode}u" ;; esac
case "$FOAM_CONFIG_MODE" in (*[g]*) configMode="${configMode}g" ;; esac
fi
if [ -n "$configMode" ]
then
_foamEtc -mode="$configMode" prefs.sh
fi
# Capture and evaluate any command-line parameters
@ -104,6 +115,21 @@ else
_foamEval "$@"
fi
# The prefs may have injected a FOAM_CONFIG_ETC value.
# Verify that it makes sense before continuing.
if [ -n "$FOAM_CONFIG_ETC" ]
then
if [ ! -d "$FOAM_CONFIG_ETC" ]
then
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC" 1>&2
unset FOAM_CONFIG_ETC
elif [ "$FOAM_CONFIG_ETC" = "$WM_PROJECT_DIR/etc" ]
then
# Redundant value
unset FOAM_CONFIG_ETC
fi
fi
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -132,8 +158,8 @@ then
_foamAddMan "$WM_PROJECT_DIR/doc"
fi
# Interactive shell
if /usr/bin/tty -s 2>/dev/null
# Interactive shell (use PS1, not tty)
if [ -n "$PS1" ]
then
_foamEtc -config aliases
[ "${BASH_VERSINFO:-0}" -ge 4 ] && _foamEtc -config bash_completion

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/unset
@ -35,19 +34,14 @@ foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
unset WM_ARCH
unset WM_ARCH_OPTION
unset WM_CC
unset WM_CFLAGS
unset WM_COMPILER
unset WM_COMPILER_TYPE
unset WM_COMPILER_LIB_ARCH
unset WM_COMPILE_OPTION
unset WM_CXX
unset WM_CXXFLAGS
unset WM_DIR
unset WM_HOSTS
unset WM_LABEL_OPTION
unset WM_LABEL_SIZE
unset WM_LDFLAGS
unset WM_MPLIB
unset WM_NCOMPPROCS
unset WM_OPTIONS
@ -63,6 +57,10 @@ unset WM_PROJECT_VERSION
unset WM_SCHEDULER
unset WM_THIRD_PARTY_DIR
# Older variables
# Before 1906
unset WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS
#------------------------------------------------------------------------------
# Unset FOAM_* environment variables
@ -71,9 +69,12 @@ unset FOAM_API
unset FOAM_APPBIN
unset FOAM_APP
unset FOAM_CODE_TEMPLATES
unset FOAM_CONFIG_ETC
unset FOAM_CONFIG_MODE
unset FOAM_ETC
unset FOAM_EXTRA_CXXFLAGS
unset FOAM_EXTRA_LDFLAGS
unset FOAM_EXT_LIBBIN
unset FOAM_INST_DIR
unset FOAM_JOB_DIR
unset FOAM_LIBBIN
unset FOAM_MPI
@ -90,6 +91,10 @@ unset FOAM_USER_APPBIN
unset FOAM_USER_LIBBIN
unset FOAM_UTILITIES
# Old variables
# Before 1812
unset FOAM_INST_DIR
#------------------------------------------------------------------------------
# Unset MPI-related environment variables

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/cshrc
@ -30,11 +29,22 @@
# - $WM_PROJECT_SITE/$FOAM_API/etc/prefs.csh
# - $WM_PROJECT_SITE/prefs.csh
#
# Some settings can also be overridden on the command-line when
# sourcing this file. For example,
#
# source /path/etc/cshrc WM_COMPILER=Clang WM_LABEL_SIZE=64
#
# Environment
# FOAM_CONFIG_ETC
# - alternative/additional location for OpenFOAM etc/ directory
#
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
# - no influence on OpenFOAM applications, just the config files
#
# 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
#
@ -134,6 +144,11 @@ set projectDir=`lsof +p $$ |& \
# * on a 32-bit OS this option is ignored (always 32-bit)
#setenv WM_ARCH_OPTION 64
# [FOAM_EXTRA_CXXFLAGS]
# Additional compilation flags - do not inherit from the environment.
# Set after sourcing or via <prefs.csh> to avoid surprises.
unsetenv FOAM_EXTRA_CXXFLAGS
################################################################################
# NO (NORMAL) USER EDITING BELOW HERE
@ -176,7 +191,7 @@ 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" "${*}"
source "$WM_PROJECT_DIR/etc/config.csh/setup" $argv[*]
else
echo "Error: did not locate installation path for $WM_PROJECT-$WM_PROJECT_VERSION"
echo "No directory: $WM_PROJECT_DIR"

286
etc/openfoam Executable file
View File

@ -0,0 +1,286 @@
#!/bin/bash
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# openfoam [options] [args]
#
# Description
# Open an interactive bash session with an OpenFOAM environment,
# or run an OpenFOAM application (with arguments) after first sourcing
# the OpenFOAM etc/bashrc file from the project directory.
#
# Note
# This script normally exists in the $WM_PROJECT_DIR/etc/ directory.
# Do not copy/move/link to other locations. Use instead an edited copy of
# `bin/tools/openfoam.in` with a hard-coded projectDir entry.
#
# See OpenFOAM etc/bashrc for (command-line) preferences.
# Some equivalent settings:
# -sp | -DWM_PRECISION_OPTION=SP
# -dp | -DWM_PRECISION_OPTION=DP
# -int32 | -DWM_LABEL_SIZE=32
# -int64 | -DWM_LABEL_SIZE=64
#
# However, the '-D' options grant more flexibility. For example,
# etc/openfoam -DWM_COMPILER=Clang
#
#------------------------------------------------------------------------------
# Auto-detect from location
projectDir="$(\cd "$(dirname "${0%/*}")" && \pwd -L)"
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] [application ...]
options:
-c command Execute shell commands with OpenFOAM environment
-Dkey[=value] Define key/value to pass as a preference
-sp Single precision
-dp Double precision
-spdp Mixed single/double precision
-int32 | -int64 The label-size
-etc=DIR Additional project etc/ directory
-prefix=DIR Alternative OpenFOAM project directory
-show-api | -version Print META-INFO api value and exit
-show-patch Print META-INFO patch value and exit
-show-prefix Print project directory and exit
-verbose Set FOAM_VERBOSE=true (interactive only)
-help Print the usage
Open an interactive bash session with an OpenFOAM environment,
or run an OpenFOAM application (with arguments) after first sourcing
the OpenFOAM etc/bashrc file from the project directory:
($projectDir)
For more information: www.openfoam.com
USAGE
exit 0 # A clean exit
}
#-------------------------------------------------------------------------------
# Get a value from META-INFO/api-info
# $1 : keyword
getApiInfo()
{
value="$(sed -ne 's@^'"$1"' *= *\([0-9][0-9]*\).*@\1@p' "$projectDir"/META-INFO/api-info 2>/dev/null)"
if [ -n "$value" ]
then
echo "$value"
else
echo "Could not determine OPENFOAM '$1' value" 1>&2
return 1
fi
}
#-------------------------------------------------------------------------------
# No inheritance of FOAM_SETTINGS
unset FOAM_SETTINGS
unset _foamEtcDir _foamSettings _foamScriptCommand
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help* | --help*)
printHelp
;;
-show-api | -version | --version) # Show API and exit
getApiInfo api
exit $?
;;
-show-patch) # Show patch level and exit
getApiInfo patch
exit $?
;;
-show-prefix) # Show project directory and exit
echo "$projectDir"
exit $?
;;
-c) # Shell command
_foamScriptCommand="$2"
[ -n "$_foamScriptCommand" ] || {
echo "$0: missing or bad command argument: $2" 1>&2
exit 1
}
shift 2
break
;;
-D*) # Define key/value to pass as preference
setting="${1#-D}"
if [ -n "$setting" ]
then
_foamSettings="$_foamSettings${_foamSettings:+ }$setting"
fi
;;
-sp | -dp | -spdp )
# WM_PRECISION_OPTION=(SP|DP|SPDP)
setting=$(echo "${1#-}" | sed -e 's/-//g;y/sdp/SDP/')
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=$setting"
;;
-int32 | -int64)
# WM_LABEL_SIZE=...
_foamSettings="$_foamSettings${_foamSettings:+ }WM_LABEL_SIZE=${1#-int}"
;;
-etc=*)
# Define FOAM_CONFIG_ETC for finding files
_foamEtcDir="${1#*=}"
;;
-prefix=*)
projectDir="${1#*=}"
;;
-verbose)
export FOAM_VERBOSE=true
;;
--)
shift
break
;;
-*)
echo "$0: unknown option: '$1'" 1>&2
exit 1
;;
*)
break
;;
esac
shift
done
#-------------------------------------------------------------------------------
# Sanity check (installed under /bin, /usr/bin, /usr/local/bin)
# This should not happen.
# If copied to a system dir, should also be using hard-coded values!
if [ "${projectDir%/bin}" != "$projectDir" ]
then
echo "Warning: suspicious project dir: $projectDir" 1>&2
fi
[ -d "$projectDir/META-INFO" ] || {
echo "Warning: missing META-INFO in OpenFOAM directory:" 1>&2
echo " $projectDir" 1>&2
}
# Remove current OpenFOAM environment
if [ -d "$WM_PROJECT_DIR" ] && [ -f "$WM_PROJECT_DIR/etc/config.sh/unset" ]
then
. "$WM_PROJECT_DIR/etc/config.sh/unset" || true
fi
unset interactive
if [ "$#" -eq 0 ] && [ -z "$_foamScriptCommand" ]
then
# Interactive shell, chain off via a file
interactive=true
_foamSourceBashEnv="$projectDir/bin/tools/source-bashrc"
else
# Non-interactive shell, use the OPENFOAM etc/bashrc
_foamSourceBashEnv="$projectDir/etc/bashrc"
fi
[ -f "$_foamSourceBashEnv" ] || {
echo "Error: file not found: $_foamSourceBashEnv" 1>&2
exit 2
}
if [ -n "$_foamEtcDir" ] && [ -d "$_foamEtcDir" ]
then
# Additional etc directory
export FOAM_CONFIG_ETC="$_foamEtcDir"
else
unset FOAM_CONFIG_ETC
fi
if [ -n "$interactive" ]
then
# Interactive shell
# -----------------
# Source ~/.bashrc and OpenFOAM etc/bashrc in one of two ways:
# 1) Generate and use a tmp file
# 2) Chain off to a dedicated file [This is what we use]
if [ -n "$_foamSettings" ]
then
# Pass preferences via the FOAM_SETTINGS mechanism
export FOAM_SETTINGS="$_foamSettings"
fi
## echo "Source with $_foamSourceBashEnv with '$FOAM_SETTINGS'" 1>&2
# Newer bash can use --init-file instead of --rcfile
exec bash --rcfile "$_foamSourceBashEnv" -i
exit $? # Safety
fi
# Non-interactive shell
# ---------------------
# Source bashrc within a function to preserve command-line arguments
# Suppresses aliases as a side-effect, but non-interactive anyhow.
sourceBashrc()
{
. "$_foamSourceBashEnv" $_foamSettings
}
if [ -n "$_foamScriptCommand" ]
then
# A shell command
sourceBashrc
exec bash -c "$_foamScriptCommand" "$@"
exit $? # Safety
fi
# An application or a shell script
# It may actually be a script with a '#!/project-path/bin/openfoam',
# so we need to catch this to avoid infinite recursion.
if [ -f "$1" ] \
&& [ -n "$(sed -ne '1{/^#!.*\/openfoam$/p; q}' "$1" 2>/dev/null)" ]
then
# A shell script
sourceBashrc
exec bash "$@"
else
# An application
sourceBashrc
exec "$@"
fi
#------------------------------------------------------------------------------

View File

@ -11,7 +11,7 @@ Overview
Meshing
=======
+ Meshing is setup as in the inflowOutflow template
+ See $FOAM_ETC/templates/inflowOutflow/README for details
+ See etc/templates/inflowOutflow/README for details
+ The setup includes an example for one named patch to be generated in the mesh
+ In snappyHexMeshDict, replace <CADregionName> with the name of region in the
trisurface; replace <patchName> with the name of the resulting mesh patch
@ -21,4 +21,4 @@ Initialisation
+ In the field files in the 0 directory, set initial values
+ The template includes a fixedValue boundary condition on <patchName> in 0/T
+ The user can replace <patchName> with a real mesh patch name and apply a
fixed temperature on that patch
fixed temperature on that patch

View File

@ -200,6 +200,50 @@ void reduce
);
#if defined(WM_SPDP)
void reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void reduce
(
solveScalar& Value,
const minOp<solveScalar>& bop,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void reduce
(
Vector2D<solveScalar>& Value,
const sumOp<Vector2D<solveScalar>>& bop,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void sumReduce
(
solveScalar& Value,
label& Count,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label comm,
label& request
);
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -143,7 +143,8 @@ bool Foam::functionEntries::includeEntry::execute
{
if (Foam::functionEntries::includeEntry::log)
{
DetailInfo << fName << endl;
// Report to stdout which file is included
Info<< fName << nl;
}
// Add watch on included file
@ -194,7 +195,8 @@ bool Foam::functionEntries::includeEntry::execute
{
if (Foam::functionEntries::includeEntry::log)
{
DetailInfo << fName << endl;
// Report to stdout which file is included
Info<< fName << nl;
}
// Add watch on included file

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -123,7 +123,8 @@ bool Foam::functionEntries::includeEtcEntry::execute
{
if (Foam::functionEntries::includeEtcEntry::log)
{
DetailInfo << fName << endl;
// Report to stdout which file is included
Info<< fName << nl;
}
parentDict.read(ifs);
return true;
@ -162,7 +163,8 @@ bool Foam::functionEntries::includeEtcEntry::execute
{
if (Foam::functionEntries::includeEtcEntry::log)
{
DetailInfo << fName << endl;
// Report to stdout which file is included
Info<< fName << nl;
}
entry.read(parentDict, ifs);
return true;

View File

@ -286,7 +286,7 @@ Foam::fileOperations::collatedFileOperation::collatedFileOperation
"enabled, deactivate" << nl
<< " threading by setting maxThreadFileBufferSize "
"to 0 in" << nl
<< " $FOAM_ETC/controlDict"
<< " OpenFOAM etc/controlDict"
<< endl;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2018 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -723,17 +723,15 @@ Foam::fileOperations::masterUncollatedFileOperation::read
Pout<< "masterUncollatedFileOperation::readStream :"
<< " Done reading " << buf.size() << " bytes" << endl;
}
const fileName& fName = filePaths[Pstream::myProcNo(comm)];
isPtr.reset
(
new IListStream
(
std::move(buf),
IOstream::BINARY,
IOstream::currentVersion,
fName
)
);
// A local character buffer copy of the Pstream contents.
// Construct with same parameters (ASCII, current version)
// as the IFstream so that it has the same characteristics.
isPtr.reset(new IListStream(std::move(buf)));
// With the proper file name
isPtr->name() = filePaths[Pstream::myProcNo(comm)];
if (!io.readHeader(isPtr()))
{
@ -2415,6 +2413,8 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
const fileName& filePath
) const
{
autoPtr<ISstream> isPtr;
if (Pstream::parRun())
{
// Insert logic of filePath. We assume that if a file is absolute
@ -2497,10 +2497,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
if (Pstream::master(Pstream::worldComm))
{
// Read myself
return autoPtr<ISstream>
(
new IFstream(filePaths[Pstream::masterNo()])
);
isPtr.reset(new IFstream(filePaths[Pstream::masterNo()]));
}
else
{
@ -2522,26 +2519,23 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
<< " Done reading " << buf.size() << " bytes" << endl;
}
// Note: IPstream is not an IStream so use a IStringStream to
// convert the buffer. Note that we construct with a string
// so it holds a copy of the buffer.
return autoPtr<ISstream>
(
new IListStream
(
std::move(buf),
IOstream::BINARY,
IOstream::currentVersion,
filePath
)
);
// A local character buffer copy of the Pstream contents.
// Construct with same parameters (ASCII, current version)
// as the IFstream so that it has the same characteristics.
isPtr.reset(new IListStream(std::move(buf)));
// With the proper file name
isPtr->name() = filePath;
}
}
else
{
// Read myself
return autoPtr<ISstream>(new IFstream(filePath));
isPtr.reset(new IFstream(filePath));
}
return isPtr;
}

View File

@ -82,15 +82,18 @@ void Foam::primitiveMesh::makeCellCentresAndVols
{
typedef Vector<solveScalar> solveVector;
// Clear the fields for accumulation. Note1: we're doing this before
// any precision conversion since this might complain about illegal numbers.
// Note2: zero is a special value which is perfectly converted into zero
// in the new precision
cellCtrs_s = Zero;
cellVols_s = 0.0;
PrecisionAdaptor<solveVector, vector> tcellCtrs(cellCtrs_s);
Field<solveVector>& cellCtrs = tcellCtrs.ref();
PrecisionAdaptor<solveScalar, scalar> tcellVols(cellVols_s);
Field<solveScalar>& cellVols = tcellVols.ref();
// Clear the fields for accumulation
cellCtrs = Zero;
cellVols = 0.0;
const labelList& own = faceOwner();
const labelList& nei = faceNeighbour();

View File

@ -96,6 +96,51 @@ void Foam::reduce(scalar&, const sumOp<scalar>&, const int, const label, label&)
{}
#if defined(WM_SPDP)
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label comm
)
{}
void Foam::reduce
(
solveScalar& Value,
const minOp<solveScalar>& bop,
const int tag,
const label comm
)
{}
void Foam::reduce
(
Vector2D<solveScalar>& Value,
const sumOp<Vector2D<solveScalar>>& bop,
const int tag,
const label comm
)
{}
void Foam::sumReduce
(
solveScalar& Value,
label& Count,
const int tag,
const label comm
)
{}
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label comm,
label& request
)
{}
#endif
void Foam::UPstream::allToAll
(
const labelUList& sendData,

View File

@ -40,10 +40,15 @@ License
#include <cstdlib>
#include <csignal>
#if defined(WM_SP) || defined(WM_SPDP)
#if defined(WM_SP)
#define MPI_SCALAR MPI_FLOAT
#define MPI_SOLVESCALAR MPI_FLOAT
#elif defined(WM_SPDP)
#define MPI_SCALAR MPI_FLOAT
#define MPI_SOLVESCALAR MPI_DOUBLE
#elif defined(WM_DP)
#define MPI_SCALAR MPI_DOUBLE
#define MPI_SOLVESCALAR MPI_DOUBLE
#endif
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -478,6 +483,132 @@ void Foam::reduce
}
#if defined(WM_SPDP)
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
allReduce(Value, 1, MPI_SOLVESCALAR, MPI_SUM, bop, tag, communicator);
}
void Foam::reduce
(
solveScalar& Value,
const minOp<solveScalar>& bop,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
allReduce(Value, 1, MPI_SOLVESCALAR, MPI_MIN, bop, tag, communicator);
}
void Foam::reduce
(
Vector2D<solveScalar>& Value,
const sumOp<Vector2D<solveScalar>>& bop,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
allReduce(Value, 2, MPI_SOLVESCALAR, MPI_SUM, bop, tag, communicator);
}
void Foam::sumReduce
(
solveScalar& Value,
label& Count,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
Vector2D<solveScalar> twoScalars(Value, solveScalar(Count));
reduce(twoScalars, sumOp<Vector2D<solveScalar>>(), tag, communicator);
Value = twoScalars.x();
Count = twoScalars.y();
}
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label communicator,
label& requestID
)
{
#ifdef MPIX_COMM_TYPE_SHARED
// Assume mpich2 with non-blocking collectives extensions. Once mpi3
// is available this will change.
MPI_Request request;
solveScalar v = Value;
MPIX_Ireduce
(
&v,
&Value,
1,
MPI_SOLVESCALAR,
MPI_SUM,
0, //root
PstreamGlobals::MPICommunicators_[communicator],
&request
);
requestID = PstreamGlobals::outstandingRequests_.size();
PstreamGlobals::outstandingRequests_.append(request);
if (UPstream::debug)
{
Pout<< "UPstream::allocateRequest for non-blocking reduce"
<< " : request:" << requestID
<< endl;
}
#else
// Non-blocking not yet implemented in mpi
reduce(Value, bop, tag, communicator);
requestID = -1;
#endif
}
#endif
void Foam::UPstream::allToAll
(
const labelUList& sendData,

View File

@ -166,19 +166,15 @@ Foam::Ostream& Foam::ensightFile::write
Foam::Ostream& Foam::ensightFile::write(const char* value)
{
// Parentheses around strncpy to silence the GCC -Wstringop-truncation
// warning, which is spurious here.
// The max-size and buffer-size *are* identical, which means the buffer
// may not have a nul terminator. However, this is properly handled in
// the subsequent binary write and the ASCII write explicitly adds
// a nul terminator.
// Output 80 chars, but allocate for trailing nul character
// to avoid -Wstringop-truncation warnings/errors.
char buf[80];
(strncpy(buf, value, 80)); // max 80 chars or padded with nul if smaller
char buf[80+1];
strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller
if (format() == IOstream::BINARY)
{
write(buf, sizeof(buf));
write(buf, 80);
}
else
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -96,11 +96,11 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
const vector nf(computePatchNormal());
// Find the second local coordinate direction
direction minCmpt = -1;
scalar minMag = VGREAT;
for (direction cmpt = 0; cmpt < pTraits<vector>::nComponents; ++cmpt)
direction minCmpt = 0;
scalar minMag = mag(nf[minCmpt]);
for (direction cmpt = 1; cmpt < pTraits<vector>::nComponents; ++cmpt)
{
scalar s = mag(nf[cmpt]);
const scalar s = mag(nf[cmpt]);
if (s < minMag)
{
minMag = s;
@ -110,7 +110,7 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Create the second local coordinate direction
vector e2(Zero);
e2[minCmpt] = 1.0;
e2[minCmpt] = 1;
// Remove normal component
e2 -= (nf&e2)*nf;
@ -147,17 +147,14 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Compute virtual-actual patch index pairs
List<Pair<label>> indexPairs(this->size(), Pair<label>(Zero, Zero));
// Virtual turbulence plane indices
label j = 0;
label k = 0;
forAll(*this, facei)
{
const scalar& centre0 = localPos[facei][0];
const scalar& centre1 = localPos[facei][1];
j = label((centre0 - localMinPt[0])*invDelta_[0]);
k = label((centre1 - localMinPt[1])*invDelta_[1]);
// Virtual turbulence plane indices
const label j = label((centre0 - localMinPt[0])*invDelta_[0]);
const label k = label((centre1 - localMinPt[1])*invDelta_[1]);
indexPairs[facei] = Pair<label>(facei, k*n[0] + j);
}

View File

@ -162,7 +162,7 @@ public:
//- Destructor
~weightedFlux();
virtual ~weightedFlux();
// Member Functions

View File

@ -118,7 +118,7 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
{
label nbrCelli =
(
cell() == mesh().faceOwner()[face()]
this->cell() == mesh().faceOwner()[face()]
? mesh().faceNeighbour()[face()]
: mesh().faceOwner()[face()]
);
@ -135,7 +135,7 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
// Change into nbrCell. No need to change tetFace, tetPt.
//Pout<< " crossed from cell:" << celli_
// << " into " << nbrCelli << endl;
cell() = nbrCelli;
this->cell() = nbrCelli;
patchInteraction(cloud, td, trackFraction);
}
else

View File

@ -76,7 +76,7 @@ bool Foam::ensightOutput::writeCloudField
IPstream fromSlave(comm, slave);
Field<Type> recv(fromSlave);
for (Type val : field) // <-- working on a copy
for (Type val : recv) // <-- working on a copy
{
if (mag(val) < 1e-90) // approximately root(ROOTVSMALL)
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -78,18 +79,18 @@ Foam::point Foam::BSpline::position
const point& p0 = points()[segment];
const point& p1 = points()[segment+1];
// special cases - no calculation needed
if (mu <= 0.0)
// Special cases - no calculation needed
// Note: only checks at overall endpoints
if ((segment == 0) && (mu <= 0.0))
{
return p0;
}
else if (mu >= 1.0)
else if ((segment == nSegments() - 1) && (mu >= 1.0))
{
return p1;
}
// determine the end points
// Determine the end points
point e0;
point e1;
@ -113,7 +114,6 @@ Foam::point Foam::BSpline::position
e1 = points()[segment+2];
}
return 1.0/6.0 *
(
( e0 + 4*p0 + p1 )

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,13 +50,30 @@ namespace surfaceWriters
namespace Foam
{
//- A (0-1) range for colouring
inline scalar srange01(const scalarMinMax& range, scalar x)
{
if (x >= range.max())
{
return 1;
}
x -= range.min();
if (x < VSMALL)
{
return 0;
}
return x / (range.max() - range.min());
}
//- A (0-1) range for colouring
template<class Type>
static inline scalar rangex(const scalarMinMax& range, const Type& val)
{
scalar x = Foam::mag(val);
return (x - range.min()) / (range.max() - range.min());
return srange01(range, Foam::mag(val));
}
@ -64,8 +81,7 @@ static inline scalar rangex(const scalarMinMax& range, const Type& val)
template<>
inline scalar rangex(const scalarMinMax& range, const scalar& val)
{
scalar x = val;
return (x - range.min()) / (range.max() - range.min());
return srange01(range, val);
}
@ -73,8 +89,7 @@ inline scalar rangex(const scalarMinMax& range, const scalar& val)
template<>
inline scalar rangex(const scalarMinMax& range, const label& val)
{
scalar x = val;
return (x - range.min()) / (range.max() - range.min());
return srange01(range, val);
}
@ -266,8 +281,17 @@ Foam::fileName Foam::surfaceWriters::x3dWriter::writeTemplate
if (!range.valid())
{
range = minMaxMag(values);
if (equal(range.mag(), 0))
{
range.add(range.centre());
}
}
// Slight rounding
range.min() -= VSMALL;
range.max() += VSMALL;
if (!isDir(outputFile.path()))
{
mkDir(outputFile.path());

View File

@ -121,7 +121,7 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs()
const_cast<fixedJumpFvPatchScalarField&>(TbPatch);
// force update of jump
Tbp.updateCoeffs();
Tbp.evaluate(Pstream::commsTypes::blocking);
const labelUList& faceCells = this->patch().faceCells();

View File

@ -121,7 +121,7 @@ void Foam::energyJumpAMIFvPatchScalarField::updateCoeffs()
const_cast<fixedJumpAMIFvPatchScalarField&>(TbPatch);
// force update of jump
Tbp.updateCoeffs();
Tbp.evaluate(Pstream::commsTypes::blocking);
const labelUList& faceCells = this->patch().faceCells();

View File

@ -122,7 +122,7 @@ void Foam::gradientEnergyFvPatchScalarField::updateCoeffs()
void Foam::gradientEnergyFvPatchScalarField::write(Ostream& os) const
{
fixedGradientFvPatchScalarField::write(os);
os.writeEntry("value", *this);
this->writeEntry("value", os);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -72,7 +72,7 @@ Foam::radiation::P1::P1(const volScalarField& T)
"qr",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh_,
@ -142,7 +142,7 @@ Foam::radiation::P1::P1(const dictionary& dict, const volScalarField& T)
"qr",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh_,
@ -190,12 +190,6 @@ Foam::radiation::P1::P1(const dictionary& dict, const volScalarField& T)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::P1::~P1()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::radiation::P1::read()
@ -240,19 +234,19 @@ void Foam::radiation::P1::calculate()
fvm::laplacian(gamma, G_)
- fvm::Sp(a_, G_)
==
- 4.0*(e_*physicoChemical::sigma*pow4(T_) ) - E_
- 4.0*(e_*physicoChemical::sigma*pow4(T_)) - E_
);
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
// Calculate radiative heat flux on boundaries.
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
const volScalarField::Boundary& GBf = G_.boundaryField();
const volScalarField::Boundary& gammaBf = gamma.boundaryField();
forAll(mesh_.boundaryMesh(), patchi)
{
if (!G_.boundaryField()[patchi].coupled())
if (!GBf[patchi].coupled())
{
qrBf[patchi] =
-gamma.boundaryField()[patchi]
*G_.boundaryField()[patchi].snGrad();
qrBf[patchi] = -gammaBf[patchi]*GBf[patchi].snGrad();
}
}
}
@ -282,12 +276,9 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::P1::Rp() const
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::radiation::P1::Ru() const
{
const volScalarField::Internal& G =
G_();
const volScalarField::Internal E =
absorptionEmission_->ECont()()();
const volScalarField::Internal a =
absorptionEmission_->aCont()()();
const volScalarField::Internal& G = G_();
const volScalarField::Internal E = absorptionEmission_->ECont()()();
const volScalarField::Internal a = absorptionEmission_->aCont()()();
return a*G - E;
}
@ -298,4 +289,5 @@ Foam::label Foam::radiation::P1::nBands() const
return absorptionEmission_->nBands();
}
// ************************************************************************* //

View File

@ -107,7 +107,7 @@ public:
//- Destructor
virtual ~P1();
virtual ~P1() = default;
// Member functions

View File

@ -13,5 +13,4 @@ Eddy Simulation (IDDES) model
For further details please visit:
openfoam.com/documentation/cpp-guide/html/verification-validation-turbulent-surface-mounted-cube.html
https://www.openfoam.com/documentation/guides/latest/doc/verification-validation-turbulent-surface-mounted-cube.html

View File

@ -14,9 +14,12 @@ c++WARN = \
-Wall -Wextra -Wold-style-cast \
-Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
-Wno-undefined-var-template \
-Wno-unknown-warning-option
-Wno-unknown-warning-option \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN = \
-Wno-old-style-cast -Wno-unused-local-typedefs \
-Wno-tautological-undefined-compare -Wno-shift-negative-value \
-Wno-null-pointer-arithmetic
#------------------------------------------------------------------------------

View File

@ -13,9 +13,12 @@ ptFLAGS = -DNoRepository -ftemplate-depth-100
c++WARN = \
-Wall -Wextra -Wold-style-cast \
-Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
-Wno-attributes -Wno-unknown-pragmas
-Wno-attributes -Wno-unknown-pragmas \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN = \
-Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds \
-Wno-deprecated-declarations \
-fpermissive
#------------------------------------------------------------------------------

View File

@ -14,7 +14,10 @@ c++WARN = \
-Wall -Wextra \
-Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
-Wno-unknown-pragmas \
-diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076
-diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076 \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN = \
-diag-disable 1224,2026,2305
#------------------------------------------------------------------------------

View File

@ -10,5 +10,9 @@ ptFLAGS = -DNoRepository
# - Standard warnings
# - Less restrictive warnings (may be needed for flex++, CGAL, etc.)
c++WARN =
c++WARN = \
$(FOAM_EXTRA_CXXFLAGS)
c++LESSWARN =
#------------------------------------------------------------------------------

View File

@ -17,7 +17,7 @@ GLIB_LIBS =
COMPILER_FAMILY = $(shell echo "$(WM_COMPILER)" | sed -e 's/[0-9].*//')
DEFAULT_RULES = $(WM_DIR)/rules/$(WM_ARCH)$(COMPILER_FAMILY)
RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
WMAKE_BIN = $(WM_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER)
WMAKE_BIN = $(WM_PROJECT_DIR)/platforms/tools/$(WM_ARCH)$(WM_COMPILER)
# Default compilation is 'Opt' - never permit an empty value
ifeq ($(WM_COMPILE_OPTION),)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Clang/c++
c++ARCH = -m64 -ftrapping-math
c++ARCH = -m64 -pthread -ftrapping-math
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Clang/c++
c++ARCH = -m64
c++ARCH = -m64 -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -2,7 +2,7 @@ include $(GENERAL_RULES)/Gcc/c++
CC = CC -std=c++11
c++ARCH = -m64
c++ARCH = -m64 -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Gcc/c++
c++ARCH = -m64
c++ARCH = -m64 -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Icc/c++
c++ARCH = -fp-trap=common -fp-model precise
c++ARCH = -pthread -fp-trap=common -fp-model precise
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Gcc/c++
c++ARCH = -m64
c++ARCH = -m64 -pthread
# With gnu++11 (not c++11) to ensure __STRICT_ANSI__ is not defined
CC = x86_64-w64-mingw32-g++ -std=gnu++11

View File

@ -3,7 +3,7 @@ include $(GENERAL_RULES)/Clang/c++
CC = armclang++ -std=c++11
c++ARCH = -mcpu=native
c++ARCH = -mcpu=native -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Clang/c++
c++ARCH =
c++ARCH = -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Gcc/c++
c++ARCH =
c++ARCH = -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Gcc/c++
c++ARCH = -mcpu=cortex-a9
c++ARCH = -mcpu=cortex-a9 -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Clang/c++
c++ARCH = -m32
c++ARCH = -m32 -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Gcc/c++
c++ARCH = -m32
c++ARCH = -m32 -pthread
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,6 +1,6 @@
include $(GENERAL_RULES)/Icc/c++
c++ARCH = -fp-trap=common -fp-model precise
c++ARCH = -pthread -fp-trap=common -fp-model precise
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -52,7 +52,7 @@ echo_adios2()
}
# Provide hint for enabling
# Hint for enabling
hint_adios2()
{
/bin/cat<<INFORMATION 1>&2
@ -97,10 +97,10 @@ have_adios2()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -114,10 +114,9 @@ have_adios2()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -132,7 +131,7 @@ have_adios2()
}
# Force reset of old variables
# Reset variables
no_adios2
# Testing

View File

@ -74,10 +74,10 @@ have_boost()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -91,10 +91,9 @@ have_boost()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -111,7 +110,7 @@ have_boost()
}
# Force reset of old variables
# Reset variables
no_boost
# Testing

View File

@ -81,7 +81,7 @@ have_ccmio()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
else
unset prefix
fi
@ -94,10 +94,9 @@ have_ccmio()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -137,7 +136,7 @@ have_ccmio()
}
# Force reset of old variables
# Reset variables
no_ccmio
# Testing

View File

@ -74,10 +74,10 @@ have_cgal()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -91,10 +91,9 @@ have_cgal()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -111,7 +110,7 @@ have_cgal()
}
# Force reset of old variables
# Reset variables
no_cgal
# Testing

View File

@ -74,10 +74,10 @@ have_fftw()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -91,10 +91,9 @@ have_fftw()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -109,7 +108,7 @@ have_fftw()
}
# Force reset of old variables
# Reset variables
no_fftw
# Testing

View File

@ -84,10 +84,10 @@ have_hypre()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -101,10 +101,9 @@ have_hypre()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -119,7 +118,7 @@ have_hypre()
}
# Force reset of old variables
# Reset variables
no_hypre
# Testing

View File

@ -82,10 +82,10 @@ have_kahip()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -99,10 +99,9 @@ have_kahip()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -120,7 +119,7 @@ have_kahip()
}
# Force reset of old variables
# Reset variables
no_kahip
# Testing

View File

@ -82,10 +82,10 @@ have_metis()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -99,10 +99,9 @@ have_metis()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -127,7 +126,7 @@ have_metis()
}
# Force reset of old variables
# Reset variables
no_metis
# Testing

View File

@ -83,10 +83,10 @@ have_mgridgen()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName $libName2)"
library=$(findExtLib "$libName" "$libName2")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -100,12 +100,10 @@ have_mgridgen()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib/$libName2" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName2" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| library=$(findLibrary -prefix="$prefix" -name="$libName2") \
|| {
#silent# [ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -165,7 +163,7 @@ have_mgridgen()
}
# Force reset of old variables
# Reset variables
no_mgridgen
# Testing

View File

@ -42,7 +42,7 @@ no_petsc()
}
# Reset variables
# Report
echo_petsc()
{
echo "petsc=${HAVE_PETSC:-false}"
@ -52,7 +52,7 @@ echo_petsc()
}
# Provide hint for enabling
# Hint for enabling
hint_petsc()
{
/bin/cat<<INFORMATION 1>&2
@ -101,10 +101,10 @@ have_petsc()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
# No system header, attempt discovery with pkg-config
@ -131,10 +131,9 @@ have_petsc()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -151,7 +150,7 @@ have_petsc()
}
# Force reset of old variables
# Reset variables
no_petsc
# Testing

View File

@ -70,10 +70,10 @@ have_readline()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -87,10 +87,9 @@ have_readline()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -106,7 +105,7 @@ have_readline()
}
# Force reset of old variables
# Reset variables
no_readline
# Testing

View File

@ -88,7 +88,7 @@ have_scotch()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile \
@ -110,10 +110,9 @@ have_scotch()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -230,10 +229,9 @@ have_ptscotch()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -249,7 +247,7 @@ have_ptscotch()
}
# Force reset of old variables
# Reset variables
no_scotch
# Testing

View File

@ -81,10 +81,10 @@ have_zoltan()
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$incName")
library="$(findExtLib $libName)"
library=$(findExtLib "$libName")
elif isSystem "$prefix"
then
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
header=$(findSystemInclude -name="$incName")
prefix=$(sysPrefix "$header")
else
unset prefix
@ -98,10 +98,9 @@ have_zoltan()
}
# Library
[ -n "$library" ] || library=$(findLibrary \
"$prefix/lib/$libName" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
) || {
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
@ -116,7 +115,7 @@ have_zoltan()
}
# Force reset of old variables
# Reset variables
no_zoltan
# Testing

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
@ -21,12 +21,18 @@
# isNone, isSystem, isAbsdir, hasAbsdir
# isDarwin, isWindows
# findFirstFile
# findSystemInclude
# findLibrary
# findExtLib
#
# Internal variables used
# extLibraries
#
# External variables used
# WM_OSTYPE (is set for Windows)
# WM_COMPILER_LIB_ARCH
# DEB_TARGET_MULTIARCH
#
#------------------------------------------------------------------------------
if [ -z "$WMAKE_SCRIPTS_SYSFUNCTIONS" ]
@ -34,14 +40,19 @@ then
# Load once, but do not rely on this variable elsewhere
WMAKE_SCRIPTS_SYSFUNCTIONS=loaded
# Handle Debian multi-arch, ignore missing/bad dpkg-architecture.
if [ -z "$DEB_TARGET_MULTIARCH" ]
then
DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true)
fi
# True if OS is Darwin.
isDarwin()
{
test Darwin = "$(uname -s 2>/dev/null)"
test Darwin = "$(uname -s 2>/dev/null || true)"
}
# True if target OS is Windows
# Uses cached value from libso extension
isWindows()
{
test MSwindows = "$WM_OSTYPE"
@ -58,7 +69,6 @@ then
extLibraries=".a .dll .dll.a" # including cross-compiling
fi
# True if '$1' begins with '/'
isAbsdir()
{
@ -126,27 +136,114 @@ then
return 2
}
# Check system /usr/local/include /usr/include paths
#
# On success, echoes the resolved file and returns 0, otherwise returns 2
#
# Specify -name=incName to search for
#
findSystemInclude()
{
local searchName
case "$1" in
-name=*)
searchName="${1#*=}"
;;
esac
if [ -z "$searchName" ]
then
return 1
fi
findFirstFile \
"/usr/local/include/$searchName" \
"/usr/include/$searchName" \
;
}
# Check existence of library with ending '.a', '.so' ...
#
# On success, echoes the resolved file and returns 0, otherwise returns 2
#
# This function has two modes of operation.
#
# 1) Automated search.
# Specify -prefix=dirName -name=libName and search for
# (lib, lib64, lib/x86_64..) etc.
#
# 2) Directed search.
# specify the fully qualified names to search on the parameter list
#
findLibrary()
{
local prefixDir searchDir searchName
local file ext
for file
searchDir=true
while [ "$searchDir" = true ] && [ "$#" -gt 0 ]
do
[ -n "$file" ] || continue
for ext in '' $extLibraries
do
if [ -f "$file$ext" ] && [ -r "$file$ext" ]
then
echo "$file$ext" # Found
return 0
fi
done
case "$1" in
-prefix=*)
prefixDir="${1#*=}"
shift
;;
-name=*)
searchName="${1#*=}"
shift
;;
(*)
unset searchDir
;;
esac
done
if [ -n "$searchName" ]
then
# Automated search
# Eg, lib/ lib64/, lib/x86_64-linux-gnu
: "${prefixDir:=/usr}" # A reasonable default
[ -d "$prefixDir" ] || return 2
for searchDir in \
lib \
"${WM_COMPILER_LIB_ARCH:+lib}$WM_COMPILER_LIB_ARCH" \
"${DEB_TARGET_MULTIARCH:+lib/}${DEB_TARGET_MULTIARCH}" \
;
do
for ext in '' $extLibraries
do
file="$prefixDir/$searchDir/$searchName$ext"
if [ -f "$file" ] && [ -r "$file" ]
then
echo "$file" # Found
return 0
fi
done
done
else
# Directed search
for file
do
[ -n "$file" ] || continue
for ext in '' $extLibraries
do
if [ -f "$file$ext" ] && [ -r "$file$ext" ]
then
echo "$file$ext" # Found
return 0
fi
done
done
fi
return 2
}

View File

@ -6,11 +6,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# Copyright (C) 2019 OpenCFD Ltd.
# Copyright (C) 2019-2020 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# wrap-lemon
@ -31,7 +30,7 @@
#
#------------------------------------------------------------------------------
binDir="${WMAKE_BIN:-$WM_PROJECT_DIR/wmake/platforms/$WM_ARCH$WM_COMPILER}"
binDir="${WMAKE_BIN:-$WM_PROJECT_DIR/platforms/tools/$WM_ARCH$WM_COMPILER}"
etcDir="${WM_DIR:-$WM_PROJECT_DIR/wmake}/etc"
# Executable and skeleton locations

View File

@ -1,23 +1,38 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
cd "${0%/*}" || exit # This directory (/path/project/wmake/src)
if [ -z "$WM_DIR" ] # Require WM_DIR
if [ -z "$WM_DIR" ] # Require WM_DIR (/path/project/wmake)
then
WM_DIR="$(\cd $(dirname $0)/.. && \pwd -L)"
WM_DIR="$(dirname "$(pwd -L)")"
export WM_DIR
fi
if [ -z "$WM_PROJECT_DIR" ] # Expect WM_PROJECT_DIR (/path/project)
then
echo "Warning (${0##*/}) : No WM_PROJECT_DIR set" 1>&2
WM_PROJECT_DIR="${WM_DIR%/*}"
export WM_PROJECT_DIR
fi
if [ -z "$WM_ARCH" ] || [ -z "$WM_COMPILER" ]
then
echo "Error (${0##*/}) : No WM_ARCH or WM_COMPILER set"
echo " Check your OpenFOAM environment and installation"
exit 1
fi
case "$WM_COMPILER" in
Mingw*)
# Host wmake toolchain with system gcc (when cross-compiling)
make \
WM_COMPILER=Gcc WM_COMPILER_TYPE=system \
WMAKE_BIN="${WM_DIR}/platforms/${WM_ARCH}${WM_COMPILER}"
WMAKE_BIN="${WM_PROJECT_DIR}/platforms/tools/${WM_ARCH}${WM_COMPILER}" \
"$@"
;;
*)
# Compile wmake toolchain
make
# Regular wmake toolchain
make "$@"
;;
esac

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017 OpenCFD Ltd.
# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -37,37 +37,52 @@
# lnInclude directories generated for libraries.
#
#------------------------------------------------------------------------------
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions
Script="${0##*/}" # Use 'Script' for error messages in wmakeFunctions
. "${0%/*}/scripts/wmakeFunctions" # Source wmake functions
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
printHelp() {
cat<<HELP_INFO
Usage: $Script [OPTION] [dir]
$Script [OPTION] target [dir [MakeDir]]
options:
-a | -all Same as the 'all' target
-a | -all All subdirectories, uses Allwclean, Allclean if they exist
-s | -silent Ignored - for compatibility with wmake
-help Print the usage
-h | -help Display short help and exit
-help-full Display full help and exit
Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
lnInclude directories generated for libraries.
The targets correspond to a subset of the 'wmake' special targets:
all All subdirectories, uses any Allwclean or Allclean
files if they exist
HELP_INFO
cat<<HELP_TAIL_FULL
Special targets:
all Same as -all option
exe | lib | libo | libso
Clean Make, any *.dep files and lnInclude directories
empty Remove empty sub-directories for the requested dir.
If executed in the main project directory, it will also
remove deprecated object directories and respective binaries
that refer to no-longer-existing source code.
USAGE
HELP_TAIL_FULL
exit 0 # clean exit
}
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
#------------------------------------------------------------------------------
# Parse arguments and options
#------------------------------------------------------------------------------
@ -78,16 +93,20 @@ MakeDir=Make
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
usage
-help-f*) # Full help
printHelp -full
;;
-h | -help*) # Short help
printHelp
;;
-a | -all | all)
targetType=all
;;
-s | -silent) # Ignored - for compatibility with wmake
export WM_QUIET=true
;;
-*)
usage "unknown option: '$1'"
die "unknown option: '$1'"
;;
*)
break

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2019 OpenCFD Ltd.
# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -94,19 +94,22 @@ cat<<HELP_FULL
HELP_FULL
fi
cat<<HELP_TAIL
cat<<HELP_TAIL_COMMON
-pwd Print root directory containing a Make/ directory
-version | --version Print version, which is the same as -show-api
-version | --version Print version (same as -show-api)
-h | -help Display short help and exit
-help-full Display full help and exit
A general, easy-to-use make system for multi-platform development
with support for local and network parallel compilation.
The 'target' is a Makefile target:
e.g., platforms/linux64GccDPOpt/.../fvMesh.o
HELP_TAIL_COMMON
or a special target:
if [ -n "$1" ]
then
cat<<HELP_TAIL_FULL
Makefile targets: platforms/linux64GccDPInt32Opt/.../fvMesh.o (for example)
Special targets:
all | queue Same as -all | -queue options
exe Compile statically linked executable
lib Compile statically linked archive lib (.a)
@ -116,10 +119,23 @@ or a special target:
updatedep Compile dependencies only (in case of broken dependencies)
objects Compile but not link
HELP_TAIL
exit 1
Environment
FOAM_EXTRA_CXXFLAGS
HELP_TAIL_FULL
else
cat<<HELP_TAIL_BRIEF
Some special targets (see -help-full for details):
all | queue Same as -all | -queue options
exe Executables
lib libo libso Libraries
HELP_TAIL_BRIEF
fi
exit 0 # clean exit
}
# Report error and exit
die()
{