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

This commit is contained in:
Henry 2015-04-26 16:44:01 +01:00
parent 8f3c293472
commit 0a5f0be87c
5 changed files with 22 additions and 33 deletions

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -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_);

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -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

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -107,13 +107,13 @@ Foam::fv::optionList::optionList(const fvMesh& mesh)
void Foam::fv::optionList::reset(const dictionary& dict)
{
// Count number of active fvOptions
label count = 0;
forAllConstIter(dictionary, dict, iter)
{
// safety:
if (iter().isDict())
{
count ++;
count++;
}
}

View file

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

View file

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -24,6 +24,7 @@ MRF1
MRFSourceCoeffs
{
active true;
origin (0 0 0);
axis (0 0 1);
omega 104.72;