Compare commits

...

1 Commits

18 changed files with 77 additions and 18 deletions

View File

@ -67,7 +67,8 @@ Foam::functionObjects::Curle::Curle
c0_(0), c0_(0),
rawFilePtrs_(), rawFilePtrs_(),
inputSurface_(), inputSurface_(),
surfaceWriterPtr_(nullptr) surfaceWriterPtr_(nullptr),
warnOnNoPatch_(true)
{ {
read(dict); read(dict);
} }
@ -85,8 +86,10 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict)
} }
dict.readIfPresent("p", pName_); dict.readIfPresent("p", pName_);
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
patchIDs_ = pbm.patchSet(dict.get<wordRes>("patches")).sortedToc(); patchIDs_ =
pbm.patchSet(dict.get<wordRes>("patches"), warnOnNoPatch_).sortedToc();
if (patchIDs_.empty()) if (patchIDs_.empty())
{ {

View File

@ -181,6 +181,9 @@ class Curle
//- Ouput surface when sampling a surface //- Ouput surface when sampling a surface
autoPtr<surfaceWriter> surfaceWriterPtr_; autoPtr<surfaceWriter> surfaceWriterPtr_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
public: public:

View File

@ -122,6 +122,7 @@ Foam::binModel::binModel
mesh_(mesh), mesh_(mesh),
decomposePatchValues_(false), decomposePatchValues_(false),
cumulative_(false), cumulative_(false),
warnOnNoPatch_(true),
coordSysPtr_(nullptr), coordSysPtr_(nullptr),
nBin_(1) nBin_(1)
{} {}
@ -138,8 +139,11 @@ bool Foam::binModel::read(const dictionary& dict)
return false; return false;
} }
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
// Can also use pbm.indices(), but no warnings... // Can also use pbm.indices(), but no warnings...
patchIDs_ = pbm.patchSet(dict.get<wordRes>("patches")).sortedToc(); patchIDs_ =
pbm.patchSet(dict.get<wordRes>("patches"), warnOnNoPatch_).sortedToc();
fieldNames_ = dict.get<wordHashSet>("fields").sortedToc(); fieldNames_ = dict.get<wordHashSet>("fields").sortedToc();
wordRes zoneNames; wordRes zoneNames;

View File

@ -77,6 +77,9 @@ protected:
//- increasing distance in binning direction //- increasing distance in binning direction
bool cumulative_; bool cumulative_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
//- Local coordinate system of bins //- Local coordinate system of bins
autoPtr<coordinateSystem> coordSysPtr_; autoPtr<coordinateSystem> coordSysPtr_;

View File

@ -128,7 +128,8 @@ Foam::functionObjects::columnAverage::columnAverage
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
patchIDs_(), patchIDs_(),
fieldSet_(mesh_) fieldSet_(mesh_),
warnOnNoPatch_(true)
{ {
read(dict); read(dict);
} }
@ -140,10 +141,13 @@ bool Foam::functionObjects::columnAverage::read(const dictionary& dict)
{ {
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
patchIDs_ = patchIDs_ =
mesh_.boundaryMesh().patchSet mesh_.boundaryMesh().patchSet
( (
dict.get<wordRes>("patches") dict.get<wordRes>("patches"),
warnOnNoPatch_
).sortedToc(); ).sortedToc();
fieldSet_.read(dict); fieldSet_.read(dict);

View File

@ -132,6 +132,9 @@ class columnAverage
mutable autoPtr<globalIndex> globalPoints_; mutable autoPtr<globalIndex> globalPoints_;
mutable autoPtr<meshStructure> meshStructurePtr_; mutable autoPtr<meshStructure> meshStructurePtr_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
// Private Member Functions // Private Member Functions

View File

@ -51,7 +51,8 @@ Foam::heatTransferCoeffModel::heatTransferCoeffModel
: :
mesh_(mesh), mesh_(mesh),
TName_(TName), TName_(TName),
qrName_("qr") qrName_("qr"),
warnOnNoPatch_(true)
{} {}
@ -150,8 +151,10 @@ bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
dict.readIfPresent("qr", qrName_); dict.readIfPresent("qr", qrName_);
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
patchIDs_ = pbm.patchSet(dict.get<wordRes>("patches")).sortedToc(); patchIDs_ =
pbm.patchSet(dict.get<wordRes>("patches"), warnOnNoPatch_).sortedToc();
return true; return true;
} }

View File

@ -76,6 +76,9 @@ protected:
//- Name of radiative heat flux field //- Name of radiative heat flux field
word qrName_; word qrName_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
// Protected Member Functions // Protected Member Functions

View File

@ -245,7 +245,8 @@ Foam::functionObjects::nearWallFields::nearWallFields
) )
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
fieldSet_() fieldSet_(),
warnOnNoPatch_(true)
{ {
read(dict); read(dict);
} }
@ -261,9 +262,11 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
dict.readEntry("fields", fieldSet_); dict.readEntry("fields", fieldSet_);
dict.readEntry("distance", distance_); dict.readEntry("distance", distance_);
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
// Can also use pbm.indices(), but no warnings... // Can also use pbm.indices(), but no warnings...
patchIDs_ = pbm.patchSet(dict.get<wordRes>("patches")).sortedToc(); patchIDs_ =
pbm.patchSet(dict.get<wordRes>("patches"), warnOnNoPatch_).sortedToc();
// Clear out any previously loaded fields // Clear out any previously loaded fields

View File

@ -134,6 +134,9 @@ protected:
//- From resulting back to original field //- From resulting back to original field
HashTable<word> reverseFieldMap_; HashTable<word> reverseFieldMap_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
// Calculated addressing // Calculated addressing

View File

