Compare commits

...

77 Commits

Author SHA1 Message Date
8d37a8dd2c COMP: g++11: suppress optimisation. See #3024 2024-01-19 21:00:52 +01:00
d07c576d42 BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-31 09:41:11 +02:00
00ebd4c2ef BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:39:23 +02:00
ca3ff906ea Revert "BUG: Fixing ray dAve and omega for 1D and 2D cases"
This reverts commit 5848b0afd5.
2023-06-20 09:36:32 +02:00
a248f9c190 BUG: VTK write pointSet fails in parallel (fixes #2773)
- de-referenced autoPtr with () instead of ref() will fail on
  non-master ranks.
2023-05-05 16:00:08 +02:00
710c44b3d8 COMP: code adjustments for gcc-13 (#2714) 2023-02-28 16:27:22 +01:00
93704f9fe4 CONFIG: improve handling of empty/non-empty ThirdParty directory 2022-08-18 13:50:02 +02:00
aefd907333 CONFIG: foamConfigurePaths support for sys-openmpi major version 2022-08-18 13:50:02 +02:00
aab61cc6b3 CONFIG: accept module-prefix 'none' as equivalent to 'false' (ie, disabled) 2022-08-18 13:50:02 +02:00
53e91f12db BUG: incorrect order for output scaling (transformPoints, ...)
- the output write scaling should be applied *after* undoing the
  effects of the specified rotation centre. Fixes #2566

ENH: update option names for transformPoints and surfaceTransformPoints

- prefer  '-auto-centre' and '-centre', but also accept the previous
  options '-auto-origin' and '-origin' as aliases.

  Changing to '-centre' avoids possible confusion with
  coordinate system origin().
2022-08-18 13:50:02 +02:00
8accf0cb60 CONFIG: bump patch level 2022-06-24 15:31:58 +02:00
f8e4715e53 COMP: Gcc 11+ potential fix - see #2434 2022-06-24 15:31:58 +02:00
952d3b200b COMP: references to temporaries
COMP: include <limits>
2022-06-24 15:31:58 +02:00
fecd2c115a COMP: gcc-12 buffer check bypasses xsputn (#2481, #2496)
- add overflow() method to the SHA1 streambuf. Previously could rely
  on xsputn for adding to sha1 content, but streams now check pptr()
  first to test for the buffering range and thus overflow() is needed.
2022-06-24 15:31:58 +02:00
07ccd80afd BUG: sample/store surface field triggers dimension check (fixes #2361)
- when used for example with wallShearStress, the stress field is
  initially created as incompressible but later updated with the
  correct compressible/incompressible dimensions.

  If this field is sampled as a surface and stored on the registry
  the dimensions should be reset() and not '=' assigned, since that
  causes a dimension check which will obviously fail.
2022-02-11 14:36:12 +01:00
6168f960f5 BUG: error with empty distributed roots specification (fixes #2196) 2021-09-08 10:26:48 +02:00
95cb2b97dd BUG: ParticleCollector - corrected and simplified parallel reductions. See #2184 2021-09-07 12:02:39 +02:00
06aa5287c9 BUG: Curle - added missing division by r. See #2169 2021-09-07 12:02:39 +02:00
d9bc7c09f5 BUG: boundaryData output incorrect when no fields are sampled (fixes #2163)
- add "point data" or "face data" note to the boundaryData output
  for easier diagnositics in the future.
2021-07-20 17:07:32 +02:00
78ecaa894e BUG: noise did not set num of output fields (VTK legacy) [fixes #2133] 2021-06-25 10:45:36 +02:00
ae871dc674 BUG: liquidProperties - corrected read scalar (was label). See #2142 2021-06-25 10:44:23 +02:00
8fc44faf89 COMP: sign check to avoid warnings about new[] range 2021-04-27 11:10:23 +02:00
be30a080a3 CONFIG: bump patch level 2021-04-14 20:10:54 +02:00
20b2bfe829 BACKPORT: installation helpers from v2012
BACKPORT: AllwmakeParseArguments prefix handling from v2012
2021-04-14 20:00:00 +02:00
1d66a004df BUG: generic point patch fails (fixes #2062)
- the generic constructor could be called twice in pointPatchField::New,
  which results in an attempt to transfer tokens twice.
2021-04-14 19:40:22 +02:00
6f2ac4cab1 BUG: Curle FO - corrected division by 4pi. Fixes #2035 2021-04-14 19:38:53 +02:00
5f5903ce0f BUG: AABBTree - corrected addressing. Fixes #2028 2021-04-14 19:38:46 +02:00
7b9c36ac24 BUG: cannot set expression from command-line (fixes #2012) 2021-02-25 08:32:59 +01:00
10d53ff29e BUG: foamToEnsight cellZones missing mesh coverage (closes #2002) 2021-02-15 13:14:55 +01:00
cd7ce0a4c4 CONFIG: ensure PV_PLUGIN_PATH is also in the library path 2021-02-15 13:14:25 +01:00
eb31863d2c BUG: surfaceFieldValue fails writing legacy VTK format
- number of fields was not set.
- interpolated surfaces incorrectly written for all formats
2021-01-22 16:26:43 +01:00
d596ec6d49 COMP: bad template for foamNewFunctionObject (closes #1987) 2021-01-22 16:26:34 +01:00
713c18b654 BUG: incorrect returned size from surfaceWriter 2021-01-13 18:52:34 +01:00
cfde0d679a Merge branch 'bug-1949-globalSum-in-derivative-of-merit-function' into 'master'
BUG: globalSum needed in the merit functions' directional derivative (fixes #1949)

Closes #1949

See merge request Development/openfoam!403
2020-12-11 17:39:00 +00:00
7ffa36dfa9 BUG: globalSum needed in the merit functions' directional derivative (fixes #1949)
Does not affect the current functionality of shape optimisation.
2020-12-11 17:38:22 +00:00
5d3f355d9d Merge branch 'bug-1948-wrong-first-merit-function-value' into 'master'
BUG: Wrong First extrapolated value of the merit function (fixes #1948)

Closes #1948

See merge request Development/openfoam!402
2020-12-11 17:37:35 +00:00
2eae536a70 BUG: Wrong First extrapolated value of the merit function (fixes #1948)
Affected only the first optimisation cycle, if line search was enabled

If eta was not set explicitly, it was computed after evaluating the
directional derivative of the merit function, which was computed
wrongly, leading to an erroneous value of the extrapolated merit
function value.
2020-12-11 17:37:18 +00:00
d119b8b8f9 Merge branch 'bug-1947-writing-control-points-in-collatedFormat' into 'master'
BUG: collated format and writing of NURBS3DVolume CPs - see #1947

See merge request Development/openfoam!401
2020-12-11 17:32:51 +00:00
3b949b66ff BUG: collated format and writing of NURBS3DVolume CPs - see #1947
The if(Pstream::master()) clause in NURBS3DVolume::writeCpsInDict() was
causing the fileName of the regIOobject not to be allocated in all
processors, giving problems when masterUncollatedFileOperation::masterOp
was called by collatedFileOperation::writeObject for the mkDirOp.
2020-12-07 16:41:26 +02:00
ac98e498fe BUG: meshToMesh - corrected mapping of internal field for tgt->src mapping. Fixes #1935 2020-11-24 12:01:15 +00:00
da7165077c BUG: typo in solidProperties prevents re-reading of "Hf" (fixes #1927) 2020-11-18 19:38:55 +01:00
fc541cee40 BUG: crash during gap refinement (fixes #1919)
- fixed indexing error (crashes under windows).
  No crash but still incorrect on other systems
2020-11-13 11:00:13 +01:00
5e660c36e9 CONFIG: ptscotch header not found on RedHat/Fedora (fixes #1904)
- no limit to the number of ways of filing ptscotch libraries.
  RedHat/Fedora/CentOS should look for these directories:

      ptscotch include=/usr/include/openmpi-x86_64
      ptscotch library=/usr/lib64/openmpi/lib

  when MPI_ARCH_PATH=/usr/lib64/openmpi
  and mpicc --showme:compile yields -I/usr/include/openmpi-x86_64
2020-11-04 15:22:44 +01:00
bed1305d96 BUG: extraneous brackets after Fluent cell types (fixes #1872)
ENH: limit output to 25 cell types per line for readability

- makes it easier to trace potential format errors etc

STYLE: downgrade warning about polyhedrals to a simple info message

- can assume that polyhedral support is widespread enough to not
  warrant a warning.
2020-10-29 11:21:39 +01:00
9dc4f76b03 BUG: incorrect boundary type for expressions variables (fixes #1889)
- had calculated boundaries (default) for the evaluated variables,
  which meant they retained their initialized values (usually Zero).

  This normally goes unnoticed, since the boundary values are largely
  irrelevant in the volField expressions. However, when applying
  functions that balk at a zero value - eg, log() - this raises a
  floating point exception.

  These boundary should be zeroGradient, since the evaluated variables
  correspond to the internalField only. Could continue to use
  calculated, but then need to set the calculated boundary values from
  the patch internal field manually.
2020-10-23 11:03:05 +02:00
3e4d9e15c0 BUG: using FatalIOErrorInLookup with incorrect exit type (fixes #1898)
- two occurrences where FatalIOErrorInLookup used exit(FatalError)
  instead of exit(FatalIOError), which caused the error messages
  to be lost.
2020-10-23 09:31:02 +02:00
3186bd87de BUG: regionToFace: does not stop walking. Fixes #1882
Problem was initial value of zone (transported label) was
still 0. Fixed by properly checking for 'valid' state.
2020-10-15 09:41:21 +01:00
295eef471d CONFIG: increment patch level 2020-10-12 11:17:59 +02:00
6ecb4b69b1 SUBMODULE: update for bugfixes, compilation (external-solver, OpenQBMM) 2020-10-12 11:17:48 +02:00
bea6563210 CONFIG: ptscotch header not found on ArchLinux (fixes #1877)
- on ArchLinux, everything is installed under /usr/include/scotch.

  The detection script uses SCOTCH_ARCH_PATH as an initial guess for
  ptscotch as well. However, on the second pass, it has an absolute
  value ("/usr") instead of a logical one ("scotch-system").
  This resulted in the logic for handling scotch+ptscotch subdirs
  being bypassed.
2020-10-12 10:34:49 +02:00
c1ad429564 BUG: parallel foamToEnsight fails depending on lagrangian order (fixes #1873)
- the problem arises when output fields are missing on some
  processors.

  When the information is combined, the resulting HashTables can have
  different insertion orders. This poses an issue when there are hash
  key collisions and thus different chaining.

- Use sorted order.
2020-10-08 18:23:54 +02:00
3b3cffc758 BUG: mapPolyMesh: incorrect addressing. Fixes #1864
Triggered when running e.g. postProcess
2020-09-30 11:44:25 +01:00
cbc0da8a60 CONFIG: increment patch level 2020-09-24 13:46:35 +02:00
d22134ed12 BUG: unexpected treatment of missing fractionExpr (fixes #1858)
- specifying gradientExpr without a valueExpr, a missing fractionExpr
  should be treated as 0 (gradient only), not as 1 (value only)

ENH: improve sanity checks + evaluation short-cuts in exprMixedFvPatchField
2020-09-24 13:46:32 +02:00
1550a12223 BUG: fractionExpr "0" ignored (fixes #1855)
- incorrect branching logic caused the "0" case to be ignored
2020-09-24 11:59:17 +02:00
52e0ebca57 ENH: gradingDescriptor(s) correct() and normalise() methods
- single entry point to handle negative expansions etc.
  Reduces typos and forgotten code (as per #1841)
2020-09-16 09:47:08 +02:00
9762b547fe BUG: gradingDescriptor stream input ignores negative expansion (Fix #1841)
- mostly only tripped when using fractional edge grading, since this
  is where the list reading is used. Overseen in commit 7da0b5bee1.
2020-09-16 09:25:28 +02:00
73057447a2 COMP: pass-through targetType for a few Allwmake files (#1824) 2020-09-03 11:35:18 +02:00
4735776246 COMP: pass shell args for Allwmake-mpi (#1824) 2020-09-03 10:15:12 +02:00
719d3f77be COMP: Intel compiler bug with inheriting constructors (fixes #1821)
- the compiler reports

      Internal error loop: assertion failed:
      find_seq_in_lookup_table: seq_number not found
      (shared/cfe/edgcpfe/il.c, line 4118)

  Seems to be the same as the bug report
  https://community.intel.com/t5/Intel-C-Compiler/Internal-error-loop-assertion-failed-find-seq-in-lookup-table/td-p/1087603

This _should_ be fixed in icc 17.0 update 1, but appears to have
struck here as well.

- workaround: explicitly construct member elements.
2020-09-01 11:49:27 +02:00
8d55c37b2f BUG: missing tab in actuationDiskSource output (fixes #1819) 2020-08-31 15:17:54 +02:00
fa364eda12 BUG: inconsistency between constructor and output (fixes #1816)
- slipped in with changes to csvTableReader (commit 59ed3ba18d) so
  only affects the 2006 version.

- adjust constructor to expect "componentColumns", but also accept
  "valueColumns" as 1912 and earlier-compatibility. This not only
  fixes the reported bug, but also ensure proper compatibility with
  older files.

ENH: use "refColumn" instead of "timeColumn" for csvTableReader

- consistent with the CSV Function1.
  Support 'timeColumn' as 1912 and earlier-compatibility.

TUT: remove unused table-reader entry
2020-08-31 15:17:32 +02:00
dd1c2edb6b COMP: wmake findObjectDir fails for non-project directories (fixes #1807)
- experienced while reusing src/Pstream/Allwmake-mpi to create
  additional mpi-layers after installation. Since the copied sources
  are not located within the OpenFOAM source-tree (and/or the
  source-tree is non-writable), it should not and does not use the
  central build/WM_OPTIONS directory.

  However, when exploring for the appropriate local Make directory, it
  searched for the current '.' directory instead of checking for the
  resolved directory.

  This fails, since there is no src/Pstream/Make directory.
  Must check for src/Pstream/mpi/Make directory first!

- Adjust wclean to always remove a local build directory
  (Make/WM_OPTIONS) for additional safety.
  After which, attempt to remove central build/WM_OPTIONS version too.
2020-08-12 12:33:34 +02:00
583905fdeb BUG: directory information spoils "wmake -show-cxx" (fixes #1799)
- the various information queries MUST be executed with
  the '--no-print-directory' or risk polluting values
  in the information queries.

  This is mostly seen with the 'canCompile' test for tutorials running
  in parallel.
2020-08-06 17:52:02 +02:00
6461eec886 CONFIG: increment patch level 2020-07-27 10:28:44 +02:00
3455d556c4 BUG: potential memory leaks in HashPtrTable::set (#1787)
- backported fix from develop

COMP: incorrect variable names in PtrListOpsTemplates.C
2020-07-27 10:28:40 +02:00
540589fc22 SUBMODULE: visualization installation prefix on older ubuntu (#1757) 2020-07-27 09:58:24 +02:00
c411c0cc09 SUBMODULE: adios (style), external-solver (bugfix), visualization (style) 2020-07-23 18:12:06 +02:00
e8b06ac222 STYLE: remove incorrect branch condition in setExprFields 2020-07-23 16:52:15 +02:00
dc6c3c8add TUT: Correction for Alltest 2020-07-20 10:19:54 +01:00
fa86a98482 BUG: Minor correction to lumpedPointState.C for debug build 2020-07-17 14:09:34 +01:00
5dc04530d9 COMP: additional linkage libraries for AMD compiler (#1627) 2020-07-14 12:17:09 +02:00
a86860430a BUG: checkMesh: index into surfaceScalarField. Fixes #1771. 2020-07-13 13:02:07 +01:00
9b78472e06 DOC: Updated header doc - see #1756 2020-07-02 09:17:48 +01:00
6d965d699b BUG: mergeOrSplitBaffles -dict option ignored (fixes #1759)
- regression from f721b5344f
2020-07-01 18:41:31 +02:00
0b41521d98 CONFIG: avoid triggering dash expansion bug (fixes #1757)
- use long form to avoid dash 0.5.8 error (ubuntu bionic)

- consolidate the prefix handling into modules/Allwmake
2020-07-01 16:20:13 +02:00
968ce0290d DOC: Corrected header documentation - see #1756 2020-07-01 14:59:11 +01:00
106 changed files with 2322 additions and 797 deletions

View File

@ -73,25 +73,13 @@ echo
applications/Allwmake $targetType $*
# Additional components/modules
if [ "$FOAM_MODULE_PREFIX" = false ]
if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ]
then
echo "========================================"
echo "OpenFOAM modules disabled (prefix=false)"
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
echo
elif [ -d "$WM_PROJECT_DIR/modules" ]
then
echo "========================================"
echo "Compile OpenFOAM modules"
echo " ignoring possible compilation errors"
echo " make certain to check the output file"
echo
set +e
export WM_CONTINUE_ON_ERROR=true
# Default build into OpenFOAM project locations
: "${FOAM_MODULE_PREFIX:=${FOAM_LIBBIN%/*}}"
export FOAM_MODULE_PREFIX
(cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all)
fi

View File

@ -1,2 +1,2 @@
api=2006
patch=0
patch=220610

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.
@ -62,13 +63,13 @@ void Foam::fluentFvMesh::writeFluentMesh() const
/ time().caseName() + ".msh"
);
Info<< "Writing Header" << endl;
Info<< "Writing Fluent Mesh" << endl;
fluentMeshFile
<< "(0 \"FOAM to Fluent Mesh File\")" << std::endl << std::endl
<< "(0 \"Dimension:\")" << std::endl
<< "(2 3)" << std::endl << std::endl
<< "(0 \"Grid dimensions:\")" << std::endl;
<< "(0 \"OpenFOAM to Fluent Mesh File\")" << nl << nl
<< "(0 \"Dimension:\")" << nl
<< "(2 3)" << nl << nl
<< "(0 \"Grid dimensions:\")" << nl;
// Writing number of points
fluentMeshFile
@ -217,8 +218,8 @@ void Foam::fluentFvMesh::writeFluentMesh() const
// Writing cells
fluentMeshFile
<< "(12 (1 1 "
<< nCells() << " 1 0)(" << std::endl;
<< "(12 (1 1 " << nCells() << " 1 0)" << nl
<< '(';
const cellModel& hex = cellModel::ref(cellModel::HEX);
const cellModel& prism = cellModel::ref(cellModel::PRISM);
@ -227,44 +228,59 @@ void Foam::fluentFvMesh::writeFluentMesh() const
const cellShapeList& cells = cellShapes();
bool hasWarned = false;
label nPolys = 0;
int nElemPerLine = 25; // Start with linebreak and indent
forAll(cells, celli)
{
if (nElemPerLine == 25)
{
// 25 elements per line with initial indent (readability)
fluentMeshFile << "\n ";
nElemPerLine = 0;
}
else if (!(nElemPerLine % 5))
{
// Format in blocks of 5 (readability)
fluentMeshFile << token::SPACE;
}
fluentMeshFile << token::SPACE;
++nElemPerLine;
if (cells[celli].model() == tet)
{
fluentMeshFile << " " << 2;
fluentMeshFile << 2;
}
else if (cells[celli].model() == hex)
{
fluentMeshFile << " " << 4;
fluentMeshFile << 4;
}
else if (cells[celli].model() == pyr)
{
fluentMeshFile << " " << 5;
fluentMeshFile << 5;
}
else if (cells[celli].model() == prism)
{
fluentMeshFile << " " << 6;
fluentMeshFile << 6;
}
else
{
if (!hasWarned)
{
hasWarned = true;
WarningInFunction
<< "foamMeshToFluent: cell shape for cell "
<< celli << " only supported by Fluent polyhedral meshes."
<< nl
<< " Suppressing any further messages for polyhedral"
<< " cells." << endl;
}
fluentMeshFile << " " << 7;
fluentMeshFile << 7;
++nPolys;
}
}
fluentMeshFile << ")())" << std::endl;
fluentMeshFile
<< nl << "))" << nl;
if (nPolys)
{
Info<< "Mesh had " << nPolys << " polyhedrals." << endl;
}
// Return to dec
fluentMeshFile.setf(ios::dec, ios::basefield);

View File

@ -26,6 +26,8 @@ EXE_INC = \
EXE_LIBS = \
${CGAL_LIBS} \
-lconformalVoronoiMesh \
-lfileFormats \
-lsurfMesh \
-lmeshTools \
-ldecompositionMethods \
-ldecompose \

View File

@ -616,6 +616,17 @@ void Foam::writeFields
}
if (selectedFields.found("faceZone"))
{
// Determine for each face the zone index (scalar for ease of
// manipulation)
scalarField zoneID(mesh.nFaces(), -1);
const faceZoneMesh& czs = mesh.faceZones();
for (const auto& zone : czs)
{
UIndirectList<scalar>(zoneID, zone) = zone.index();
}
// Split into internal and boundary values
surfaceScalarField faceZone
(
IOobject
@ -632,10 +643,13 @@ void Foam::writeFields
calculatedFvsPatchScalarField::typeName
);
const faceZoneMesh& czs = mesh.faceZones();
for (const auto& zone : czs)
faceZone.primitiveFieldRef() =
SubField<scalar>(zoneID, mesh.nInternalFaces());
surfaceScalarField::Boundary& bfld = faceZone.boundaryFieldRef();
for (auto& pfld : bfld)
{
UIndirectList<scalar>(faceZone, zone) = zone.index();
const fvPatch& fvp = pfld.patch();
pfld == SubField<scalar>(zoneID, fvp.size(), fvp.start());
}
//faceZone.correctBoundaryConditions();

View File

@ -286,7 +286,7 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::addBoolOption
argList::addOption
(
"dict",
"file",

View File

@ -169,14 +169,22 @@ int main(int argc, char *argv[])
(
"translate",
"vector",
"Translate by specified <vector> - eg, '(1 0 0)' before rotations"
"Translate by specified <vector> before rotations"
);
argList::addBoolOption
(
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -290,18 +298,24 @@ int main(int argc, char *argv[])
if (args.readIfPresent("translate", v))
{
Info<< "Translating points by " << v << endl;
points += v;
}
vector origin;
const bool useOrigin = args.readIfPresent("origin", origin);
if (useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useRotationCentre)
{
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
if (args.found("rotate"))
{
Pair<vector> n1n2
@ -380,6 +394,13 @@ int main(int argc, char *argv[])
}
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
List<scalar> scaling;
if (args.readListIfPresent("scale", scaling))
{
@ -410,12 +431,6 @@ int main(int argc, char *argv[])
}
}
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));

View File

@ -67,10 +67,10 @@ if (doLagrangian)
}
}
forAllConstIters(theseCloudFields, fieldIter)
// Field order may differ on individual processors, so sort by name
for (const word& fieldName : theseCloudFields.sortedToc())
{
const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter.val();
const word& fieldType = theseCloudFields[fieldName];
IOobject fieldObject
(
@ -88,9 +88,13 @@ if (doLagrangian)
// but that combination does not work.
// So check the header and sync globally
const bool parRun = Pstream::parRun();
Pstream::parRun() = false;
fieldExists =
fieldObject.typeHeaderOk<IOField<scalar>>(false);
Pstream::parRun() = parRun;
reduce(fieldExists, orOp<bool>());
}

View File

@ -675,7 +675,7 @@ int main(int argc, char *argv[])
{
for
(
const word& opt
const char * const opt
: { "cellSet", "cellZone", "faceSet", "pointSet" }
)
{

View File

@ -6,5 +6,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lfileFormats \
-lmeshTools \
-llumpedPointMotion

View File

@ -6,5 +6,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lfileFormats \
-lmeshTools \
-llumpedPointMotion

View File

@ -5,6 +5,6 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wmake $targetType pdrFields
wmake PDRsetFields
wmake $targetType PDRsetFields
#------------------------------------------------------------------------------

View File

@ -69,13 +69,12 @@ Foam::implicitFunctions::cylinderImplicitFunction::cylinderImplicitFunction
const dictionary& dict
)
:
cylinderImplicitFunction
(
dict.get<point>("origin"),
dict.get<scalar>("radius"),
dict.getOrDefault<scalar>("scale", 1),
dict.get<vector>("direction")
)
// __INTEL_COMPILER bug with inheriting constructors?? (issue #1821)
origin_(dict.get<point>("origin")),
radius_(dict.get<scalar>("radius")),
scale_(dict.getOrDefault<scalar>("scale", 1)),
direction_(dict.get<vector>("direction").normalise()),
project_(tensor::I - direction_*direction_) // outer product
{}

View File

@ -72,15 +72,13 @@ Foam::implicitFunctions::sinImplicitFunction::sinImplicitFunction
const dictionary& dict
)
:
sinImplicitFunction
(
dict.get<scalar>("period"),
dict.getOrDefault<scalar>("phase", 0),
dict.get<scalar>("amplitude"),
dict.get<vector>("direction"),
dict.get<vector>("up"),
dict.get<vector>("origin")
)
// __INTEL_COMPILER bug with inheriting constructors?? (issue #1821)
period_(dict.get<scalar>("period")),
phase_(dict.getOrDefault<scalar>("phase", 0)),
amplitude_(dict.get<scalar>("amplitude")),
up_(dict.get<vector>("up").normalise()),
direction_(dict.get<vector>("direction").normalise()),
origin_(dict.get<vector>("origin"))
{}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -771,7 +771,7 @@ int main(int argc, char *argv[])
expressions::exprString
expression
(
args[expression],
args["expression"],
dictionary::null
);
@ -898,7 +898,7 @@ int main(int argc, char *argv[])
);
}
}
else if (exprDictPtr.valid())
else
{
FatalErrorInFunction
<< "No command-line or dictionary??" << nl << endl

View File

@ -92,7 +92,7 @@ bool setCellFieldType
fieldType field(fieldHeader, mesh, false);
const Type& value = pTraits<Type>(fieldValueStream);
const Type value = pTraits<Type>(fieldValueStream);
if (selectedCells.size() == field.size())
{
@ -244,7 +244,7 @@ bool setFaceFieldType
fieldType field(fieldHeader, mesh);
const Type& value = pTraits<Type>(fieldValueStream);
const Type value = pTraits<Type>(fieldValueStream);
// Create flat list of selected faces and their value.
Field<Type> allBoundaryValues(mesh.nBoundaryFaces());

View File

@ -112,12 +112,20 @@ int main(int argc, char *argv[])
"vector",
"Translate by specified <vector> - eg, '(1 0 0)' before rotations"
);
argList::addBoolOption
(
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -229,18 +237,24 @@ int main(int argc, char *argv[])
if (args.readIfPresent("translate", v))
{
Info<< "Translating points by " << v << endl;
points += v;
}
vector origin(Zero);
const bool useOrigin = args.readIfPresent("origin", origin);
if (useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useRotationCentre)
{
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
if (args.found("rotate"))
{
Pair<vector> n1n2
@ -299,6 +313,13 @@ int main(int argc, char *argv[])
points = transform(rot, points);
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
List<scalar> scaling;
if (args.readListIfPresent("scale", scaling))
{
@ -338,11 +359,6 @@ int main(int argc, char *argv[])
}
}
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
surf1.movePoints(points);
surf1.write(exportName, writeFileType);

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -140,8 +140,8 @@ do
esac
else
echo "Ignore bad/invalid plugin-path: $pluginPath" 1>&2
unset pluginPath
fi
unset pluginPath
;;
-block*) # Silently accepts -blockMesh
@ -238,8 +238,11 @@ then
;;
esac
if [ -n "$pluginError" ]
if [ -z "$pluginError" ]
then
# Ensure plugin is also in the lib-path
LD_LIBRARY_PATH="${PV_PLUGIN_PATH}:$LD_LIBRARY_PATH"
else
cat<< NO_PLUGIN 1>&2
$pluginError
See '${0##*/} -help-build' for more information

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -55,6 +55,8 @@ Equivalent options:
-scotch-path --scotchArchPath | -scotchArchPath
-system-compiler -system
-third-compiler -third
-openmpi-system -sys-openmpi
-openmpi-third -openmpi
HELP_COMPAT
exit 0 # A clean exit
@ -89,10 +91,9 @@ Compiler
mpc-VERSION For ThirdParty gcc (mpc-system for system library)
MPI
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc)
-openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI'
-openmpi-system use system openmpi
-openmpi-third use ThirdParty openmpi (using default version)
-mpi=NAME Specify 'WM_MPLIB' type (eg, INTELMPI, etc)
-openmpi[=VER] Use ThirdParty openmpi, with version for 'FOAM_MPI'
-sys-openmpi[=MAJ] Use system openmpi, with specified major version
Components versions (ThirdParty)
-adios VER specify 'adios2_version'
@ -212,12 +213,13 @@ _inlineSed()
# Local filename (for reporting)
localFile="$(echo "$file" | sed -e "s#^$projectDir/##")"
grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || { \
if grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file"
then
[ -n "$msg" ] && echo " $msg ($localFile)"
else
echo "Failed: ${msg:-replacement} in $localFile"
return 1
}
[ -n "$msg" ] && echo " $msg ($localFile)"
fi
return 0
}
@ -278,8 +280,8 @@ replaceEtc()
local file="$1"
shift
file=$(_foamEtc "$file")
replace $file "$@"
file="$(_foamEtc "$file")"
replace "$file" "$@"
}
@ -289,24 +291,36 @@ replaceEtcCsh()
local file="$1"
shift
file=$(_foamEtc "$file")
replaceCsh $file "$@"
file="$(_foamEtc "$file")"
replaceCsh "$file" "$@"
}
# Get the option's value (argument), or die on missing or empty argument
# $1 option
# $2 value
# Returns values via optValue, nOptArgs variables!!
optValue=""
nOptArgs=0 # The number of args to shift
getOptionValue()
{
local value="$2"
[ -n "$value" ] || die "'$1' option requires an argument"
optValue="${1#*=}"
if [ "$optValue" = "$1" ]
then
# Eg, -option value
optValue="$2"
[ -n "$optValue" ] || die "'$1' option requires an argument"
nOptArgs=1
else
# Eg, -option=value
nOptArgs=0
fi
# Remove any surrounding double quotes
value="${value%\"}"
value="${value#\"}"
echo "$value"
optValue="${optValue%\"}"
optValue="${optValue#\"}"
}
@ -366,7 +380,7 @@ removeCshMagic()
#------------------------------------------------------------------------------
unset adjusted optMpi
unset adjusted
# Parse options
while [ "$#" -gt 0 ]
do
@ -420,26 +434,37 @@ CONFIG_CSH
export FOAM_CONFIG_ETC="${1#*=}"
;;
-project-path)
-project-path=* | -project-path)
# Replace WM_PROJECT_DIR=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc WM_PROJECT_DIR "\"$optionValue\""
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optionValue\""
getOptionValue "$@"
shift "${nOptArgs:-0}"
removeBashMagic $(_foamEtc bashrc)
removeCshMagic $(_foamEtc cshrc)
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_PROJECT_DIR "\"$optValue\""
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optValue\""
adjusted=true
shift
removeBashMagic "$(_foamEtc bashrc)"
removeCshMagic "$(_foamEtc cshrc)"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-version | -foamVersion | --projectVersion)
-version=* | -version | -foamVersion | --projectVersion)
# Replace WM_PROJECT_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc WM_PROJECT_VERSION "$optionValue"
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_PROJECT_VERSION "$optValue"
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-sp | -SP | -float32)
@ -465,131 +490,168 @@ CONFIG_CSH
-int32 | -int64)
# Replace WM_LABEL_SIZE=...
optionValue="${1#-int}"
replaceEtc bashrc WM_LABEL_SIZE "$optionValue"
replaceEtcCsh cshrc WM_LABEL_SIZE "$optionValue"
optValue="${1#-int}"
replaceEtc bashrc WM_LABEL_SIZE "$optValue"
replaceEtcCsh cshrc WM_LABEL_SIZE "$optValue"
adjusted=true
;;
## Compiler ##
-clang)
-clang=* | -clang)
# Replace default_clang_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/compiler default_clang_version "$optionValue"
replaceEtc config.csh/compiler default_clang_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/compiler default_clang_version "$optValue"
replaceEtc config.csh/compiler default_clang_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-gcc)
-gcc=* | -gcc)
# Replace default_gcc_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/compiler default_gcc_version "$optionValue"
replaceEtc config.csh/compiler default_gcc_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/compiler default_gcc_version "$optValue"
replaceEtc config.csh/compiler default_gcc_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-system-compiler | -system)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optionValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-third-compiler | -third | -ThirdParty)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optionValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
gmp-[4-9]* | gmp-system)
# gcc-related package
replaceEtc config.sh/compiler default_gmp_version "$1"
replaceEtc config.csh/compiler default_gmp_version "$1"
optValue="${1#-}"
replaceEtc config.sh/compiler default_gmp_version "$optValue"
replaceEtc config.csh/compiler default_gmp_version "$optValue"
adjusted=true
;;
mpfr-[2-9]* | mpfr-system)
# gcc-related package
replaceEtc config.sh/compiler default_mpfr_version "$1"
replaceEtc config.csh/compiler default_mpfr_version "$1"
optValue="${1#-}"
replaceEtc config.sh/compiler default_mpfr_version "$optValue"
replaceEtc config.csh/compiler default_mpfr_version "$optValue"
adjusted=true
;;
mpc-[0-9]* | mpc-system)
# gcc-related package
replaceEtc config.sh/compiler default_mpc_version "$1"
replaceEtc config.csh/compiler default_mpc_version "$1"
optValue="${1#-}"
replaceEtc config.sh/compiler default_mpc_version "$optValue"
replaceEtc config.csh/compiler default_mpc_version "$optValue"
adjusted=true
;;
## MPI ##
-mpi)
-mpi=* | -mpi)
# Explicitly set WM_MPLIB=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc WM_MPLIB "$optionValue"
replaceEtcCsh cshrc WM_MPLIB "$optionValue"
optMpi=system
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_MPLIB "$optValue"
replaceEtcCsh cshrc WM_MPLIB "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-openmpi)
# Replace FOAM_MPI=openmpi-<digits>.. and set to use third-party
# The edit is slightly fragile, but works
expected="openmpi-[1-9][.0-9]*"
optMpi=$(getOptionValue "$@")
_matches "$optMpi" "$expected" || \
die "'$1' has bad value: '$optMpi'"
_inlineSed $(_foamEtc config.sh/mpi) \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optMpi" \
"Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optMpi'"
_inlineSed $(_foamEtc config.csh/mpi) \
"FOAM_MPI $expected" \
"FOAM_MPI $optMpi" \
"Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optMpi'"
replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI
adjusted=true
shift
;;
-openmpi-system)
-sys-openmpi=* | -sys-openmpi | -openmpi-system)
optValue="$(echo "$1" | sed -ne 's/^.*mpi=\([1-9][0-9]*\).*/\1/p')"
# Explicitly set WM_MPLIB=SYSTEMOPENMPI
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI
optMpi=system
adjusted=true
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI"$optValue"
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI"$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-openmpi-third)
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi
-openmpi=* | -openmpi | -openmpi-third)
# Explicitly set WM_MPLIB=OPENMPI
# - use default setting for openmpi, or
# replace FOAM_MPI=openmpi-<digits>..
# The edit is slightly fragile, but works
expected="openmpi-[1-9][.0-9]*"
optValue="$(echo "$1" | sed -ne 's/^.*mpi=//p')"
if [ -n "$optValue" ]
then
if [ "${optValue#openmpi-}" = "$optValue" ]
then
optValue="openmpi-$optValue"
fi
_matches "$optValue" "$expected" || \
die "'${1%=*}' has bad value: '$optValue'"
_inlineSed "$(_foamEtc config.sh/mpi)" \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optValue" \
"Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optValue'"
_inlineSed "$(_foamEtc config.csh/mpi)" \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optValue" \
"Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optValue'"
fi
replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI
optMpi=third
adjusted=true
;;
@ -598,146 +660,242 @@ CONFIG_CSH
-adios | -adios2)
# Replace adios2_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/adios2 adios2_version "$optionValue"
replaceEtc config.csh/adios2 adios2_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/adios2 adios2_version "$optValue"
replaceEtc config.csh/adios2 adios2_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-adios-path | -adios2-path)
# Replace ADIOS2_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optValue\""
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-boost)
# Replace boost_version=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" boost_version "$optionValue"
replaceEtc config.csh/"$cfgName" boost_version "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" boost_version "$optValue"
replaceEtc config.csh/"$cfgName" boost_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-boost-path)
# Replace BOOST_ARCH_PATH=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\""
replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cgal)
# Replace cgal_version=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" cgal_version "$optionValue"
replaceEtc config.csh/"$cfgName" cgal_version "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" cgal_version "$optValue"
replaceEtc config.csh/"$cfgName" cgal_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cgal-path)
# Replace CGAL_ARCH_PATH=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optionValue"
replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optValue"
replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-fftw)
# Replace fftw_version=...
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
# config.sh/fftw or config.sh/FFTW
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
replaceEtc config.sh/"$cfgName" fftw_version "$optionValue"
replaceEtc config.csh/"$cfgName" fftw_version "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" fftw_version "$optValue"
replaceEtc config.csh/"$cfgName" fftw_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-fftw-path)
# Replace FFTW_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
# config.sh/fftw or config.sh/FFTW
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\""
replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\""
replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cmake)
# Replace cmake_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/cmake cmake_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/cmake cmake_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cmake-path)
# Replace CMAKE_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-kahip)
# Replace KAHIP_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/kahip KAHIP_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/kahip KAHIP_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-kahip-path)
# Replace KAHIP_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-metis)
# Replace METIS_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/metis METIS_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/metis METIS_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-metis-path)
# Replace METIS_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-scotch | -scotchVersion | --scotchVersion)
# Replace SCOTCH_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/scotch SCOTCH_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/scotch SCOTCH_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-scotch-path | -scotchArchPath | --scotchArchPath)
# Replace SCOTCH_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
@ -746,107 +904,156 @@ CONFIG_CSH
-paraview | -paraviewVersion | --paraviewVersion)
# Replace ParaView_VERSION=...
expected="[5-9][.0-9]*" # but also accept system
optionValue=$(getOptionValue "$@")
_matches "$optionValue" "$expected" || \
[ "$optionValue" != "${optionValue%system}" ] || \
die "'$1' has bad value: '$optionValue'"
replaceEtc config.sh/paraview ParaView_VERSION "$optionValue"
replaceEtc config.csh/paraview ParaView_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
_matches "$optValue" "$expected" || \
[ "$optValue" != "${optValue%system}" ] || \
die "'${1%=*}' has bad value: '$optValue'"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/paraview ParaView_VERSION "$optValue"
replaceEtc config.csh/paraview ParaView_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-paraview-qt)
# Replace ParaView_QT=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/paraview ParaView_QT "$optionValue"
replaceEtc config.csh/paraview ParaView_QT "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/paraview ParaView_QT "$optValue"
replaceEtc config.csh/paraview ParaView_QT "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-paraview-path | -paraviewInstall | --paraviewInstall)
# Replace ParaView_DIR=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/paraview ParaView_DIR \""$optionValue\""
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/paraview ParaView_DIR \""$optValue\""
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-llvm)
# Replace mesa_llvm=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk mesa_llvm "$optionValue"
replaceEtc config.csh/vtk mesa_llvm "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk mesa_llvm "$optValue"
replaceEtc config.csh/vtk mesa_llvm "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-mesa)
# Replace mesa_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk mesa_version "$optionValue"
replaceEtc config.csh/vtk mesa_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk mesa_version "$optValue"
replaceEtc config.csh/vtk mesa_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-vtk)
# Replace vtk_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk vtk_version "$optionValue"
replaceEtc config.csh/vtk vtk_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk vtk_version "$optValue"
replaceEtc config.csh/vtk vtk_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-llvm-path)
# Replace LLVM_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optionValue\""
replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optValue\""
replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-mesa-path)
# Replace MESA_ARCH_PATH...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optionValue\""
replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optValue\""
replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-vtk-path)
# Replace VTK_DIR...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk VTK_DIR \""$optionValue\""
replaceEtcCsh config.csh/vtk VTK_DIR \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk VTK_DIR \""$optValue\""
replaceEtcCsh config.csh/vtk VTK_DIR \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
## Misc ##
# Obsolete flags
-sigfpe | -no-sigfpe)
echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2
;;
-archOption | --archOption)
# Replace WM_ARCH_OPTION=...
optionValue=$(getOptionValue "$@")
echo "Ignoring $1 option: no longer supported" 1>&2
shift
;;
# Obsolete options
-archOption | --archOption | \
-foamInstall | --foamInstall | -projectName | --projectName)
# Removed for 1812
optionValue=$(getOptionValue "$@")
echo "Ignoring $1 option: obsolete" 1>&2
shift
echo "Ignoring obsolete option: $1" 1>&2
getOptionValue "$@"
shift "${nOptArgs:-0}"
;;
*)

