Skip to content
Snippets Groups Projects
Commit 5981540f authored by andy's avatar andy
Browse files

ENH: Updated MRFZone constructor

parent a192c366
Branches
Tags
No related merge requests found
......@@ -230,15 +230,16 @@ Foam::MRFZone::MRFZone
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
mesh_(mesh),
name_(name),
coeffs_(dict),
active_(readBool(coeffs_.lookup("active"))),
cellZoneName_(coeffs_.lookup("cellZone")),
cellZoneID_(mesh_.cellZones().findZoneID(cellZoneName_)),
cellZoneName_(cellZoneName),
cellZoneID_(),
excludedPatchNames_
(
coeffs_.lookupOrDefault("nonRotatingPatches", wordList(0))
......@@ -253,6 +254,13 @@ Foam::MRFZone::MRFZone
}
else
{
if (cellZoneName == word::null)
{
coeffs_.lookup("cellZone") >> cellZoneName_;
}
cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
axis_ = axis_/mag(axis_);
......@@ -268,7 +276,13 @@ Foam::MRFZone::MRFZone
{
FatalErrorIn
(
"MRFZone(const word&, const fvMesh&, const dictionary&)"
"MRFZone"
"("
"const word&, "
"const fvMesh&, "
"const dictionary&, "
"const word&"
")"
)
<< "cannot find MRF patch " << excludedPatchNames_[i]
<< exit(FatalError);
......@@ -283,7 +297,13 @@ Foam::MRFZone::MRFZone
{
FatalErrorIn
(
"MRFZone(const word&, const fvMesh&, const dictionary&)"
"MRFZone"
"("
"const word&, "
"const fvMesh&, "
"const dictionary&, "
"const word&"
")"
)
<< "cannot find MRF cellZone " << cellZoneName_
<< exit(FatalError);
......@@ -328,7 +348,7 @@ void Foam::MRFZone::addCoriolis
}
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn, const bool rhs) const
{
if (cellZoneID_ == -1)
{
......@@ -342,10 +362,21 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
const vector Omega = this->Omega();
forAll(cells, i)
if (rhs)
{
label celli = cells[i];
Usource[celli] -= V[celli]*(Omega ^ U[celli]);
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] += V[celli]*(Omega ^ U[celli]);
}
}
else
{
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] -= V[celli]*(Omega ^ U[celli]);
}
}
}
......@@ -353,7 +384,8 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
void Foam::MRFZone::addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
fvVectorMatrix& UEqn,
const bool rhs
) const
{
if (cellZoneID_ == -1)
......@@ -368,10 +400,21 @@ void Foam::MRFZone::addCoriolis
const vector Omega = this->Omega();
forAll(cells, i)
if (rhs)
{
label celli = cells[i];
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] += V[celli]*rho[celli]*(Omega ^ U[celli]);
}
}
else
{
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
}
}
}
......
......@@ -144,7 +144,13 @@ public:
// Constructors
//- Construct from fvMesh
MRFZone(const word& name, const fvMesh& mesh, const dictionary& dict);
MRFZone
(
const word& name,
const fvMesh& mesh,
const dictionary& dict,
const word& cellZoneName = word::null
);
//- Return clone
autoPtr<MRFZone> clone() const
......@@ -185,13 +191,20 @@ public:
) const;
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const;
// Adds to the lhs of the equation; optionally add to rhs
void addCoriolis
(
fvVectorMatrix& UEqn,
const bool rhs = false
) const;
//- Add the Coriolis force contribution to the momentum equation
// Adds to the lhs of the equation; optionally add to rhs
void addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
fvVectorMatrix& UEqn,
const bool rhs = false
) const;
//- Make the given absolute velocity relative within the MRF region
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment