diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 4e905b8581..443469a4b8 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -240,12 +240,12 @@ Foam::MRFZone::MRFZone mesh_(mesh), name_(name), coeffs_(dict), - active_(true), + active_(coeffs_.lookupOrDefault("active", true)), cellZoneName_(cellZoneName), cellZoneID_(), excludedPatchNames_ ( - coeffs_.lookupOrDefault("nonRotatingPatches", wordList(0)) + wordReList(coeffs_.lookupOrDefault("nonRotatingPatches", wordReList())) ), origin_(coeffs_.lookup("origin")), axis_(coeffs_.lookup("axis")), @@ -253,7 +253,6 @@ Foam::MRFZone::MRFZone { if (cellZoneName_ == word::null) { - coeffs_.lookup("active") >> active_; coeffs_.lookup("cellZone") >> cellZoneName_; } @@ -265,32 +264,19 @@ Foam::MRFZone::MRFZone { cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); - const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - axis_ = axis_/mag(axis_); - excludedPatchLabels_.setSize(excludedPatchNames_.size()); + const labelHashSet excludedPatchSet + ( + mesh_.boundaryMesh().patchSet(excludedPatchNames_) + ); - forAll(excludedPatchNames_, i) + excludedPatchLabels_.setSize(excludedPatchSet.size()); + + label i = 0; + forAllConstIter(labelHashSet, excludedPatchSet, iter) { - excludedPatchLabels_[i] = - patches.findPatchID(excludedPatchNames_[i]); - - if (excludedPatchLabels_[i] == -1) - { - FatalErrorIn - ( - "MRFZone" - "(" - "const word&, " - "const fvMesh&, " - "const dictionary&, " - "const word&" - ")" - ) - << "cannot find MRF patch " << excludedPatchNames_[i] - << exit(FatalError); - } + excludedPatchLabels_[i++] = iter.key(); } bool cellZoneFound = (cellZoneID_ != -1); @@ -585,7 +571,7 @@ bool Foam::MRFZone::read(const dictionary& dict) { coeffs_ = dict; - active_ = readBool(coeffs_.lookup("active")); + active_ = coeffs_.lookupOrDefault("active", true); coeffs_.lookup("cellZone") >> cellZoneName_; cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index 1396914122..bc30ab7b4f 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -85,7 +85,8 @@ class MRFZone //- Cell zone ID label cellZoneID_; - const wordList excludedPatchNames_; + const wordReList excludedPatchNames_; + labelList excludedPatchLabels_; //- Internal faces that are part of MRF diff --git a/src/fvOptions/sources/derived/MRFSource/MRFSource.C b/src/fvOptions/sources/derived/MRFSource/MRFSource.C index 71343060f9..aa66d5cd13 100644 --- a/src/fvOptions/sources/derived/MRFSource/MRFSource.C +++ b/src/fvOptions/sources/derived/MRFSource/MRFSource.C @@ -45,6 +45,7 @@ namespace fv } } + // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // void Foam::fv::MRFSource::initialise() diff --git a/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions b/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions index f55734732b..fcc3323ce5 100644 --- a/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions +++ b/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions @@ -24,6 +24,7 @@ MRF1 MRFSourceCoeffs { + active true; origin (0 0 0); axis (0 0 1); omega 104.72;