430
bin/tools/install-dirs Executable file
View File

@ -0,0 +1,430 @@
#!/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
# install-dirs
#
# Example usage
# install-dirs -prefix=/opt/openfoam/openfoamVER -core
#
# Description
# Simple installer to copy architecture-independent directories.
#
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION]
input options:
-source=SOURCE Source directory
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
target options:
-prefix=PREFIX Top-level installation directory in PREFIX ['']
selections:
-[no-]common [do not] install (bin, etc, META-INFO)
-[no-]devel [do not] install (applications, src, wmake)
-[no-]doc [do not] install (doc)
-[no-]tut [do not] install (tutorials)
-no-app, -no-apps do not install (applications)
-no-src do not install (src)
-no-wmake do not install (wmake)
bundled selections:
-core Select: -common -devel
-default Select: -common -devel -doc -tut
tuning options:
-collate Collate modules (doc, tutorials)
-collate-doc Collate modules (doc) into doc/modules
-collate-tut Collate modules (tutorials) into tutorials/modules
general options:
-dry-run, -n Do not perform any operations
-force, -f Ignored
-verbose, -v Additional verbosity
-help Print the help and exit
Simple installer to copy OpenFOAM non-binary directories.
Example,
${0##*/} -prefix=/opt/openfoamVER
USAGE
exit 0 # A clean exit
}
unset optDryRun hadError
# 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
}
# Report error and exit
warnOrDie()
{
if [ -n "$optDryRun" ]
then
hadError=true
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
else
die "$@"
fi
}
# Get the option's value (argument), or die on missing or empty value
# $1 option=value
getOptionValue()
{
local value="${1#*=}"
# Remove any surrounding double quotes
value="${value%\"}"
value="${value#\"}"
[ -n "$value" ] || die "'${1%=}' option requires a value"
echo "$value"
}
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
# $1 option
# [$2] truth value <true>
getBoolOption()
{
case "$1" in
(-no-* | -without-*) echo "false" ;;
(*) echo "${2:-true}" ;;
esac
}
#-------------------------------------------------------------------------------
# Defaults from current OpenFOAM environment
sourceDir="$WM_PROJECT_DIR"
platform="$WM_OPTIONS"
foam_mpi="$FOAM_MPI"
unset install_common install_devel
unset install_app install_src install_wmake
unset install_doc optCollate_doc
unset install_tut optCollate_tut
unset optCollate
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*) printHelp ;;
-n | -dry-run) optDryRun="(dry-run) " ;;
-v | -verbose) optVerbose=true ;;
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Inputs
-source=*) sourceDir="$(getOptionValue "$1")" ;;
-platform=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
-foam-mpi=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Targets
-prefix=*) prefix="$(getOptionValue "$1")" ;;
-exec-prefix=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Selections
-common | -no-common) install_common="$(getBoolOption "$1")" ;;
-devel | -no-devel) install_devel="$(getBoolOption "$1")" ;;
-doc | -no-doc) install_doc="$(getBoolOption "$1")" ;;
-tut | -no-tut) install_tut="$(getBoolOption "$1")" ;;
-no-app | -no-apps) install_app="$(getBoolOption "$1")" ;;
-no-src) install_src="$(getBoolOption "$1")" ;;
-no-wmake) install_wmake="$(getBoolOption "$1")" ;;
-core)
install_common=true
install_devel=true
;;
-default | -all)
[ "$1" = "-all" ] && echo "Compat: treat $1 like -default" 1>&2
install_common=true
install_devel=true
install_doc=true
install_tut=true
;;
-collate | -no-collate)
optCollate="$(getBoolOption "$1")"
if [ "${optCollate:-false}" = false ]
then
unset optCollate optCollate_doc optCollate_tut
fi
;;
-collate-doc) optCollate_doc=true ;;
-collate-tut) optCollate_tut=true ;;
(*) die "Unknown option/argument: $1" ;;
esac
shift
done
#-------------------------------------------------------------------------------
[ "${install_common:-false}" = false ] && unset install_common
if [ "${install_devel:-false}" = false ]
then
unset install_devel install_app install_src install_wmake
fi
if [ "${install_doc:-false}" = false ]
then
unset install_doc
elif [ "$optCollate_doc" = true ] || [ "$optCollate" = true ]
then
install_doc=collate
fi
if [ "${install_tut:-false}" = false ]
then
unset install_tut
elif [ "$optCollate_tut" = true ] || [ "$optCollate" = true ]
then
install_tut=collate
fi
# Input checks
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
# Installation sanity check
[ -n "$prefix" ] || warnOrDie "Must specify -prefix"
if [ -n "$hadError" ]
then
echo "Errors encounters in dry-run. Stopping" 1>&2
exit 1
fi
if [ -z "${install_common}${install_devel}${install_doc}${install_tut}" ]
then
exec 1>&2
echo "Nothing specified to install"
echo
echo "See '${0##*/} -help' for usage"
echo
exit 0 # Treat as not an error
fi
# Report settings
echo "Preparing install with the following parameters" 1>&2
echo "source:" 1>&2
echo " directory $sourceDir" 1>&2
echo 1>&2
echo "target" 1>&2
echo " prefix ${prefix-[]}" 1>&2
##echo " binary ${install_binary:-[disabled]}" 1>&2
echo " common ${install_common:-[disabled]}" 1>&2
echo -n " devel " 1>&2
if [ -n "$install_devel" ]
then
echo -n "true" 1>&2
[ "$install_app" = false ] && echo -n " [app=disabled]" 1>&2
[ "$install_src" = false ] && echo -n " [src=disabled]" 1>&2
[ "$install_wmake" = false ] && echo -n " [wmake=disabled]" 1>&2
echo 1>&2
else
echo "[disabled]" 1>&2
fi
echo " doc ${install_doc:-[disabled]}" 1>&2
echo " tut ${install_tut:-[disabled]}" 1>&2
echo 1>&2
#------------------------------------------------------------------------------
# Proper umask
umask 022
# The commands
copy_cmd="cp -a ${optVerbose:+-v}"
mkdir_cmd="mkdir -p"
if [ -n "$optDryRun" ]
then
if [ -n "$optVerbose" ]
then
copy_cmd="echo cp -a"
mkdir_cmd="echo mkdir -p"
else
copy_cmd="true"
mkdir_cmd="true"
fi
fi
# Copy file or directory to <prefix>
doCopy()
{
$mkdir_cmd "$prefix" 2>/dev/null
for i in "$@"
do
if [ -e "$sourceDir/$i" ]
then
$copy_cmd "$sourceDir/$i" "$prefix"
nCopied="x$nCopied"
else
echo "Missing? $sourceDir/$i" 1>&2
fi
done
echo "${optDryRun}${#nCopied} items copied" 1>&2
}
# Collate (doc | tutorials)
# Eg,
# modules/{NAME}/tutorials
# => tutorials/modules/{NAME}
collateModuleFiles()
{
local subDir="$1"
local subTarget="$prefix/$subDir/modules"
if [ -d "$sourceDir/modules" ]
then
(
cd "$sourceDir/modules" || exit
$mkdir_cmd "$subTarget"
for i in $(find . -mindepth 2 -maxdepth 2 -name "$subDir" -type d)
do
$mkdir_cmd "$subTarget/${i%/*}"
$copy_cmd "$i"/* "$subTarget/${i%/*}"
done
)
fi
}
#------------------------------------------------------------------------------
# common
# ----
message="${optDryRun}Install common:"
if [ -n "$install_common" ]
then
echo "${message} bin etc META-INFO" 1>&2
doCopy bin etc META-INFO
else
echo "${message} [disabled]" 1>&2
fi
# ----
# develop (or source)
# ----
message="${optDryRun}Install devel:" 1>&2
unset dirNames blockMessage
if [ -n "$install_devel" ]
then
if [ "$install_wmake" = false ]
then
blockMessage="$blockMessage [wmake=disabled]"
else
dirNames="$dirNames wmake"
fi
if [ "$install_src" = false ]
then
blockMessage="$blockMessage [src=disabled]"
else
dirNames="$dirNames src"
fi
if [ "$install_app" = false ]
then
blockMessage="$blockMessage [app=disabled]"
else
dirNames="$dirNames applications"
fi
fi
if [ -n "$dirNames" ]
then
echo "${message}${dirNames}${blockMessage}" 1>&2
doCopy $dirNames # Unquoted - uses word splitting
else
echo "${message} [disabled]" 1>&2
fi
# ----
# doc
# ----
message="${optDryRun}Install doc:" 1>&2
if [ -n "$install_doc" ]
then
echo "${message}" 1>&2
doCopy doc
if [ "$install_doc" = collate ]
then
echo "${optDryRun}Collate module doc:" 1>&2
collateModuleFiles doc
fi
else
echo "${message} [disabled]" 1>&2
fi
# ----
# tutorials
# ----
message="${optDryRun}Install tutorials:" 1>&2
if [ -n "$install_tut" ]
then
echo "${message}" 1>&2
doCopy tutorials
if [ "$install_tut" = collate ]
then
echo "${optDryRun}Collate module tutorials:" 1>&2
collateModuleFiles tutorials
fi
else
echo "${message} [disabled]" 1>&2
fi
# ----
if [ -n "$optDryRun" ]
then
[ -n "$optVerbose" ] && echo 1>&2
echo "${optDryRun}Done" 1>&2
fi
exit 0 # clean exit
#------------------------------------------------------------------------------

375
bin/tools/install-platform Executable file
View File

@ -0,0 +1,375 @@
#!/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
# install-platform
#
# Example usage
# install-platform -prefix=/opt/openfoam/openfoamVER
#
# Description
# Simple installer to copy OpenFOAM binary bin/, lib/ (platforms)
# directories.
#
# Note
# The platforms/tools directory still must be handled separately
#
# Layout of OpenFOAM platforms
#
# platforms
# |-- <WM_OPTIONS>
# |-- bin
# | |-- ...
# `-- lib
# |-- ...
# |-- dummy
# | `-- ...
# |-- sys-openmpi
# | |-- libPstream.so
# | `-- libptscotchDecomp.so
# `-- paraview-MAJ.MIN
# `-- ...
#
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION]
input options:
-source=SOURCE Source directory
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
target options:
-prefix=PREFIX Top-level installation directory in PREFIX ['']
-exec-prefix=EPREFIX Architecture-dependent in EPREFIX
[PREFIX/platforms/PLATFORM]
-bindir=DIR bin directory [EPREFIX/bin]
-libdir=DIR lib directory [EPREFIX/lib]
-mpi-libdir=DIR mpi libdir [<libdir>/FOAM_MPI]
tuning options:
-no-bin Do not install bin directory
-no-lib Do not install lib directory
-no-mpi Do not install mpi lib directory
-mpi-only Only install mpi lib directory
-mpi-mkdir Create foam-mpi directory within libdir
general options:
-dry-run, -n Do not perform any operations
-force, -f Ignored
-verbose, -v Additional verbosity
-help Print the help and exit
Simple installer to copy OpenFOAM binary bin/, lib/ (platforms) directories.
Example,
${0##*/} -prefix=/opt/openfoamVER
USAGE
exit 0 # A clean exit
}
unset optDryRun hadError
# 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
}
# Report error and exit
warnOrDie()
{
if [ -n "$optDryRun" ]
then
hadError=true
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
else
die "$@"
fi
}
# Get the option's value (argument), or die on missing or empty value
# $1 option=value
getOptionValue()
{
local value="${1#*=}"
# Remove any surrounding double quotes
value="${value%\"}"
value="${value#\"}"
[ -n "$value" ] || die "'${1%=}' option requires a value"
echo "$value"
}
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
# $1 option
# [$2] truth value <true>
getBoolOption()
{
case "$1" in
(-no-* | -without-*) echo "false" ;;
(*) echo "${2:-true}" ;;
esac
}
#-------------------------------------------------------------------------------
# Defaults from current OpenFOAM environment
sourceDir="$WM_PROJECT_DIR"
platform="$WM_OPTIONS"
foam_mpi="$FOAM_MPI"
unset install_bin install_lib
unset optMkdir_mpi
install_mpi=true
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*) printHelp ;;
-n | -dry-run) optDryRun="(dry-run) " ;;
-v | -verbose) optVerbose=true ;;
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
# Inputs
-source=*) sourceDir="$(getOptionValue "$1")" ;;
-platform=*) platform="$(getOptionValue "$1")" ;;
-foam-mpi=*) foam_mpi="$(getOptionValue "$1")" ;;
# Targets
-prefix=*) prefix="$(getOptionValue "$1")" ;;
-exec-prefix=*) exec_prefix="$(getOptionValue "$1")" ;;
-bindir=*) bindir="$(getOptionValue "$1")" ;;
-libdir=*) libdir="$(getOptionValue "$1")" ;;
-mpi-libdir=*) libdir_mpi="$(getOptionValue "$1")" ;;
-no-bin) install_bin=false ;;
-no-lib) install_lib=false ;;
-no-mpi) install_mpi=false ;;
-mpi-only) install_mpi=exclusive ;;
-mpi-mkdir) optMkdir_mpi=true ;;
(*) die "Unknown option/argument: $1" ;;
esac
shift
done
#-------------------------------------------------------------------------------
# Default <exec_prefix> based on <prefix>
if [ -z "$exec_prefix" ] && [ -n "$prefix" ]
then
exec_prefix="$prefix/platforms/$platform"
fi
# Default <bindir>, <libdir> based on <exec_prefix>
if [ -n "$exec_prefix" ]
then
[ -n "$bindir" ] || bindir="$exec_prefix/bin"
[ -n "$libdir" ] || libdir="$exec_prefix/lib"
fi
# Default <mpi-libdir> based on <libdir> and <foam-mpi>
if [ -z "$libdir_mpi" ] && [ -n "$libdir" ]
then
libdir_mpi="$libdir/$foam_mpi"
fi
# Exclusions
if [ "$install_bin" = false ] || [ "$install_mpi" = exclusive ]
then
unset bindir
fi
if [ "$install_lib" = false ] || [ "$install_mpi" = exclusive ]
then
unset libdir
fi
if [ "$install_mpi" = false ]
then
unset libdir_mpi
fi
# Input checks
sourcePlatform="$sourceDir/platforms/$platform"
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
[ -n "$platform" ] || warnOrDie "No -platform detected or specified"
[ -n "$foam_mpi" ] || warnOrDie "No -foam-mpi detected or specified"
[ -d "$sourcePlatform" ] || \
warnOrDie "Missing platforms directory for: $platform"
# Installation sanity check
[ -n "$bindir$libdir$libdir_mpi" ] || \
warnOrDie "Must specify at least one of -prefix, -exec-prefix, -bindir, -libdir, -mpi-libdir"
if [ -n "$hadError" ]
then
echo "Errors encounters in dry-run. Stopping" 1>&2
exit 1
fi
# Report settings
echo "Preparing install with the following parameters" 1>&2
echo "source:" 1>&2
echo " directory $sourceDir" 1>&2
echo " platform $platform" 1>&2
echo " foam-mpi $foam_mpi" 1>&2
echo 1>&2
echo "target (mpi-install: $install_mpi)" 1>&2
echo " prefix ${prefix-[]}" 1>&2
echo " exec-prefix ${exec_prefix:-[]}" 1>&2
echo " bindir ${bindir:-[]}" 1>&2
echo " libdir ${libdir:-[]}" 1>&2
echo " libdir(mpi) ${libdir_mpi:-[]}" 1>&2
echo 1>&2
#------------------------------------------------------------------------------
# Proper umask
umask 022
# The commands
copy_cmd="cp -a ${optVerbose:+-v}"
mkdir_cmd="mkdir -p"
if [ -n "$optDryRun" ]
then
if [ -n "$optVerbose" ]
then
copy_cmd="echo cp -a"
mkdir_cmd="echo mkdir -p"
else
copy_cmd="true"
mkdir_cmd="true"
fi
fi
# bin/
# ----
message="${optDryRun}Install bindir:"
if [ -n "$bindir" ]
then
input="$sourcePlatform/bin"
echo "From $input" 1>&2
echo "${message} $bindir" 1>&2
$mkdir_cmd "$bindir" 2>/dev/null
for i in "$input/"*
do
if [ -e "$i" ]
then
$copy_cmd "$i" "$bindir"
fi
done
else
echo "${message} [disabled]" 1>&2
fi
# ----
# lib/ without mpi
# ----
message="${optDryRun}Install libdir(non-mpi):"
if [ -n "$libdir" ]
then
input="$sourcePlatform/lib"
echo "From $input" 1>&2
echo "${message} $libdir" 1>&2
$mkdir_cmd "$libdir" 2>/dev/null
for i in "$input/"*
do
if [ "${i##*/}" = "$foam_mpi" ]
then
if [ "$optMkdir_mpi" = true ]
then
$mkdir_cmd "$libdir/$foam_mpi"
fi
elif [ -e "$i" ]
then
$copy_cmd "$i" "$libdir"
else
echo "bogus lib entry? $i" 1>&2
fi
done
else
echo "${message} [disabled]" 1>&2
fi
# ----
# lib/mpi
# ----
message="${optDryRun}Install libdir(mpi):"
if [ -n "$libdir_mpi" ]
then
input="$sourcePlatform/lib/$foam_mpi"
echo "From $input" 1>&2
echo "${message} $libdir_mpi" 1>&2
$mkdir_cmd "$libdir_mpi" 2>/dev/null
for i in "$input"/*
do
if [ -e "$i" ]
then
# Always verbose (not many files anyhow)
$copy_cmd -v "$i" "$libdir_mpi"
else
echo "bogus mpi-lib entry? $i" 1>&2
fi
done
else
echo "${message} [disabled]" 1>&2
fi
# ----
if [ -n "$optDryRun" ]
then
[ -n "$optVerbose" ] && echo 1>&2
echo "${optDryRun}Done" 1>&2
fi
exit 0 # A clean exit
#------------------------------------------------------------------------------

View File

@ -0,0 +1,75 @@
#!/bin/sh
FOAM_MPI="@FOAM_MPI@"
FOAM_SYSTEM_MPI_LIBBIN="@FOAM_SYSTEM_MPI_LIBBIN@"
#------------------------------------------------------------------------------
# ========= |
# \\ / 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.
#
# Description
# Update of links from system mpi lib/ to local lib/mpi-name
#
# Note
# Normally located as a trigger within the platforms/ directory
# Uses hard-coded values (eg, generated with autoconfig).
#
#------------------------------------------------------------------------------
cd "${0%/*}" || exit # Run from this directory
# Local values
FOAM_LIBBIN="$(pwd -P)/lib"
FOAM_MPI_LIBBIN="$FOAM_LIBBIN/$FOAM_MPI"
#------------------------------------------------------------------------------
echo "Link OpenFOAM ($FOAM_MPI) from system locations"
echo "Target: $FOAM_MPI_LIBBIN"
echo "Source: $FOAM_SYSTEM_MPI_LIBBIN"
if [ -z "$FOAM_MPI" ]
then
echo "FOAM_MPI not defined - skipping"
exit 0
fi
if [ -z "$FOAM_SYSTEM_MPI_LIBBIN" ]
then
echo "FOAM_SYSTEM_MPI_LIBBIN not defined - skipping"
exit 0
fi
if [ ! -d "$FOAM_SYSTEM_MPI_LIBBIN" ]
then
echo "No system mpi lib: $FOAM_SYSTEM_MPI_LIBBIN"
echo "... not updating"
exit 0
fi
if [ ! -d "$FOAM_LIBBIN" ]
then
echo "Missing $FOAM_LIBBIN"
exit 0
fi
#------------------------------------------------------------------------------
mkdir -p "$FOAM_MPI_LIBBIN"
# Create symlinks
(
cd "$FOAM_MPI_LIBBIN" || exit
for i in "$FOAM_SYSTEM_MPI_LIBBIN"/*
do
if [ -f "$i" ]
then
ln -svf "$i" "${i##*/}"
fi
done
)
exit 0 # clean exit
#------------------------------------------------------------------------------

