MRFZone: Add regex and group support to the specification of nonRotatingPatches

This commit is contained in:
Henry
2015-04-26 16:38:07 +01:00
parent 7bfa1dce7c
commit dc5ed4cc1b
4 changed files with 16 additions and 27 deletions

View File

@ -240,12 +240,12 @@ Foam::MRFZone::MRFZone
mesh_(mesh), mesh_(mesh),
name_(name), name_(name),
coeffs_(dict), coeffs_(dict),
active_(true), active_(coeffs_.lookupOrDefault("active", true)),
cellZoneName_(cellZoneName), cellZoneName_(cellZoneName),
cellZoneID_(), cellZoneID_(),
excludedPatchNames_ excludedPatchNames_
( (
coeffs_.lookupOrDefault("nonRotatingPatches", wordList(0)) wordReList(coeffs_.lookupOrDefault("nonRotatingPatches", wordReList()))
), ),
origin_(coeffs_.lookup("origin")), origin_(coeffs_.lookup("origin")),
axis_(coeffs_.lookup("axis")), axis_(coeffs_.lookup("axis")),
@ -253,7 +253,6 @@ Foam::MRFZone::MRFZone
{ {
if (cellZoneName_ == word::null) if (cellZoneName_ == word::null)
{ {
coeffs_.lookup("active") >> active_;
coeffs_.lookup("cellZone") >> cellZoneName_; coeffs_.lookup("cellZone") >> cellZoneName_;
} }
@ -265,32 +264,19 @@ Foam::MRFZone::MRFZone
{ {
cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
axis_ = axis_/mag(axis_); axis_ = axis_/mag(axis_);
excludedPatchLabels_.setSize(excludedPatchNames_.size()); const labelHashSet excludedPatchSet
forAll(excludedPatchNames_, i)
{
excludedPatchLabels_[i] =
patches.findPatchID(excludedPatchNames_[i]);
if (excludedPatchLabels_[i] == -1)
{
FatalErrorIn
( (
"MRFZone" mesh_.boundaryMesh().patchSet(excludedPatchNames_)
"(" );
"const word&, "
"const fvMesh&, " excludedPatchLabels_.setSize(excludedPatchSet.size());
"const dictionary&, "
"const word&" label i = 0;
")" forAllConstIter(labelHashSet, excludedPatchSet, iter)
) {
<< "cannot find MRF patch " << excludedPatchNames_[i] excludedPatchLabels_[i++] = iter.key();
<< exit(FatalError);
}
} }
bool cellZoneFound = (cellZoneID_ != -1); bool cellZoneFound = (cellZoneID_ != -1);
@ -585,7 +571,7 @@ bool Foam::MRFZone::read(const dictionary& dict)
{ {
coeffs_ = dict; coeffs_ = dict;
active_ = readBool(coeffs_.lookup("active")); active_ = coeffs_.lookupOrDefault("active", true);
coeffs_.lookup("cellZone") >> cellZoneName_; coeffs_.lookup("cellZone") >> cellZoneName_;
cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);

View File

@ -85,7 +85,8 @@ class MRFZone
//- Cell zone ID //- Cell zone ID
label cellZoneID_; label cellZoneID_;
const wordList excludedPatchNames_; const wordReList excludedPatchNames_;
labelList excludedPatchLabels_; labelList excludedPatchLabels_;
//- Internal faces that are part of MRF //- Internal faces that are part of MRF

View File

@ -45,6 +45,7 @@ namespace fv
} }
} }
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::fv::MRFSource::initialise() void Foam::fv::MRFSource::initialise()

View File

@ -24,6 +24,7 @@ MRF1
MRFSourceCoeffs MRFSourceCoeffs
{ {
active true;
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 104.72; omega 104.72;