ENH: Adding run time modifiable for MRFZone dictionary

This commit is contained in:
sergio 2012-04-04 15:15:24 +01:00
parent a10bc9b62c
commit 3a066beebb
4 changed files with 76 additions and 10 deletions

View File

@ -32,6 +32,7 @@ License
#include "faceSet.H" #include "faceSet.H"
#include "geometricOneField.H" #include "geometricOneField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::MRFZone, 0); defineTypeNameAndDebug(Foam::MRFZone, 0);
@ -273,8 +274,8 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
} }
} }
bool cellZoneFound = (cellZoneID_ != -1); bool cellZoneFound = (cellZoneID_ != -1);
reduce(cellZoneFound, orOp<bool>()); reduce(cellZoneFound, orOp<bool>());
if (!cellZoneFound) if (!cellZoneFound)
@ -307,6 +308,7 @@ void Foam::MRFZone::addCoriolis
const scalarField& V = mesh_.V(); const scalarField& V = mesh_.V();
vectorField& ddtUc = ddtU.internalField(); vectorField& ddtUc = ddtU.internalField();
const vectorField& Uc = U.internalField(); const vectorField& Uc = U.internalField();
const vector& Omega = Omega_.value(); const vector& Omega = Omega_.value();
forAll(cells, i) forAll(cells, i)
@ -328,6 +330,7 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
const scalarField& V = mesh_.V(); const scalarField& V = mesh_.V();
vectorField& Usource = UEqn.source(); vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi(); const vectorField& U = UEqn.psi();
const vector& Omega = Omega_.value(); const vector& Omega = Omega_.value();
forAll(cells, i) forAll(cells, i)
@ -353,6 +356,7 @@ void Foam::MRFZone::addCoriolis
const scalarField& V = mesh_.V(); const scalarField& V = mesh_.V();
vectorField& Usource = UEqn.source(); vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi(); const vectorField& U = UEqn.psi();
const vector& Omega = Omega_.value(); const vector& Omega = Omega_.value();
forAll(cells, i) forAll(cells, i)
@ -368,6 +372,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
const volVectorField& C = mesh_.C(); const volVectorField& C = mesh_.C();
const vector& origin = origin_.value(); const vector& origin = origin_.value();
const vector& Omega = Omega_.value(); const vector& Omega = Omega_.value();
const labelList& cells = mesh_.cellZones()[cellZoneID_]; const labelList& cells = mesh_.cellZones()[cellZoneID_];
@ -395,7 +400,8 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
{ {
label patchFacei = excludedFaces_[patchi][i]; label patchFacei = excludedFaces_[patchi][i];
U.boundaryField()[patchi][patchFacei] -= 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 volVectorField& C = mesh_.C();
const vector& origin = origin_.value(); const vector& origin = origin_.value();
const vector& Omega = Omega_.value(); const vector& Omega = Omega_.value();
const labelList& cells = mesh_.cellZones()[cellZoneID_]; const labelList& cells = mesh_.cellZones()[cellZoneID_];
@ -475,6 +482,7 @@ void Foam::MRFZone::absoluteFlux
void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
{ {
const vector& origin = origin_.value(); const vector& origin = origin_.value();
const vector& Omega = Omega_.value(); const vector& Omega = Omega_.value();
// Included patches // 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;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -48,6 +48,7 @@ SourceFiles
#include "surfaceFieldsFwd.H" #include "surfaceFieldsFwd.H"
#include "fvMatricesFwd.H" #include "fvMatricesFwd.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,7 +88,7 @@ class MRFZone
const dimensionedVector origin_; const dimensionedVector origin_;
dimensionedVector axis_; dimensionedVector axis_;
const dimensionedScalar omega_; dimensionedScalar omega_;
dimensionedVector Omega_; dimensionedVector Omega_;
@ -205,13 +206,11 @@ public:
void correctBoundaryVelocity(volVectorField& U) const; 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;
}
}; };

View File

@ -49,8 +49,28 @@ Foam::MRFZones::MRFZones(const fvMesh& mesh)
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
MRFZone::iNew(mesh) 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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -52,6 +52,11 @@ class MRFZones
: :
public IOPtrList<MRFZone> public IOPtrList<MRFZone>
{ {
// Private data
//- Reference to mesh
const fvMesh& mesh_;
// Private Member Functions // Private Member Functions
@ -109,6 +114,13 @@ public:
//- Correct the boundary velocity for the roation of the MRF region //- Correct the boundary velocity for the roation of the MRF region
void correctBoundaryVelocity(volVectorField& U) const; void correctBoundaryVelocity(volVectorField& U) const;
// I-O
//- Read from Istream
virtual bool readData(Istream&);
}; };