View File

@ -52,7 +52,7 @@ Foam::functionObjects::FUNCTIONOBJECT::FUNCTIONOBJECT
)
:
fvMeshFunctionObject(name, runTime, dict),
boolData_(dict.getOrDefault<bool>("boolData"), true),
boolData_(dict.getOrDefault<bool>("boolData", true)),
labelData_(dict.get<label>("labelData")),
wordData_(dict.getOrDefault<word>("wordData", "defaultWord")),
scalarData_(dict.getOrDefault<scalar>("scalarData", 1.0))

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -172,12 +172,13 @@ _foamAddPath "${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}"
# Dummy versions of external libraries. To be found last in library path
_foamAddLib "$FOAM_LIBBIN/dummy"
# External (ThirdParty) libraries. Also allowed to be unset
if ( -d "$WM_THIRD_PARTY_DIR" ) then
# External (ThirdParty) libraries:
# - check if already compiled, or will be compiled.
# can also be unset
unsetenv FOAM_EXT_LIBBIN
if ( -d "$WM_THIRD_PARTY_DIR/platforms" || -f "$WM_THIRD_PARTY_DIR/Allwmake" ) then
setenv FOAM_EXT_LIBBIN "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib"
_foamAddLib "$FOAM_EXT_LIBBIN"
else
unsetenv FOAM_EXT_LIBBIN
endif
# OpenFOAM libraries (user, group, standard)

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -169,13 +169,14 @@ _foamAddPath "$FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN"
# Dummy versions of external libraries. To be found last in library path
_foamAddLib "$FOAM_LIBBIN/dummy"
# External (ThirdParty) libraries. Also allowed to be unset
if [ -d "$WM_THIRD_PARTY_DIR" ]
# External (ThirdParty) libraries:
# - check if already compiled, or will be compiled.
# can also be unset
unset FOAM_EXT_LIBBIN
if [ -d "$WM_THIRD_PARTY_DIR/platforms" ] || [ -f "$WM_THIRD_PARTY_DIR/Allwmake" ]
then
export FOAM_EXT_LIBBIN="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib"
_foamAddLib "$FOAM_EXT_LIBBIN"
else
unset FOAM_EXT_LIBBIN
fi
# OpenFOAM libraries (user, group, standard)

