ENH: Adding run time modifiable for MRFZone dictionary
This commit is contained in:
parent
a10bc9b62c
commit
3a066beebb
@ -32,6 +32,7 @@ License
|
||||
#include "faceSet.H"
|
||||
#include "geometricOneField.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::MRFZone, 0);
|
||||
@ -273,8 +274,8 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool cellZoneFound = (cellZoneID_ != -1);
|
||||
|
||||
reduce(cellZoneFound, orOp<bool>());
|
||||
|
||||
if (!cellZoneFound)
|
||||
@ -307,6 +308,7 @@ void Foam::MRFZone::addCoriolis
|
||||
const scalarField& V = mesh_.V();
|
||||
vectorField& ddtUc = ddtU.internalField();
|
||||
const vectorField& Uc = U.internalField();
|
||||
|
||||
const vector& Omega = Omega_.value();
|
||||
|
||||
forAll(cells, i)
|
||||
@ -328,6 +330,7 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
|
||||
const scalarField& V = mesh_.V();
|
||||
vectorField& Usource = UEqn.source();
|
||||
const vectorField& U = UEqn.psi();
|
||||
|
||||
const vector& Omega = Omega_.value();
|
||||
|
||||
forAll(cells, i)
|
||||
@ -353,6 +356,7 @@ void Foam::MRFZone::addCoriolis
|
||||
const scalarField& V = mesh_.V();
|
||||
vectorField& Usource = UEqn.source();
|
||||
const vectorField& U = UEqn.psi();
|
||||
|
||||
const vector& Omega = Omega_.value();
|
||||
|
||||
forAll(cells, i)
|
||||
@ -368,6 +372,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
|
||||
const volVectorField& C = mesh_.C();
|
||||
|
||||
const vector& origin = origin_.value();
|
||||
|
||||
const vector& Omega = Omega_.value();
|
||||
|
||||
const labelList& cells = mesh_.cellZones()[cellZoneID_];
|
||||
@ -395,7 +400,8 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
|
||||
{
|
||||
label patchFacei = excludedFaces_[patchi][i];
|
||||
U.boundaryField()[patchi][patchFacei] -=
|
||||
(Omega ^ (C.boundaryField()[patchi][patchFacei] - origin));
|
||||
(Omega
|
||||
^ (C.boundaryField()[patchi][patchFacei] - origin));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -406,6 +412,7 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const
|
||||
const volVectorField& C = mesh_.C();
|
||||
|
||||
const vector& origin = origin_.value();
|
||||
|
||||
const vector& Omega = Omega_.value();
|
||||
|
||||
const labelList& cells = mesh_.cellZones()[cellZoneID_];
|
||||
@ -475,6 +482,7 @@ void Foam::MRFZone::absoluteFlux
|
||||
void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
|
||||
{
|
||||
const vector& origin = origin_.value();
|
||||
|
||||
const vector& Omega = Omega_.value();
|
||||
|
||||
// Included patches
|
||||
@ -496,4 +504,24 @@ void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const MRFZone& MRF)
|
||||
{
|
||||
os << indent << nl;
|
||||
os.write(MRF.name_) << nl;
|
||||
os << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
os.writeKeyword("origin") << MRF.origin_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("axis") << MRF.axis_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("omega") << MRF.omega_ << token::END_STATEMENT << nl;
|
||||
|
||||
if (MRF.excludedPatchNames_.size())
|
||||
{
|
||||
os.writeKeyword("nonRotatingPatches") << MRF.excludedPatchNames_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
os << decrIndent << token::END_BLOCK << nl;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -48,6 +48,7 @@ SourceFiles
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -87,7 +88,7 @@ class MRFZone
|
||||
|
||||
const dimensionedVector origin_;
|
||||
dimensionedVector axis_;
|
||||
const dimensionedScalar omega_;
|
||||
dimensionedScalar omega_;
|
||||
dimensionedVector Omega_;
|
||||
|
||||
|
||||
@ -205,13 +206,11 @@ public:
|
||||
void correctBoundaryVelocity(volVectorField& U) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
// IOstream operator
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const MRFZone& MRF);
|
||||
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const MRFZone&)
|
||||
{
|
||||
notImplemented("Ostream& operator<<(Ostream& os, const MRFZone&)");
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -49,8 +49,28 @@ Foam::MRFZones::MRFZones(const fvMesh& mesh)
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
MRFZone::iNew(mesh)
|
||||
),
|
||||
mesh_(mesh)
|
||||
{
|
||||
if
|
||||
(
|
||||
Pstream::parRun()
|
||||
&&
|
||||
(
|
||||
regIOobject::fileModificationChecking == timeStampMaster
|
||||
|| regIOobject::fileModificationChecking == inotifyMaster
|
||||
)
|
||||
)
|
||||
{}
|
||||
{
|
||||
WarningIn("MRFZones(const fvMesh&)")
|
||||
<< "The MRFZones are not run time modifiable\n"
|
||||
<< " using 'timeStampMaster' or 'inotifyMaster'\n"
|
||||
<< " for the entry fileModificationChecking\n"
|
||||
<< " in the etc/controlDict.\n"
|
||||
<< " Use 'timeStamp' instead."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -161,4 +181,11 @@ void Foam::MRFZones::correctBoundaryVelocity(volVectorField& U) const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::MRFZones::readData(Istream& is)
|
||||
{
|
||||
PtrList<MRFZone>::read(is, MRFZone::iNew(mesh_));
|
||||
return is.good();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -52,6 +52,11 @@ class MRFZones
|
||||
:
|
||||
public IOPtrList<MRFZone>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -109,6 +114,13 @@ public:
|
||||
|
||||
//- Correct the boundary velocity for the roation of the MRF region
|
||||
void correctBoundaryVelocity(volVectorField& U) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Read from Istream
|
||||
virtual bool readData(Istream&);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user