Compare commits

..

20 Commits

Author SHA1 Message Date
6740925621 CONFIG: bump patch level 2021-04-14 20:09:25 +02:00
19b90a1130 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:35:41 +02:00
21dda3254c BUG: noiseModel - respect lower frequency bound in octave calculation. Fixes #2041 2021-03-23 17:12:43 +00:00
dbed3a0602 BUG: Curle FO - corrected division by 4pi. Fixes #2035 2021-03-18 16:41:40 +00:00
8d3efa1cb9 BUG: AABBTree - corrected addressing. Fixes #2028 2021-03-16 12:27:38 +00:00
a8c9b5936e BUG: cannot set expression from command-line (fixes #2012) 2021-02-25 08:29:15 +01:00
a334aaae78 ENH: noiseModel gainX - protect against very small input frequencies 2021-02-15 12:51:35 +00:00
ae8ccd7b94 BUG: foamToEnsight cellZones missing mesh coverage (closes #2002) 2021-02-15 13:10:01 +01:00
0ee7a23504 CONFIG: ensure PV_PLUGIN_PATH is also in the library path 2021-02-15 13:09:58 +01:00
9913dfb31a CONFIG: bump patch level 2021-02-10 13:48:10 +01:00
77c31a7bef BUG: inconsistent surfaceFieldValue writing (fixes #1999)
- setup writer outside the data loop to ensure that the number of
  output fields is correct (VTK format).

- ignore 'interpolate' on sampled surfaces to ensure proper
  face sampling, never allow point sampling

BUG: incorrect debug-switch for sampledIsoSurface
2021-02-10 13:47:53 +01:00
4245909efb BUG: typo in etc/colourTables 2021-02-03 15:05:36 +01:00
d70e11195c BUG: syncTools: incorrect communicator. See #1986 2021-01-26 10:28:12 +01:00
f88feaf0d4 BUG: surfaceFieldValue fails writing legacy VTK format
- number of fields was not set.
- interpolated surfaces incorrectly written for all formats
2021-01-22 16:20:46 +01:00
c9b34c52bb COMP: bad template for foamNewFunctionObject (closes #1987) 2021-01-22 12:46:31 +01:00
81629a44d0 BUG: mapped: access map() for AMI cases. Fixes #1982
Should not call map() since it triggers building the
(one-to-one) mapping which conflicts with the self-contained
mapping of cyclicAMI
2021-01-18 18:19:24 +00:00
4561717c51 BUG: incorrect returned size from surfaceWriter 2021-01-13 18:05:31 +01:00
b84caecc1e BUG: useless copy of input (primitiveMeshTools::makeCellCentresAndVols) 2021-01-08 08:59:27 +01:00
d2c0c97af8 BUG: redistributePar: symmetric logic. Fixes #1973. 2021-01-04 14:42:10 +00:00
2f449c57ce DOC: adjust wording 2021-01-03 17:21:14 +01:00
22 changed files with 171 additions and 93 deletions

View File

@ -1,2 +1,2 @@
api=2012
patch=0
patch=210414

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.
@ -813,7 +813,9 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
for (auto& pfld : bfld)
{
if (pfld.patch().coupled())
const auto& fvp = pfld.patch();
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
{
pfld.evaluate(Pstream::defaultCommsType);
}

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
);

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

@ -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

@ -44,7 +44,7 @@ coldAndHot
fire
{
// ParaView: Black-Body Radiation
interpolate rbg;
interpolate rgb;
table
(
@ -70,7 +70,7 @@ rainbow
greyscale
{
// ParaView: grayscale
interpolate rbg;
interpolate rgb;
table
(
@ -82,7 +82,7 @@ greyscale
xray
{
// ParaView: "X ray"
interpolate rbg;
interpolate rgb;
table
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -136,8 +136,8 @@ public:
// Read Functions
//- Read into given buffer from given processor and return the
// message size
//- Read into given buffer from given processor
// \return the message size
static label read
(
const commsTypes commsType,
@ -145,7 +145,7 @@ public:
char* buf,
const std::streamsize bufSize,
const int tag = UPstream::msgType(),
const label communicator = 0
const label communicator = UPstream::worldComm
);
//- Return next token from stream

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2014 OpenFOAM Foundation
Copyright (C) 2017-2018 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -104,7 +104,7 @@ public:
// Constructors
//- Construct given process index to send to and optional buffer size,
// write format and IO version
//- write format and IO version
UOPstream
(
const commsTypes commsType,
@ -146,7 +146,7 @@ public:
const char* buf,
const std::streamsize bufSize,
const int tag = UPstream::msgType(),
const label communicator = 0
const label communicator = UPstream::worldComm
);
//- Write token to stream or otherwise handle it.

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-2016, 2020 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -118,6 +118,7 @@ Foam::labelList Foam::polyMesh::facePatchFaceCells
{
FatalErrorInFunction
<< "face " << fI << " in patch " << patchID
<< " vertices " << UIndirectList<point>(points(), curFace)
<< " does not have neighbour cell"
<< " face: " << patchFaces[fI]
<< abort(FatalError);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -114,9 +114,9 @@ void Foam::primitiveMeshTools::makeCellCentresAndVols
{
typedef Vector<solveScalar> solveVector;
PrecisionAdaptor<solveVector, vector> tcellCtrs(cellCtrs_s);
PrecisionAdaptor<solveVector, vector> tcellCtrs(cellCtrs_s, false);
PrecisionAdaptor<solveScalar, scalar> tcellVols(cellVols_s, false);
Field<solveVector>& cellCtrs = tcellCtrs.ref();
PrecisionAdaptor<solveScalar, scalar> tcellVols(cellVols_s);
Field<solveScalar>& cellVols = tcellVols.ref();
// Clear the fields for accumulation

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

@ -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.
@ -220,6 +220,9 @@ bool Foam::functionObjects::Curle::execute()
sum((pp*sqr(invMagR) + invMagR/c0_*dpdtp)*(Sfp & r));
}
}
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.
@ -1051,15 +1051,6 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
if (usesWeight())
{
if (stSampled == regionType_)
{
FatalIOErrorInFunction(dict)
<< "Cannot use weighted operation '"
<< operationTypeNames_[operation_]
<< "' for sampledSurface"
<< exit(FatalIOError);
}
// Can have "weightFields" or "weightField"
bool missing = true;
@ -1130,6 +1121,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
)
);
// Propagate field counts (per surface)
surfaceWriterPtr_->nFields() = fields_.size();
if (debug)
{
surfaceWriterPtr_->verbose(true);

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.
@ -96,18 +96,13 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
if (sampledPtr_)
{
if (sampledPtr_->interpolate())
{
const interpolationCellPoint<Type> interp(fld);
// Could be runtime selectable
// auto sampler = interpolation<Type>::New(sampleFaceScheme_, fld);
return sampledPtr_->interpolate(interp);
}
else
{
const interpolationCell<Type> interp(fld);
// const interpolationCellPoint<Type> interp(fld);
const interpolationCell<Type> interp(fld);
return sampledPtr_->sample(interp);
}
return sampledPtr_->sample(interp);
}
else
{
@ -324,6 +319,30 @@ Foam::label Foam::functionObjects::fieldValues::surfaceFieldValue::writeAll
{
label nProcessed = 0;
// If using the surface writer, the points/faces parameters have already
// been merged on the master and the writeValues routine will also gather
// all data onto the master before calling the writer.
// Thus only call the writer on master!
// Begin writer time step
if (Pstream::master() && surfaceWriterPtr_ && surfaceWriterPtr_->enabled())
{
auto& writer = *surfaceWriterPtr_;
writer.open
(
points,
faces,
(
outputDir()
/ regionTypeNames_[regionType_] + ("_" + regionName_)
),
false // serial - already merged
);
writer.beginTime(time_);
}
for (const word& fieldName : fields_)
{
if
@ -349,6 +368,23 @@ Foam::label Foam::functionObjects::fieldValues::surfaceFieldValue::writeAll
}
}
// Finish writer time step
if (Pstream::master() && surfaceWriterPtr_ && surfaceWriterPtr_->enabled())
{
auto& writer = *surfaceWriterPtr_;
// Write geometry if no fields were written so that we still
// can have something to look at.
if (!writer.wroteData())
{
writer.write();
}
writer.endTime();
writer.clear();
}
return nProcessed;
}
@ -377,20 +413,13 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
if (Pstream::master())
{
surfaceWriterPtr_->open
(
points,
faces,
(
outputDir()
/ regionTypeNames_[regionType_] + ("_" + regionName_)
),
false // serial - already merged
);
fileName outputName =
surfaceWriterPtr_->write(fieldName, allValues);
surfaceWriterPtr_->write(fieldName, allValues);
surfaceWriterPtr_->clear();
// Case-local file name with "<case>" to make relocatable
dictionary propsDict;
propsDict.add("file", time_.relativePath(outputName, true));
this->setProperty(fieldName, propsDict);
}
}

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

@ -29,7 +29,7 @@ template<class Type>
void Foam::mappedPatchBase::distribute(List<Type>& lst) const
{
const label oldComm(Pstream::warnComm);
Pstream::warnComm = map().comm();
Pstream::warnComm = comm_;
switch (mode_)
{
case NEARESTPATCHFACEAMI:
@ -96,7 +96,7 @@ template<class Type>
void Foam::mappedPatchBase::reverseDistribute(List<Type>& lst) const
{
const label oldComm(Pstream::warnComm);
Pstream::warnComm = map().comm();
Pstream::warnComm = comm_;
switch (mode_)
{
case NEARESTPATCHFACEAMI:
@ -125,7 +125,7 @@ void Foam::mappedPatchBase::reverseDistribute
) const
{
const label oldComm(Pstream::warnComm);
Pstream::warnComm = map().comm();
Pstream::warnComm = comm_;
switch (mode_)
{
case NEARESTPATCHFACEAMI:

View File

@ -81,6 +81,10 @@ void Foam::noiseModel::setOctaveBands
// Convert to lower band limit
fTest /= fRatioL2C;
while (fTest < fLower)
{
fTest *= fRatio;
}
forAll(f, i)
{
@ -434,6 +438,11 @@ Foam::scalar Foam::noiseModel::RAf(const scalar f) const
Foam::scalar Foam::noiseModel::gainA(const scalar f) const
{
if (f < SMALL)
{
return 0;
}
return 20*log10(RAf(f)) - 20*log10(RAf(1000));
}
@ -456,6 +465,11 @@ Foam::scalar Foam::noiseModel::RBf(const scalar f) const
Foam::scalar Foam::noiseModel::gainB(const scalar f) const
{
if (f < SMALL)
{
return 0;
}
return 20*log10(RBf(f)) - 20*log10(RBf(1000));
}
@ -473,6 +487,11 @@ Foam::scalar Foam::noiseModel::RCf(const scalar f) const
Foam::scalar Foam::noiseModel::gainC(const scalar f) const
{
if (f < SMALL)
{
return 0;
}
return 20*log10(RCf(f)) - 20*log10(RCf(1000));
}
@ -492,6 +511,11 @@ Foam::scalar Foam::noiseModel::RDf(const scalar f) const
Foam::scalar Foam::noiseModel::gainD(const scalar f) const
{
if (f < SMALL)
{
return 0;
}
return 20*log10(RDf(f));
}

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.
@ -215,7 +215,7 @@ protected:
public:
//- Runtime type information
TypeName("samplediIsoSurfacePoint");
TypeName("sampledIsoSurface");
// Constructors

View File

@ -27,8 +27,7 @@ Class
Foam::sampledFaceZone
Description
A sampledSurface defined by the cell faces corresponding to a threshold
value.
A sampledSurface defined by a faceZone or faceZones.
This is often embedded as part of a sampled surfaces function object.
@ -287,7 +286,6 @@ public:
) const;
// Interpolate
//- Interpolate volume field onto surface points

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);