View File

@ -7,9 +7,28 @@ targetType=libso
# Default build into OpenFOAM project locations unless specified with
# -prefix or FOAM_MODULE_PREFIX env varable
: "${FOAM_MODULE_PREFIX:=${FOAM_LIBBIN%/*}}"
# Long form to avoid dash 0.5.8 error (issue #1757)
[ -n "$FOAM_MODULE_PREFIX" ] || FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}"
export FOAM_MODULE_PREFIX
echo "========================================"
if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ]
then
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
echo
exit 0
fi
echo "prefix = $FOAM_MODULE_PREFIX"
echo
echo " ignoring possible compilation errors"
echo " make certain to check the output file"
echo
set +e
export WM_CONTINUE_ON_ERROR=true
#------------------------------------------------------------------------------
for moduleName in $(./list-modules)
do
if [ -d "$moduleName" ]

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.
@ -49,7 +49,7 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
"ODESolver",
solverType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
) << exit(FatalIOError);
}
return autoPtr<ODESolver>(cstrIter()(odes, dict));

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.
@ -86,7 +86,19 @@ inline bool Foam::HashPtrTable<T, Key, Hash>::set
T* ptr
)
{
return this->parent_type::set(key, ptr);
// Newer: const T* old = this->get(key);
iterator iter(this->find(key));
const T* old = (iter.good() ? iter.val() : nullptr);
const bool ok = this->parent_type::set(key, ptr);
if (ok && old != ptr)
{
delete const_cast<T*>(old);
}
return ok;
}

