Compare commits

...

12 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
13 changed files with 144 additions and 86 deletions

View File

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

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

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

@ -1034,16 +1034,6 @@ 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
@ -1061,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;
@ -1140,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

@ -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,29 +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);
// Point data? Should probably disallow
if (sampledPtr_)
{
surfaceWriterPtr_->isPointData() =
sampledPtr_->interpolate();
}
surfaceWriterPtr_->nFields() = 1; // Needed for VTK legacy
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

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