@ -206,7 +206,10 @@ Foam::functionObjects::regionSizeDistribution::findPatchRegions
labelHashSet patchRegions(2*regions.nRegions()); labelHashSet patchRegions(2*regions.nRegions());
labelHashSet patchSet(mesh_.boundaryMesh().patchSet(patchNames_)); labelHashSet patchSet
(
mesh_.boundaryMesh().patchSet(patchNames_, warnOnNoPatch_)
);
for (const label patchi : patchSet) for (const label patchi : patchSet)
{ {
@ -369,7 +372,8 @@ Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
writeFile(obr_, name), writeFile(obr_, name),
alphaName_(dict.get<word>("field")), alphaName_(dict.get<word>("field")),
patchNames_(dict.get<wordRes>("patches")), patchNames_(dict.get<wordRes>("patches")),
isoPlanes_(dict.getOrDefault("isoPlanes", false)) isoPlanes_(dict.getOrDefault("isoPlanes", false)),
warnOnNoPatch_(true)
{ {
read(dict); read(dict);
} }
@ -416,6 +420,8 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
direction_.normalise(); direction_.normalise();
} }
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
return true; return true;
} }

View File

@ -249,6 +249,9 @@ class regionSizeDistribution
//- Switch to enable iso-planes sampling //- Switch to enable iso-planes sampling
bool isoPlanes_; bool isoPlanes_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
// Private Member Functions // Private Member Functions

View File

@ -106,7 +106,8 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name, typeName, dict), writeFile(obr_, name, typeName, dict),
qrName_("qr") qrName_("qr"),
warnOnNoPatch_(true)
{ {
read(dict); read(dict);
@ -144,12 +145,13 @@ bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
writeFile::read(dict); writeFile::read(dict);
dict.readIfPresent("qr", qrName_); dict.readIfPresent("qr", qrName_);
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
wordRes patchNames; wordRes patchNames;
labelHashSet patchSet; labelHashSet patchSet;
if (dict.readIfPresent("patches", patchNames) && !patchNames.empty()) if (dict.readIfPresent("patches", patchNames) && !patchNames.empty())
{ {
patchSet = pbm.patchSet(patchNames); patchSet = pbm.patchSet(patchNames, warnOnNoPatch_);
} }
labelHashSet allWalls(pbm.findPatchIDs<wallPolyPatch>()); labelHashSet allWalls(pbm.findPatchIDs<wallPolyPatch>());

View File

@ -123,6 +123,9 @@ protected:
//- Name of radiative heat flux name //- Name of radiative heat flux name
word qrName_; word qrName_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
// Protected Member Functions // Protected Member Functions

View File

@ -90,7 +90,8 @@ Foam::functionObjects::wallShearStress::wallShearStress
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
writeFile(mesh_, name, typeName, dict), writeFile(mesh_, name, typeName, dict),
writeFields_(true) // May change in the future writeFields_(true), // May change in the future
warnOnNoPatch_(true)
{ {
read(dict); read(dict);
@ -127,6 +128,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
writeFields_ = true; // May change in the future writeFields_ = true; // May change in the future
dict.readIfPresent("writeFields", writeFields_); dict.readIfPresent("writeFields", writeFields_);
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
@ -134,7 +136,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
labelHashSet patchSet; labelHashSet patchSet;
if (dict.readIfPresent("patches", patchNames) && !patchNames.empty()) if (dict.readIfPresent("patches", patchNames) && !patchNames.empty())
{ {
patchSet = pbm.patchSet(patchNames); patchSet = pbm.patchSet(patchNames, warnOnNoPatch_);
} }
labelHashSet allWalls(pbm.findPatchIDs<wallPolyPatch>()); labelHashSet allWalls(pbm.findPatchIDs<wallPolyPatch>());

View File

@ -133,6 +133,9 @@ class wallShearStress
//- Write the shear stress field ? //- Write the shear stress field ?
bool writeFields_; bool writeFields_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
protected: protected:

View File

@ -550,7 +550,8 @@ Foam::functionObjects::forces::forces
directForceDensity_(false), directForceDensity_(false),
porosity_(false), porosity_(false),
writeFields_(false), writeFields_(false),
initialised_(false) initialised_(false),
warnOnNoPatch_(true)
{ {
if (readFields) if (readFields)
{ {
@ -589,7 +590,8 @@ Foam::functionObjects::forces::forces
directForceDensity_(false), directForceDensity_(false),
porosity_(false), porosity_(false),
writeFields_(false), writeFields_(false),
initialised_(false) initialised_(false),
warnOnNoPatch_(true)
{ {
if (readFields) if (readFields)
{ {
@ -613,10 +615,13 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
initialised_ = false; initialised_ = false;
dict.readIfPresent("warnOnNoPatch", warnOnNoPatch_);
Info<< type() << ' ' << name() << ':' << endl; Info<< type() << ' ' << name() << ':' << endl;
// Can also use pbm.indices(), but no warnings... // Can also use pbm.indices(), but no warnings...
patchIDs_ = pbm.patchSet(dict.get<wordRes>("patches")).sortedToc(); patchIDs_ =
pbm.patchSet(dict.get<wordRes>("patches"), warnOnNoPatch_).sortedToc();
dict.readIfPresent("directForceDensity", directForceDensity_); dict.readIfPresent("directForceDensity", directForceDensity_);
if (directForceDensity_) if (directForceDensity_)

View File

@ -264,6 +264,9 @@ protected:
//- Flag of initialisation (internal) //- Flag of initialisation (internal)
bool initialised_; bool initialised_;
//- Flag to suppress warnings for missing patches
bool warnOnNoPatch_;
// Protected Member Functions // Protected Member Functions