View File

@ -50,6 +50,7 @@ void Foam::List<T>::doResize(const label newSize)
{
if (newSize > 0)
{
// With sign-check to avoid spurious -Walloc-size-larger-than
T* nv = new T[newSize];
const label overlap = min(this->size_, newSize);

View File

@ -31,8 +31,9 @@ License
template<class T>
inline void Foam::List<T>::doAlloc()
{
if (this->size_)
if (this->size_ > 0)
{
// With sign-check to avoid spurious -Walloc-size-larger-than
this->v_ = new T[this->size_];
}
}

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.
@ -79,7 +79,7 @@ void Foam::sortedOrder
template<class T>
void Foam::sort(UPtrList<T>& list)
{
labelList order(input.size());
labelList order(list.size());
sortedOrder(list, order);
list.sortOrder(order, false); // false = allow nullptr
}
@ -88,7 +88,7 @@ void Foam::sort(UPtrList<T>& list)
template<class T, class Compare>
void Foam::sort(UPtrList<T>& list, const Compare& comp)
{
labelList order(input.size());
labelList order(list.size());
sortedOrder(list, order, comp);
list.sortOrder(order, false); // false = allow nullptr
}

View File

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef OSHA1stream_H
#define OSHA1stream_H
#ifndef Foam_OSHA1stream_H
#define Foam_OSHA1stream_H
#include "OSstream.H"
#include "SHA1.H"
@ -63,10 +63,17 @@ class osha1stream
protected:
//- Handle overflow
virtual int overflow(int c = EOF)
{
if (c != EOF) sha1_.append(c);
return c;
}
//- Put sequence of characters
virtual std::streamsize xsputn(const char* s, std::streamsize n)
{
sha1_.append(s, n);
if (n) sha1_.append(s, n);
return n;
}

View File

@ -158,7 +158,7 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
OTstream toks;
result.writeValue(toks);
return std::move(toks);
return tokenList(std::move(toks.tokens()));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,7 +26,7 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class Type>
Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
@ -55,20 +55,22 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
if
(
actualPatchType == word::null
actualPatchType.empty()
|| actualPatchType != p.type()
)
{
if (pfPtr().constraintType() != p.constraintType())
{
// Use default constraint type
// Incompatible (constraint-wise) with the patch type
// - use default constraint type
auto patchTypeCstrIter =
pointPatchConstructorTablePtr_->cfind(p.type());
if (!patchTypeCstrIter.found())
{
FatalErrorInFunction
<< "inconsistent patch and patchField types for \n"
<< "Inconsistent patch and patchField types for\n"
<< " patch type " << p.type()
<< " and patchField type " << patchFieldType
<< exit(FatalError);
@ -138,20 +140,17 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
if
(
!dict.found("patchType")
!dict.found("patchType")
|| dict.get<word>("patchType") != p.type()
)
{
if (pfPtr().constraintType() == p.constraintType())
if (pfPtr().constraintType() != p.constraintType())
{
// Compatible (constraint-wise) with the patch type
return pfPtr;
}
else
{
// Use default constraint type
auto patchTypeCstrIter
= dictionaryConstructorTablePtr_->cfind(p.type());
// Incompatible (constraint-wise) with the patch type
// - use default constraint type
auto patchTypeCstrIter =
dictionaryConstructorTablePtr_->cfind(p.type());
if (!patchTypeCstrIter.found())
{
@ -166,7 +165,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
}
}
return cstrIter()(p, iF, dict);
return pfPtr;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1195,7 +1195,7 @@ void Foam::argList::parse
{
parRunControl_.distributed(true);
source = "-roots";
if (roots.size() != 1)
if (roots.size() > 1)
{
dictNProcs = roots.size()+1;
}
@ -1204,6 +1204,7 @@ void Foam::argList::parse
{
roots.resize(Pstream::nProcs()-1, fileName::null);
parRunControl_.distributed(true);
source = "-hostRoots";
ITstream is(source, options_["hostRoots"]);
@ -1242,7 +1243,7 @@ void Foam::argList::parse
}
}
if (roots.size() != 1)
if (roots.size() > 1)
{
dictNProcs = roots.size()+1;
}
@ -1270,6 +1271,12 @@ void Foam::argList::parse
{
parRunControl_.distributed(true);
decompDict.readEntry("roots", roots);
if (roots.empty())
{
DetailInfo
<< "WARNING: running distributed"
<< " but did not specify roots!" << nl;
}
}
}
@ -1337,8 +1344,8 @@ void Foam::argList::parse
{
options_.set("case", roots[slave-1]/globalCase_);
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << args_ << options_ << roots.size();
OPstream toProc(Pstream::commsTypes::scheduled, slave);
toProc << args_ << options_ << parRunControl_.distributed();
}
options_.erase("case");
@ -1388,24 +1395,24 @@ void Foam::argList::parse
slave++
)
{
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << args_ << options_ << roots.size();
OPstream toProc(Pstream::commsTypes::scheduled, slave);
toProc << args_ << options_ << parRunControl_.distributed();
}
}
}
else
{
// Collect the master's argument list
label nroots;
bool isDistributed;
IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
fromMaster >> args_ >> options_ >> nroots;
fromMaster >> args_ >> options_ >> isDistributed;
parRunControl_.distributed(nroots);
parRunControl_.distributed(isDistributed);
// Establish rootPath_/globalCase_/case_ for slave
setCasePaths();

View File

@ -43,14 +43,13 @@ Description
Read csv format:
\verbatim
readerType csv;
file "<constant>/p0vsTime.csv";
hasHeaderLine true; // skip first line
timeColumn 0; // time is in column 0
valueColumns (1); // value starts in column 1
readerType csv;
file "<constant>/p0vsTime.csv";
hasHeaderLine true; // skip first line
refColumn 0; // reference (eg, time) is in column 0
componentColumns (1); // component values starts in column 1
\endverbatim
Note
- Accessing an empty list results in an error.
- Accessing a list with a single element always returns the same value.

View File

@ -37,6 +37,7 @@ template<class Type>
Foam::labelList Foam::csvTableReader<Type>::getComponentColumns
(
const word& name,
std::initializer_list<std::pair<const char*,int>> compat,
const dictionary& dict
)
{
@ -45,7 +46,7 @@ Foam::labelList Foam::csvTableReader<Type>::getComponentColumns
labelList cols;
ITstream& is = dict.lookup(name);
ITstream& is = dict.lookupCompat(name, compat);
is.format(IOstream::ASCII);
is >> cols;
dict.checkITstream(is, name);
@ -113,8 +114,11 @@ Foam::csvTableReader<Type>::csvTableReader(const dictionary& dict)
:
tableReader<Type>(dict),
headerLine_(dict.get<bool>("hasHeaderLine")),
refColumn_(dict.get<label>("timeColumn")),
componentColumns_(getComponentColumns("valueColumns", dict)),
refColumn_(dict.getCompat<label>("refColumn", {{"timeColumn", 1912}})),
componentColumns_
(
getComponentColumns("componentColumns", {{"valueColumns", 1912}}, dict)
),
separator_(dict.getOrDefault<string>("separator", ",")[0])
{}
@ -218,9 +222,9 @@ void Foam::csvTableReader<Type>::write(Ostream& os) const
tableReader<Type>::write(os);
os.writeEntry("hasHeaderLine", headerLine_);
os.writeEntry("timeColumn", refColumn_);
os.writeEntry("refColumn", refColumn_);
// Force writing labelList in ascii
// Force writing labelList in ASCII
const enum IOstream::streamFormat fmt = os.format();
os.format(IOstream::ASCII);
os.writeEntry("componentColumns", componentColumns_);

View File

@ -76,6 +76,7 @@ class csvTableReader
static labelList getComponentColumns
(
const word& name,
std::initializer_list<std::pair<const char*,int>> compat,
const dictionary& dict
);

View File

@ -202,7 +202,8 @@ inline Foam::Matrix<Form, Type>::Matrix
)
:
mRows_(Mb.m()),
nCols_(Mb.n())
nCols_(Mb.n()),
v_(nullptr)
{
doAlloc();
@ -224,7 +225,8 @@ inline Foam::Matrix<Form, Type>::Matrix
)
:
mRows_(Mb.m()),
nCols_(Mb.n())
nCols_(Mb.n()),
v_(nullptr)
{
doAlloc();

View File

@ -35,8 +35,9 @@ inline void Foam::Matrix<Form, Type>::doAlloc()
{
const label len = size();
if (len)
if (len > 0)
{
// With sign-check to avoid spurious -Walloc-size-larger-than
v_ = new Type[len];
}
}

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.
@ -86,7 +86,7 @@ Foam::mapPolyMesh::mapPolyMesh(const polyMesh& mesh)
forAll(faceZoneFaceMap_, zonei)
{
pointZoneMap_[zonei] = identity(mesh.faceZones()[zonei].size());
faceZoneFaceMap_[zonei] = identity(mesh.faceZones()[zonei].size());
}
forAll(cellZoneMap_, zonei)

View File

@ -45,6 +45,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "mathematicalConstants.H"
#include "error.H"
#include <cmath>
#include <limits>
using namespace Foam::constant::mathematical;

View File

@ -43,6 +43,10 @@ Description
\*---------------------------------------------------------------------------*/
#include "mathematicalConstants.H"
#include "error.H"
#include <cmath>
#include <limits>
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -513,6 +513,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
{
@ -536,6 +540,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
{
@ -970,6 +978,10 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
//- Inner-product of a SphericalTensor and a Tensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{
@ -984,6 +996,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SphericalTensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
{
@ -998,6 +1014,10 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
//- Inner-product of a SymmTensor and a Tensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{
@ -1020,6 +1040,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SymmTensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
{
@ -1042,7 +1066,11 @@ operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
//- Inner-product of a Tensor and a Vector
template<class Cmpt>
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt>
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
{
return Vector<Cmpt>
@ -1056,7 +1084,11 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
//- Inner-product of a Vector and a Tensor
template<class Cmpt>
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt>
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
{
return Vector<Cmpt>

View File

@ -264,7 +264,7 @@ void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const
os.writeEntry("nHeaderLine", nHeaderLine_);
os.writeEntry("refColumn", refColumn_);
// Force writing labelList in ascii
// Force writing labelList in ASCII
const enum IOstream::streamFormat fmt = os.format();
os.format(IOstream::ASCII);
os.writeEntry("componentColumns", componentColumns_);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,8 +42,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef SHA1_H
#define SHA1_H
#ifndef Foam_SHA1_H
#define Foam_SHA1_H
#include <string>
#include <cstdint>
@ -113,6 +113,9 @@ public:
//- Reset the hashed data before appending more
void clear();
//- Append single character
inline void append(char c);
//- Append data for processing
inline SHA1& append(const char* str);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,6 +53,12 @@ inline Foam::SHA1::SHA1(const std::string& str)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline void Foam::SHA1::append(char c)
{
processBytes(&c, 1);
}
inline Foam::SHA1& Foam::SHA1::append(const char* data, size_t len)
{
processBytes(data, len);

View File

@ -29,6 +29,7 @@ License
#include "word.H"
#include "debug.H"
#include <cctype>
#include <cstdint>
#include <sstream>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -1,6 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------

View File

@ -976,7 +976,17 @@ void Foam::UPstream::allocatePstreamCommunicator
void Foam::UPstream::freePstreamCommunicator(const label communicator)
{
if (communicator != UPstream::worldComm)
// Not touching the first communicator (WORLD)
// or anything out-of bounds.
//
// No UPstream communicator indices when MPI is initialized outside
// of OpenFOAM - thus needs a bounds check too!
if
(
communicator > 0
&& (communicator < PstreamGlobals::MPICommunicators_.size())
)
{
if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL)
{

View File

@ -12,7 +12,7 @@ warning="==> skip optional libccm adapter"
# Link with static libccmio only (fewer issues)
if have_ccmio
then
wmake libso || echo "$warning (build issues detected)"
wmake $targetType || echo "$warning (build issues detected)"
else
echo $warning
fi

View File

@ -34,7 +34,7 @@ Description
calculated as:
\f[
p = pa - \vec{g} & \vec{r}
p = pa - \vec{g} \cdot \vec{r}
\f]
where

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -199,6 +199,9 @@ void Foam::ensightMesh::correct()
if (returnReduce(!zn.empty(), orOp<bool>()))
{
// Ensure full mesh coverage
cellSelection.resize(mesh_.nCells());
cellSelection.set(zn);
ensightCells& part = cellZoneParts_(zoneId);
@ -267,6 +270,7 @@ void Foam::ensightMesh::correct()
if (returnReduce(!cellSelection.empty(), orOp<bool>()))
{
// Ensure full mesh coverage
excludeFace.resize(mesh_.nFaces());
const labelList& owner = mesh_.faceOwner();
@ -288,6 +292,7 @@ void Foam::ensightMesh::correct()
if (fzoneIds.size())
{
// Ensure full mesh coverage
excludeFace.resize(mesh_.nFaces());
for (const polyPatch& p : mesh_.boundaryMesh())

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2010-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -261,7 +261,14 @@ Foam::tmp<GeomField> Foam::expressions::fvExprDriver::getOrReadFieldImpl
tfield.reset
(
GeomField::New(name, meshRef, dimensioned<Type>(Zero))
GeomField::New
(
name,
meshRef,
dimensioned<Type>(Zero),
// Patch is zeroGradient (volFields) or calculated (other)
defaultBoundaryType(GeomField::null())
)
);
GeomField& fld = tfield.ref();

View File

@ -31,6 +31,7 @@ License
#include "fvMesh.H"
#include "fvPatch.H"
#include "pointMesh.H"
#include "stringOps.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -97,7 +98,6 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
else
{
// No gradient expression - same as Zero
if (debug_)
{
Info<< "No gradientExpr" << nl;
@ -106,7 +106,14 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
if (dict.readIfPresent("fractionExpr", expr))
{
if (!expr.empty() && expr != "0")
stringOps::inplaceTrim(expr);
if (expr == "0" || expr == "1")
{
// Special cases, handled with more efficiency
fracExpr_ = expr;
}
else if (!expr.empty())
{
if (isPointVal)
{
@ -116,11 +123,9 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
fracExpr_ = expressions::exprString(expr, dict);
}
}
else
{
// No fraction expression - same as 1 (one)
// Mixed BC may elect to simply ignore gradient expression
}
// No fraction expression? - defer treatment to inherited BC
// Mixed BC may elect to simply ignore gradient expression
}
}

View File

@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Original code Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -89,7 +89,7 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
setDebug();
DebugInFunction << nl;
// Basic sanity
// Require valueExpr
if (this->valueExpr_.empty())
{
FatalIOErrorInFunction(dict)
@ -97,6 +97,7 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
<< exit(FatalIOError);
}
driver_.readDict(dict);
if (dict.found("value"))
@ -110,11 +111,12 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
{
(*this) == this->patchInternalField();
#ifdef FULLDEBUG
WarningInFunction
<< "No value defined for "
<< this->internalField().name() << " on "
<< this->patch().name() << " - setting to internalField value "
<< nl;
<< this->patch().name() << " - using patch internal field" << endl;
#endif
}
if (this->evalOnConstruct_)
@ -161,31 +163,29 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
template<class Type>
void Foam::exprFixedValueFvPatchField<Type>::updateCoeffs()
{
if (debug)
{
InfoInFunction
<< "Value: " << this->valueExpr_ << nl
<< "Variables: ";
driver_.writeVariableStrings(Info) << endl;
}
if (this->updated())
{
return;
}
DebugInFunction
<< "updating" << nl;
if (debug)
{
InfoInFunction
<< "Value: " << this->valueExpr_ << nl
<< "Variables: ";
driver_.writeVariableStrings(Info) << nl;
Info<< "... updating" << endl;
}
// Expression evaluation
{
bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ != "0");
driver_.clearVariables();
if (this->valueExpr_.empty())
{
(*this) == Zero;
}
else
if (evalValue)
{
tmp<Field<Type>> tresult(driver_.evaluate<Type>(this->valueExpr_));
@ -196,6 +196,10 @@ void Foam::exprFixedValueFvPatchField<Type>::updateCoeffs()
(*this) == tresult;
}
else
{
(*this) == Zero;
}
}
fixedValueFvPatchField<Type>::updateCoeffs();

View File

@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Original code Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -91,20 +91,51 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
setDebug();
DebugInFunction << nl;
// Basic sanity checks
// Require one or both of valueExpr, gradientExpr
if (this->valueExpr_.empty() && this->gradExpr_.empty())
{
if (this->valueExpr_.empty())
FatalIOErrorInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Require either or both: valueExpr and gradientExpr" << nl
<< exit(FatalIOError);
}
if (this->fracExpr_.empty())
{
// No fractionExpr. Expect only one of valueExpr or gradientExpr
if (!this->valueExpr_.empty() && !this->gradExpr_.empty())
{
FatalIOErrorInFunction(dict)
<< "The valueExpr was not defined!" << nl
<< exit(FatalIOError);
IOWarningInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Recommend using fractionExpr when specifying both"
<< " valueExpr and gradientExpr. Assuming a value of 1."
<< nl << endl;
}
}
else if (this->fracExpr_ == "0")
{
// Gradient only. Expect gradientExpr
if (this->gradExpr_.empty())
{
FatalIOErrorInFunction(dict)
<< "The gradientExpr was not defined!" << nl
<< exit(FatalIOError);
IOWarningInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Gradient only, but did not specify gradientExpr."
<< nl << endl;
}
}
else if (this->fracExpr_ == "1")
{
// Value only. Expect valueExpr
if (this->valueExpr_.empty())
{
IOWarningInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Value only, but did not specify valueExpr."
<< nl << endl;
}
}
@ -114,14 +145,12 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
// Similar to fvPatchField constructor, which we have bypassed
dict.readIfPresent("patchType", this->patchType());
bool needsRefValue = true;
if (dict.found("refValue"))
{
needsRefValue = false;
this->refValue() = Field<Type>("refValue", dict, p.size());
}
else
{
this->refValue() = this->patchInternalField();
}
if (dict.found("value"))
{
@ -130,22 +159,27 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
Field<Type>("value", dict, p.size())
);
if (!dict.found("refValue"))
if (needsRefValue)
{
// Ensure refValue has a sensible value for the "update" below
this->refValue() = Field<Type>("value", dict, p.size());
this->refValue() = static_cast<const Field<Type>&>(*this);
}
}
else
{
if (needsRefValue)
{
this->refValue() = this->patchInternalField();
}
fvPatchField<Type>::operator=(this->refValue());
#ifdef FULLDEBUG
WarningInFunction
<< "No value defined for "
<< this->internalField().name()
<< " on " << this->patch().name() << " therefore using "
<< "the internal field next to the patch"
<< endl;
<< this->internalField().name() << " on "
<< this->patch().name() << " - using patch internal field" << endl;
#endif
}
@ -164,7 +198,7 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
}
else
{
this->valueFraction() = 1;
this->valueFraction() = scalar(1);
}
@ -234,6 +268,11 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
template<class Type>
void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
if (debug)
{
InfoInFunction
@ -241,45 +280,67 @@ void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
<< "Gradient: " << this->gradExpr_ << nl
<< "Fraction: " << this->fracExpr_ << nl
<< "Variables: ";
driver_.writeVariableStrings(Info) << endl;
driver_.writeVariableStrings(Info) << nl;
Info<< "... updating" << endl;
}
if (this->updated())
{
return;
}
DebugInFunction << " - updating" << nl;
// Expression evaluation
{
driver_.clearVariables();
bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ != "0");
bool evalGrad = (!this->gradExpr_.empty() && this->gradExpr_ != "0");
bool evalFrac = (!this->fracExpr_.empty());
scalar fraction = 1;
// Have one or both of valueExpr, gradientExpr (checked in constructor)
if (this->valueExpr_.empty())
{
this->refValue() = Zero;
// No value expression -> gradient only
fraction = 0;
evalValue = false;
evalFrac = false;
}
else
{
this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
}
bool evalGrad = !this->gradExpr_.empty();
if (this->fracExpr_.empty() || this->fracExpr_ == "1")
else if (this->gradExpr_.empty())
{
// No gradient expression -> value only
fraction = 1;
evalGrad = false;
this->valueFraction() = scalar(1);
evalFrac = false;
}
else if (this->fracExpr_.empty())
{
// No fractionExpr, but has both valueExpr and gradientExpr
// -> treat as value only (warning in constructor)
fraction = 1;
evalGrad = false;
evalFrac = false;
}
else if (this->fracExpr_ == "0")
{
this->valueFraction() = Zero;
// Gradient only
fraction = 0;
evalValue = false;
evalFrac = false;
}
else if (this->fracExpr_ == "1")
{
// Value only
fraction = 1;
evalGrad = false;
evalFrac = false;
}
driver_.clearVariables();
if (evalValue)
{
this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
}
else
{
this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
this->refValue() = Zero;
}
if (evalGrad)
@ -290,6 +351,15 @@ void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
{
this->refGrad() = Zero;
}
if (evalFrac)
{
this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
}
else
{
this->valueFraction() = fraction;
}
}
mixedFvPatchField<Type>::updateCoeffs();

View File

@ -30,7 +30,7 @@ Group
grpInletBoundaryConditions grpOutletBoundaryConditions
Description
This velocity inlet/outlet boundary condition is applied to pressure
This velocity inlet/outlet boundary condition is applied to velocity
boundaries where the pressure is specified. A zero-gradient condition is
applied for outflow (as defined by the flux); for inflow, the velocity
is obtained from the flux with the specified inlet direction.

View File

@ -30,7 +30,7 @@ Group
grpInletBoundaryConditions grpOutletBoundaryConditions
Description
This velocity inlet/outlet boundary condition is applied to pressure
This velocity inlet/outlet boundary condition is applied to velocity
boundaries where the pressure is specified. A zero-gradient condition is
applied for outflow (as defined by the flux); for inflow, the velocity is
obtained from the patch-face normal component of the internal-cell value.

View File

@ -161,38 +161,38 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::indexPairs()
void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
{
const vectorField& faceCentres = this->patch().patch().faceCentres();
label badFacei = -1;
forAll(R_, facei)
{
if (R_[facei].xx() <= 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor component Rxx cannot be negative"
<< " or zero, where Rxx = " << R_[facei].xx()
<< " at the face centre = " << faceCentres[facei]
<< exit(FatalError);
<< " or zero, where Rxx = " << R_[facei].xx();
break;
}
if (R_[facei].yy() < 0 || R_[facei].zz() < 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor components Ryy or Rzz cannot be"
<< " negative where Ryy = " << R_[facei].yy()
<< ", and Rzz = " << R_[facei].zz()
<< " at the face centre = " << faceCentres[facei]
<< exit(FatalError);
<< ", and Rzz = " << R_[facei].zz();
break;
}
const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy());
if (x0 <= 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2"
<< " cannot be negative or zero"
<< " at the face centre = " << faceCentres[facei]
<< exit(FatalError);
<< " cannot be negative or zero";
break;
}
const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx();
@ -202,15 +202,23 @@ void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
if (x3 < 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor component group, "
<< "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2"
<< " cannot be negative at the face centre = "
<< faceCentres[facei]
<< exit(FatalError);
<< " cannot be negative";
break;
}
}
if (badFacei >= 0)
{
FatalError
<< " at the face centre = "
<< this->patch().patch().faceCentres()[badFacei]
<< exit(FatalError);
}
Info<< " # Reynolds stress tensor on patch is consistent #" << endl;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -68,7 +68,7 @@ Foam::surfaceInterpolationScheme<Type>::New
"discretisation",
schemeName,
*MeshConstructorTablePtr_
) << exit(FatalError);
) << exit(FatalIOError);
}
return cstrIter()(mesh, schemeData);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -213,13 +213,16 @@ bool Foam::functionObjects::Curle::execute()
forAll(observerPositions_, pointi)
{
const vectorField r(Cfp - observerPositions_[pointi]);
const vectorField r(observerPositions_[pointi] - Cfp);
const scalarField invMagR(1/(mag(r) + ROOTVSMALL));
pDash[pointi] +=
sum((pp*sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & r));
sum((pp*sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & (r*invMagR)));
}
}
pDash /= 4*mathematical::pi;
Pstream::listCombineGather(pDash, plusEqOp<scalar>());
Pstream::listCombineScatter(pDash);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -899,6 +899,16 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
mesh_,
dict.subDict("sampledSurfaceDict")
);
if (sampledPtr_->interpolate())
{
// Should probably ignore interpolate entirely,
// but the oldest isoSurface algorithm requires it!
WarningInFunction
<< type() << ' ' << name() << ": "
<< "sampledSurface with interpolate = true "
<< "is likely incorrect" << nl << nl;
}
}
Info<< type() << " " << name() << ":" << nl

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -388,6 +388,15 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
false // serial - already merged
);
// Point data? Should probably disallow
if (sampledPtr_)
{
surfaceWriterPtr_->isPointData() =
sampledPtr_->interpolate();
}
surfaceWriterPtr_->nFields() = 1; // Needed for VTK legacy
surfaceWriterPtr_->write(fieldName, allValues);
surfaceWriterPtr_->clear();

View File

@ -79,7 +79,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
const vectorField nf(patch.nf());
const vectorField faceCellCentres(patch.patch().faceCellCentres());
const labelUList& faceCells = patch.patch().faceCells();
const vectorField::subField& faceCentres = patch.patch().faceCentres();
const vectorField::subField faceCentres = patch.patch().faceCentres();
forAll(patch, patchFacei)
{

View File

@ -127,7 +127,7 @@ void Foam::fv::actuationDiskSource::calcFroudeMethod
Ostream& os = file();
writeCurrentTime(os);
os << Uref << tab << Cp << tab << Ct << tab << a << tab << T << tab
os << Uref << tab << Cp << tab << Ct << tab << a << tab << T
<< endl;
}
}
@ -238,7 +238,7 @@ void Foam::fv::actuationDiskSource::calcVariableScalingMethod
Ostream& os = file();
writeCurrentTime(os);
os << Uref << tab << Cp << tab << Ct
os << Uref << tab << Cp << tab << Ct << tab
<< Udisk << tab << CpStar << tab << CtStar << tab << T << tab << P
<< endl;
}

View File

@ -419,8 +419,6 @@ void Foam::ParticleCollector<CloudType>::write()
massTotal_[facei] += mass_[facei];
}
const label proci = Pstream::myProcNo();
Info<< type() << " output:" << nl;
Field<scalar> faceMassTotal(mass_.size(), Zero);
@ -434,15 +432,11 @@ void Foam::ParticleCollector<CloudType>::write()
scalar sumAverageMFR = 0.0;
forAll(faces_, facei)
{
scalarList allProcMass(Pstream::nProcs());
allProcMass[proci] = massTotal_[facei];
Pstream::gatherList(allProcMass);
faceMassTotal[facei] += sum(allProcMass);
faceMassTotal[facei] +=
returnReduce(massTotal_[facei], sumOp<scalar>());
scalarList allProcMassFlowRate(Pstream::nProcs());
allProcMassFlowRate[proci] = massFlowRate_[facei];
Pstream::gatherList(allProcMassFlowRate);
faceMassFlowRate[facei] += sum(allProcMassFlowRate);
faceMassFlowRate[facei] +=
returnReduce(massFlowRate_[facei], sumOp<scalar>());
sumTotalMass += faceMassTotal[facei];
sumAverageMFR += faceMassFlowRate[facei];

View File

@ -152,7 +152,7 @@ Foam::lumpedPointState::lumpedPointState
FatalErrorInFunction
<< "Have " << points_.size() << " points but "
<< angles_.size() << " angles" << nl
exit(FatalError);
<< exit(FatalError);
#else
WarningInFunction
<< "Have " << points_.size() << " points but "

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,10 +51,7 @@ Foam::gradingDescriptor::gradingDescriptor
nDivFraction_(nDivFraction),
expansionRatio_(expansionRatio)
{
if (expansionRatio_ < 0)
{
expansionRatio_ = 1.0/(-expansionRatio_);
}
correct();
}
@ -67,10 +64,7 @@ Foam::gradingDescriptor::gradingDescriptor
nDivFraction_(1),
expansionRatio_(expansionRatio)
{
if (expansionRatio_ < 0)
{
expansionRatio_ = 1.0/(-expansionRatio_);
}
correct();
}
@ -82,6 +76,15 @@ Foam::gradingDescriptor::gradingDescriptor(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::gradingDescriptor::correct()
{
if (expansionRatio_ < 0)
{
expansionRatio_ = 1.0/(-expansionRatio_);
}
}
Foam::gradingDescriptor Foam::gradingDescriptor::inv() const
{
return gradingDescriptor
@ -129,6 +132,8 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptor& gd)
is.readEnd("gradingDescriptor");
}
gd.correct();
is.check(FUNCTION_NAME);
return is;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,7 +57,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class Istream;
class Ostream;
class gradingDescriptor;
@ -81,12 +81,13 @@ class gradingDescriptor
public:
// Friendship with gradingDescriptors
friend class gradingDescriptors;
// Constructors
//- Default constructor
//- Default construct (1, 1, 1)
gradingDescriptor();
//- Construct from components
@ -110,8 +111,6 @@ public:
// Member Functions
// Access
scalar blockFraction() const
{
return blockFraction_;
@ -127,7 +126,9 @@ public:
return expansionRatio_;
}
// Member Functions
//- Adjust expansion ratio.
// Trap negative value and treat as its inverse.
void correct();
//- Return the inverse gradingDescriptor with 1/expansionRatio
gradingDescriptor inv() const;
@ -143,8 +144,6 @@ public:
friend Istream& operator>>(Istream&, gradingDescriptor&);
friend Ostream& operator<<(Ostream&, const gradingDescriptor&);
friend Istream& operator>>(Istream&, gradingDescriptors&);
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,7 +32,16 @@ License
Foam::gradingDescriptors::gradingDescriptors()
:
gradingDescriptors(gradingDescriptor())
List<gradingDescriptor>(1, gradingDescriptor())
{}
Foam::gradingDescriptors::gradingDescriptors
(
const label len
)
:
List<gradingDescriptor>(len, gradingDescriptor())
{}
@ -44,6 +53,35 @@ Foam::gradingDescriptors::gradingDescriptors(const gradingDescriptor& gd)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::gradingDescriptors::correct()
{
for (gradingDescriptor& gd : *this)
{
gd.correct();
}
}
void Foam::gradingDescriptors::normalise()
{
scalar sumBlockFraction = 0;
scalar sumNDivFraction = 0;
for (const gradingDescriptor& gd : *this)
{
sumBlockFraction += gd.blockFraction_;
sumNDivFraction += gd.nDivFraction_;
}
for (gradingDescriptor& gd : *this)
{
gd.blockFraction_ /= sumBlockFraction;
gd.nDivFraction_ /= sumNDivFraction;
gd.correct();
}
}
Foam::gradingDescriptors Foam::gradingDescriptors::inv() const
{
gradingDescriptors ret(*this);
@ -67,6 +105,7 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptors& gds)
if (t.isNumber())
{
gds = gradingDescriptors(gradingDescriptor(t.number()));
gds.correct();
}
else
{
@ -75,28 +114,10 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptors& gds)
// Read the list for gradingDescriptors
is >> static_cast<List<gradingDescriptor>&>(gds);
// Check state of Istream
is.check(FUNCTION_NAME);
// Normalize the blockFractions and nDivFractions
// of the list of gradingDescriptors
scalar sumBlockFraction = 0;
scalar sumNDivFraction = 0;
forAll(gds, i)
{
sumBlockFraction += gds[i].blockFraction_;
sumNDivFraction += gds[i].nDivFraction_;
}
forAll(gds, i)
{
gds[i].blockFraction_ /= sumBlockFraction;
gds[i].nDivFraction_ /= sumNDivFraction;
}
gds.normalise();
}
is.check(FUNCTION_NAME);
return is;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,10 +47,9 @@ SourceFiles
namespace Foam
{
// Forward declarations
class gradingDescriptors;
// Forward Declarations
class Istream;
class gradingDescriptors;
Istream& operator>>(Istream& is, gradingDescriptors& gd);
/*---------------------------------------------------------------------------*\
@ -64,15 +64,26 @@ public:
// Constructors
//- Default constructor
//- Default construct with a single default gradingDescriptor
gradingDescriptors();
//- Construct from a gradingDescriptor
gradingDescriptors(const gradingDescriptor& gd);
//- Construct with specified number of default gradingDescriptor
explicit gradingDescriptors(const label len);
//- Construct from a single gradingDescriptor
explicit gradingDescriptors(const gradingDescriptor& gd);
// Member Functions
//- Adjust expansion ratios.
// Trap negative value and treat as its inverse.
void correct();
//- Normalize blockFractions and nDivFractions for the list
//- of gradingDescriptors, and call correct()
void normalise();
//- Return the inverse gradingDescriptors with 1/expansionRatio
gradingDescriptors inv() const;

View File

@ -453,12 +453,13 @@ Foam::label Foam::meshRefinement::markSurfaceGapRefinement
forAll(surf1, i)
{
// Combine selfProx of shell and surfaces. Ignore regions for
// now
// Combine selfProx of shell and surfaces.
// Ignore regions for now
const label cellI = cellMap[i];
const label shelli =
(
cellToCompact[cellI] != -1
(cellI != -1 && cellToCompact[cellI] != -1)
? gapShell[cellToCompact[cellI]]
: -1
);
@ -482,8 +483,6 @@ Foam::label Foam::meshRefinement::markSurfaceGapRefinement
)
{
// Found intersection with surface. Check opposite normal.
label cellI = cellMap[i];
if
(
cellI != -1

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2017 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -396,22 +396,43 @@ Foam::AABBTree<Type>::AABBTree
// transfer flattened tree to persistent storage
DynamicList<treeBoundBox> boundBoxes(2*bbs.size());
DynamicList<labelList> addressing(2*addr.size());
forAll(nodes, nodeI)
{
if (nodes[nodeI].first() < 0)
{
boundBoxes.append(bbs[nodeI].first());
addressing.append(addr[nodeI + 1]);
addressing.append(addr[-(nodes[nodeI].first() + 1)]);
}
if (nodes[nodeI].second() < 0)
{
boundBoxes.append(bbs[nodeI].second());
addressing.append(addr[nodeI + 1]);
addressing.append(addr[-(nodes[nodeI].second() + 1)]);
}
}
boundBoxes_.transfer(boundBoxes);
addressing_.transfer(addressing);
if (0)
{
bitSet checked(objects.size());
for (const auto& box : addressing_)
{
for (const auto& id : box)
{
checked.set(id);
}
}
const label unsetSize = checked.count(false);
if (unsetSize)
{
Info<< "*** Problem: IDs not set: " << unsetSize << endl;
}
}
}

View File

@ -142,8 +142,7 @@ public:
AABBTree();
//- Construct from components
// equalBinSize: divide into equal number of elements or
// equal span
// equalBinSize: divide into equal number of elements or equal span
AABBTree
(
const UList<Type>& objects,
@ -171,7 +170,7 @@ public:
bool pointInside(const point& pt) const;
//- Determine whether a bounding box overlaps the tree bounding
// boxes
//- boxes
bool overlaps(const boundBox& bbIn) const;

View File

@ -155,7 +155,7 @@ bool Foam::vtk::writePointSet
if (parallel)
{
vtk::writeListParallel(format(), mesh.points(), pointLabels);
vtk::writeListParallel(format.ref(), mesh.points(), pointLabels);
}
else
{

View File

@ -78,7 +78,7 @@ void Foam::regionToFace::markZone
const indirectPrimitivePatch& patch,
const label proci,
const label facei,
const label zoneI,
const label zonei,
labelList& faceZone
) const
{
@ -100,7 +100,7 @@ void Foam::regionToFace::markZone
edgeTopoDistanceData<label>
(
0, // distance
zoneI
zonei
)
);
}
@ -124,9 +124,13 @@ void Foam::regionToFace::markZone
forAll(allFaceInfo, facei)
{
if (allFaceInfo[facei].data() == zoneI)
if
(
allFaceInfo[facei].valid(calc.data())
&& allFaceInfo[facei].data() == zonei
)
{
faceZone[facei] = zoneI;
faceZone[facei] = zonei;
}
}
}

View File

@ -175,9 +175,6 @@ void optimisationType::update()
void optimisationType::update(scalarField& direction)
{
// Compute eta if needed
computeEta(direction);
// Multiply with line search step, if necessary
scalarField correction(direction);
if (lineSearch_.valid())
@ -218,6 +215,9 @@ tmp<scalarField> optimisationType::computeDirection()
scalarField& correction = tcorrection.ref();
correction = updateMethod_->returnCorrection();
// Compute eta if needed
computeEta(correction);
return tcorrection;
}

View File

@ -376,7 +376,7 @@ Foam::scalar Foam::updateMethod::computeMeritFunction()
Foam::scalar Foam::updateMethod::meritFunctionDirectionalDerivative()
{
return sum(objectiveDerivatives_*correction_);
return globalSum(objectiveDerivatives_*correction_);
}

View File

@ -1912,31 +1912,28 @@ void Foam::NURBS3DVolume::writeCps(const fileName& baseName) const
void Foam::NURBS3DVolume::writeCpsInDict() const
{
if (Pstream::master())
{
IOdictionary cpsDict
IOdictionary cpsDict
(
IOobject
(
IOobject
(
name_ + "cpsBsplines" + mesh_.time().timeName(),
mesh_.time().caseConstant(),
cpsFolder_,
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
name_ + "cpsBsplines" + mesh_.time().timeName(),
mesh_.time().caseConstant(),
cpsFolder_,
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
cpsDict.add("controlPoints", cps_);
cpsDict.add("controlPoints", cps_);
// Always write in ASCII, but allow compression
cpsDict.regIOobject::writeObject
(
IOstreamOption(IOstream::ASCII, mesh_.time().writeCompression()),
true
);
}
// Always write in ASCII, but allow compression
cpsDict.regIOobject::writeObject
(
IOstreamOption(IOstream::ASCII, mesh_.time().writeCompression()),
true
);
}

View File

@ -1,6 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_scotch

View File

@ -291,6 +291,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
false // serial - already merged
);
writerPtr_->nFields() = 1; // Legacy VTK
writerPtr_->write(title, allData);
writerPtr_->endTime();
@ -323,6 +324,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
false // serial - already merged
);
writerPtr_->nFields() = 1; // Legacy VTK
writerPtr_->write(title, data);
writerPtr_->endTime();

View File

@ -157,7 +157,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
const bool secondOrder
) const
{
mapSrcToTgt(field, cop, result.primitiveFieldRef());
mapTgtToSrc(field, cop, result.primitiveFieldRef());
}
@ -170,7 +170,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
const bool secondOrder
) const
{
mapSrcToTgt(field, cop, result.primitiveFieldRef());
mapTgtToSrc(field, cop, result.primitiveFieldRef());
}
@ -183,7 +183,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
const bool secondOrder
) const
{
mapSrcToTgt(field, cop, result.primitiveFieldRef());
mapTgtToSrc(field, cop, result.primitiveFieldRef());
}
@ -196,7 +196,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
const bool secondOrder
) const
{
mapSrcToTgt(field, cop, result.primitiveFieldRef());
mapTgtToSrc(field, cop, result.primitiveFieldRef());
}
@ -209,7 +209,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
const bool secondOrder
) const
{
mapSrcToTgt(field, cop, result.primitiveFieldRef());
mapTgtToSrc(field, cop, result.primitiveFieldRef());
}
@ -222,7 +222,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
const bool secondOrder
) const
{
mapSrcToTgt(field, cop, result.primitiveFieldRef());
mapTgtToSrc(field, cop, result.primitiveFieldRef());
}

View File

@ -843,15 +843,15 @@ Foam::meshToMesh::mapTgtToSrc
label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i];
if (!srcPatchFields.set(tgtPatchi))
if (!srcPatchFields.set(srcPatchi))
{
srcPatchFields.set
(
srcPatchi,
fvPatchField<Type>::New
(
tgtBfld[srcPatchi],
srcMesh.boundary()[tgtPatchi],
tgtBfld[tgtPatchi],
srcMesh.boundary()[srcPatchi],
DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper
(

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -107,7 +107,7 @@ void Foam::polySurface::storeField
if (dimfield)
{
dimfield->dimensions() = dims;
dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = values;
}
else
@ -148,7 +148,7 @@ void Foam::polySurface::storeField
if (dimfield)
{
dimfield->dimensions() = dims;
dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = std::move(values);
}
else

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,7 +45,7 @@ void Foam::surfMesh::storeField
if (dimfield)
{
dimfield->dimensions() = dims;
dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = values;
}
else
@ -85,7 +85,7 @@ void Foam::surfMesh::storeField
if (dimfield)
{
dimfield->dimensions() = dims;
dimfield->dimensions().reset(dims); // Dimensions may have changed
dimfield->field() = std::move(values);
}
else

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -106,6 +106,57 @@ Foam::surfaceWriters::boundaryDataWriter::boundaryDataWriter
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::surfaceWriters::boundaryDataWriter::serialWriteGeometry
(
const regIOobject& iopts,
const meshedSurf& surf
)
{
const pointField& points = surf.points();
const faceList& faces = surf.faces();
if (verbose_)
{
if (this->isPointData())
{
Info<< "Writing points: " << iopts.objectPath() << endl;
}
else
{
Info<< "Writing face centres: " << iopts.objectPath() << endl;
}
}
// Like regIOobject::writeObject without instance() adaptation
// since this would write to e.g. 0/ instead of postProcessing/
OFstream osGeom(iopts.objectPath(), streamOpt_);
if (header_)
{
iopts.writeHeader(osGeom);
}
if (this->isPointData())
{
// Just like writeData, but without copying beforehand
osGeom << points;
}
else
{
primitivePatch pp(SubList<face>(faces), points);
// Just like writeData, but without copying beforehand
osGeom << pp.faceCentres();
}
if (header_)
{
iopts.writeEndDivider(osGeom);
}
}
Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
{
checkOpen();
@ -127,6 +178,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
mkDir(surfaceDir);
}
// Write sample locations
pointIOField iopts
(
IOobject
@ -138,30 +190,9 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
false
)
);
iopts.note() = (this->isPointData() ? "point data" : "face data");
if (verbose_)
{
Info<< "Writing points: " << iopts.objectPath() << endl;
}
// Like regIOobject::writeObject without instance() adaptation
// since this would write to e.g. 0/ instead of postProcessing/
OFstream osGeom(iopts.objectPath(), streamOpt_);
if (header_)
{
iopts.writeHeader(osGeom);
}
// Just like writeData, but without copying beforehand
osGeom << surf.points();
if (header_)
{
iopts.writeEndDivider(osGeom);
}
serialWriteGeometry(iopts, surf);
}
wroteGeom_ = true;
@ -199,67 +230,29 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
if (Pstream::master() || !parallel_)
{
const pointField& points = surf.points();
const faceList& faces = surf.faces();
if (!isDir(outputFile.path()))
{
mkDir(outputFile.path());
}
pointIOField iopts
(
IOobject
// Write sample locations
{
pointIOField iopts
(
surfaceDir/"points",
*dummyTimePtr,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
IOobject
(
surfaceDir/"points",
*dummyTimePtr,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
iopts.note() = (this->isPointData() ? "point data" : "face data");
if (verbose_)
{
if (this->isPointData())
{
Info<< "Writing points: " << iopts.objectPath() << endl;
}
else
{
Info<< "Writing face centres: " << iopts.objectPath() << endl;
}
serialWriteGeometry(iopts, surf);
}
// Like regIOobject::writeObject without instance() adaptation
// since this would write to e.g. 0/ instead of postProcessing/
OFstream osGeom(iopts.objectPath(), streamOpt_);
if (header_)
{
iopts.writeHeader(osGeom);
}
if (this->isPointData())
{
// Just like writeData, but without copying beforehand
osGeom << points;
}
else
{
primitivePatch pp(SubList<face>(faces), points);
// Just like writeData, but without copying beforehand
osGeom << pp.faceCentres();
}
if (header_)
{
iopts.writeEndDivider(osGeom);
}
// Write field
{
IOField<Type> iofld
@ -273,6 +266,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
false
)
);
iofld.note() = (this->isPointData() ? "point data" : "face data");
OFstream osField(iofld.objectPath(), streamOpt_);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -129,6 +129,10 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class regIOobject;
namespace surfaceWriters
{
@ -151,6 +155,9 @@ class boundaryDataWriter
// Private Member Functions
//- Write serial surface geometry to "points" file.
void serialWriteGeometry(const regIOobject&, const meshedSurf& surf);
//- Templated write field operation
template<class Type>
fileName writeTemplate

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -416,11 +416,11 @@ bool Foam::surfaceWriter::empty() const
Foam::label Foam::surfaceWriter::size() const
{
const bool value =
const label value =
(
useComponents_
? surfComp_.faces().empty()
: surf_.get().faces().empty()
? surfComp_.faces().size()
: surf_.get().faces().size()
);
return (parallel_ ? returnReduce(value, sumOp<label>()) : value);

View File

@ -140,17 +140,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
if (mesh_.nSolutionD() == 2)
{
// Omega for 2D
omega_ = deltaPhi;
// dAve for 2D
dAve_ = vector
(
2*sinPhi*Foam::sin(0.5*deltaPhi),
2*cosPhi*Foam::sin(0.5*deltaPhi),
0
);
vector meshDir(Zero);
if (dom_.meshOrientation() != vector::zero)
{
@ -172,7 +161,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = coordRot & dAve_;
d_ = coordRot & d_;
}
else if (mesh_.nSolutionD() == 1)
{
@ -195,9 +183,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = (dAve_ & normal)*meshDir;
d_ = (d_ & normal)*meshDir;
// Omega normalization for 1D
omega_ /= 2;
}
autoPtr<volScalarField> IDefaultPtr;

View File

@ -136,7 +136,7 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs)
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres();
const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{

View File

@ -155,7 +155,7 @@ void Foam::faceShading::calculate()
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres();
const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{

View File

@ -72,16 +72,16 @@ Foam::liquidProperties::liquidProperties
Foam::liquidProperties::liquidProperties(const dictionary& dict)
:
thermophysicalProperties(dict),
Tc_(dict.get<label>("Tc")),
Pc_(dict.get<label>("Pc")),
Vc_(dict.get<label>("Vc")),
Zc_(dict.get<label>("Zc")),
Tt_(dict.get<label>("Tt")),
Pt_(dict.get<label>("Pt")),
Tb_(dict.get<label>("Tb")),
dipm_(dict.get<label>("dipm")),
omega_(dict.get<label>("omega")),
delta_(dict.get<label>("delta"))
Tc_(dict.get<scalar>("Tc")),
Pc_(dict.get<scalar>("Pc")),
Vc_(dict.get<scalar>("Vc")),
Zc_(dict.get<scalar>("Zc")),
Tt_(dict.get<scalar>("Tt")),
Pt_(dict.get<scalar>("Pt")),
Tb_(dict.get<scalar>("Tb")),
dipm_(dict.get<scalar>("dipm")),
omega_(dict.get<scalar>("omega")),
delta_(dict.get<scalar>("delta"))
{}

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.
@ -77,7 +77,7 @@ void Foam::solidProperties::readIfPresent(const dictionary& dict)
dict.readIfPresent("rho", rho_);
dict.readIfPresent("Cp", Cp_);
dict.readIfPresentCompat("kappa", {{"K", 1612}}, kappa_);
dict.readIfPresent("Hf_", Hf_);
dict.readIfPresent("Hf", Hf_);
dict.readIfPresent("emissivity", emissivity_);
dict.readIfPresent("W", W_);
}

View File

@ -7,6 +7,9 @@ cd "${0%/*}" || exit # Run from this directory
runApplication $(getApplication)
./createGraphs
if notTest "$@"
then
./createGraphs
fi
#------------------------------------------------------------------------------

View File

@ -27,7 +27,6 @@ boundaryField
outOfBounds clamp;
direction in;
readerType openFoam;
hasHeaderLine true;
file "<constant>/FluxVsdP.dat";
//nonDimensional true;
//rpm 300;

Some files were not shown because too many files have changed in this diff Show More