Update for cylindrical CS and default inDegrees check

This commit is contained in:
Hrvoje Jasak 2011-10-05 16:58:28 +01:00
parent af22a03990
commit 5d3596b25e
8 changed files with 107 additions and 47 deletions

View file

@ -255,17 +255,30 @@ Foam::mixerGgiFvMesh::mixerGgiFvMesh
) )
).subDict(typeName + "Coeffs") ).subDict(typeName + "Coeffs")
), ),
csPtr_ cs_
( (
coordinateSystem::New "coordinateSystem",
( dict_.subDict("coordinateSystem")
"coordinateSystem",
dict_.subDict("coordinateSystem")
)
), ),
rpm_(readScalar(dict_.lookup("rpm"))), rpm_(readScalar(dict_.lookup("rpm"))),
movingPointsMaskPtr_(NULL) movingPointsMaskPtr_(NULL)
{ {
// Make sure the coordinate system does not operate in degrees
// Bug fix, HJ, 3/Oct/2011
if (!cs_.inDegrees())
{
WarningIn("mixerGgiFvMesh::mixerGgiFvMesh(const IOobject& io)")
<< "Mixer coordinate system is set to operate in radians. "
<< "Changing to rad for correct calculation of angular velocity."
<< nl
<< "To remove this message please add entry" << nl << nl
<< "inDegrees true;" << nl << nl
<< "to the specification of the coordinate system"
<< endl;
cs_.inDegrees() = true;
}
addZonesAndModifiers(); addZonesAndModifiers();
Info<< "Mixer mesh:" << nl Info<< "Mixer mesh:" << nl
@ -299,12 +312,12 @@ const Foam::scalarField& Foam::mixerGgiFvMesh::movingPointsMask() const
bool Foam::mixerGgiFvMesh::update() bool Foam::mixerGgiFvMesh::update()
{ {
// Rotational speed needs to be converted from rpm // Rotational speed needs to be converted from rpm
movePoints movePoints
( (
csPtr_->globalPosition cs_.globalPosition
( (
csPtr_->localPosition(allPoints()) cs_.localPosition(allPoints())
+ vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0) + vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0)
*movingPointsMask() *movingPointsMask()
) )

View file

@ -61,7 +61,7 @@ class mixerGgiFvMesh
dictionary dict_; dictionary dict_;
//- Coordinate system //- Coordinate system
autoPtr<coordinateSystem> csPtr_; cylindricalCS cs_;
// - Rotational speed in rotations per minute (rpm) // - Rotational speed in rotations per minute (rpm)
scalar rpm_; scalar rpm_;
@ -109,9 +109,9 @@ public:
// Member Functions // Member Functions
//- Return coordinate system //- Return coordinate system
const coordinateSystem& cs() const const cylindricalCS& cs() const
{ {
return csPtr_(); return cs_;
} }
//- Update the mesh for both mesh motion //- Update the mesh for both mesh motion

View file

@ -173,16 +173,30 @@ Foam::turboFvMesh::turboFvMesh
) )
).subDict(typeName + "Coeffs") ).subDict(typeName + "Coeffs")
), ),
csPtr_ cs_
( (
coordinateSystem::New "coordinateSystem",
( dict_.subDict("coordinateSystem")
"coordinateSystem",
dict_.subDict("coordinateSystem")
)
), ),
movingPointsPtr_(NULL) movingPointsPtr_(NULL)
{ {
// Make sure the coordinate system does not operate in degrees
// Bug fix, HJ, 3/Oct/2011
if (!cs_.inDegrees())
{
WarningIn("turboFvMesh::turboFvMesh(const IOobject& io)")
<< "Mixer coordinate system is set to operate in radians. "
<< "Changing to rad for correct calculation of angular velocity."
<< nl
<< "To remove this message please add entry" << nl << nl
<< "inDegrees true;" << nl << nl
<< "to the specification of the coordinate system"
<< endl;
cs_.inDegrees() = true;
}
Info<< "Turbomachine Mixer mesh:" << nl Info<< "Turbomachine Mixer mesh:" << nl
<< " origin: " << cs().origin() << nl << " origin: " << cs().origin() << nl
<< " axis : " << cs().axis() << endl; << " axis : " << cs().axis() << endl;
@ -215,9 +229,9 @@ bool Foam::turboFvMesh::update()
{ {
movePoints movePoints
( (
csPtr_->globalPosition cs_.globalPosition
( (
csPtr_->localPosition(allPoints()) cs_.localPosition(allPoints())
+ movingPoints()*time().deltaT().value() + movingPoints()*time().deltaT().value()
) )
); );

View file

@ -83,7 +83,7 @@ class turboFvMesh
dictionary dict_; dictionary dict_;
//- Coordinate system //- Coordinate system
autoPtr<coordinateSystem> csPtr_; cylindricalCS cs_;
//- Markup field for points. //- Markup field for points.
mutable vectorField* movingPointsPtr_; mutable vectorField* movingPointsPtr_;
@ -124,9 +124,9 @@ public:
// Member Functions // Member Functions
//- Return coordinate system //- Return coordinate system
const coordinateSystem& cs() const const cylindricalCS& cs() const
{ {
return csPtr_(); return cs_;
} }
//- Update the mesh for both mesh motion //- Update the mesh for both mesh motion

View file

@ -380,22 +380,35 @@ Foam::mixerFvMesh::mixerFvMesh
) )
).subDict(typeName + "Coeffs") ).subDict(typeName + "Coeffs")
), ),
csPtr_ cs_
( (
coordinateSystem::New "coordinateSystem",
( dict_.subDict("coordinateSystem")
"coordinateSystem",
dict_.subDict("coordinateSystem")
)
), ),
rpm_(readScalar(dict_.lookup("rpm"))), rpm_(readScalar(dict_.lookup("rpm"))),
rotatingRegionMarker_ rotatingRegionMarker_
( (
dict_.lookupOrDefault<point>("rotatingRegionMarker", csPtr_->origin()) dict_.lookupOrDefault<point>("rotatingRegionMarker", cs_.origin())
), ),
attachDetach_(dict_.lookupOrDefault<bool>("attachDetach", false)), attachDetach_(dict_.lookupOrDefault<bool>("attachDetach", false)),
movingPointsMaskPtr_(NULL) movingPointsMaskPtr_(NULL)
{ {
// Make sure the coordinate system does not operate in degrees
// Bug fix, HJ, 3/Oct/2011
if (!cs_.inDegrees())
{
WarningIn("mixerFvMesh::mixerFvMesh(const IOobject& io)")
<< "Mixer coordinate system is set to operate in radians. "
<< "Changing to rad for correct calculation of angular velocity."
<< nl
<< "To remove this message please add entry" << nl << nl
<< "inDegrees true;" << nl << nl
<< "to the specification of the coordinate system"
<< endl;
cs_.inDegrees() = true;
}
Info<< "Rotating region marker point: " << rotatingRegionMarker_ Info<< "Rotating region marker point: " << rotatingRegionMarker_
<< " Attach-detach action = " << attachDetach_ << endl; << " Attach-detach action = " << attachDetach_ << endl;
@ -438,9 +451,9 @@ bool Foam::mixerFvMesh::update()
// Move points. Rotational speed needs to be converted from rpm // Move points. Rotational speed needs to be converted from rpm
movePoints movePoints
( (
csPtr_->globalPosition cs_.globalPosition
( (
csPtr_->localPosition(allPoints()) cs_.localPosition(allPoints())
+ vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0) + vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0)
*movingPointsMask() *movingPointsMask()
) )

View file

@ -58,7 +58,7 @@ class mixerFvMesh
dictionary dict_; dictionary dict_;
//- Coordinate system //- Coordinate system
autoPtr<coordinateSystem> csPtr_; cylindricalCS cs_;
// - Rotational speed in rotations per minute (rpm) // - Rotational speed in rotations per minute (rpm)
scalar rpm_; scalar rpm_;
@ -115,9 +115,9 @@ public:
// Member Functions // Member Functions
//- Return coordinate system //- Return coordinate system
const coordinateSystem& cs() const const cylindricalCS& cs() const
{ {
return csPtr_(); return cs_;
} }
//- Update the mesh for both mesh motion and topology change //- Update the mesh for both mesh motion and topology change

View file

@ -308,20 +308,17 @@ Foam::mixerRotor::mixerRotor
: :
name_(name), name_(name),
mesh_(mesh), mesh_(mesh),
csPtr_ cs_
( (
coordinateSystem::New "coordinateSystem",
( dict.subDict("coordinateSystem")
"coordinateSystem",
dict.subDict("coordinateSystem")
)
), ),
rpm_(readScalar(dict.lookup("rpm"))), rpm_(readScalar(dict.lookup("rpm"))),
movingSliderName_(dict.lookup("movingPatch")), movingSliderName_(dict.lookup("movingPatch")),
staticSliderName_(dict.lookup("staticPatch")), staticSliderName_(dict.lookup("staticPatch")),
rotatingRegionMarker_ rotatingRegionMarker_
( (
dict.lookupOrDefault<point>("rotatingRegionMarker", csPtr_->origin()) dict.lookupOrDefault<point>("rotatingRegionMarker", cs_.origin())
), ),
invertMotionMask_ invertMotionMask_
( (
@ -331,6 +328,29 @@ Foam::mixerRotor::mixerRotor
attachDetach_(dict.lookupOrDefault<bool>("attachDetach", true)), attachDetach_(dict.lookupOrDefault<bool>("attachDetach", true)),
movingPointsMaskPtr_(NULL) movingPointsMaskPtr_(NULL)
{ {
// Make sure the coordinate system does not operate in degrees
// Bug fix, HJ, 3/Oct/2011
if (!cs_.inDegrees())
{
WarningIn
(
"mixerRotor::mixerRotor\n"
"(\n"
" const word& name,\n"
" const polyMesh& mesh,\n"
" const dictionary& dict\n"
")"
) << "Mixer coordinate system is set to operate in radians. "
<< "Changing to rad for correct calculation of angular velocity."
<< nl
<< "To remove this message please add entry" << nl << nl
<< "inDegrees true;" << nl << nl
<< "to the specification of the coordinate system"
<< endl;
cs_.inDegrees() = true;
}
Info<< "Rotor " << name << ":" << nl Info<< "Rotor " << name << ":" << nl
<< " origin : " << cs().origin() << nl << " origin : " << cs().origin() << nl
<< " axis : " << cs().axis() << nl << " axis : " << cs().axis() << nl
@ -365,10 +385,10 @@ Foam::tmp<Foam::vectorField> Foam::mixerRotor::pointMotion() const
mpm = 1 - mpm; mpm = 1 - mpm;
} }
return csPtr_->globalPosition return cs_.globalPosition
( (
// Motion vector in cymindrical coordinate system (x theta z) // Motion vector in cymindrical coordinate system (x theta z)
csPtr_->localPosition(mesh_.allPoints()) cs_.localPosition(mesh_.allPoints())
+ vector(0, rpm_*360.0*mesh_.time().deltaT().value()/60.0, 0)*mpm + vector(0, rpm_*360.0*mesh_.time().deltaT().value()/60.0, 0)*mpm
) - mesh_.allPoints(); ) - mesh_.allPoints();
} }

View file

@ -67,7 +67,7 @@ class mixerRotor
const polyMesh& mesh_; const polyMesh& mesh_;
//- Coordinate system //- Coordinate system
autoPtr<coordinateSystem> csPtr_; cylindricalCS cs_;
// - Rotational speed in rotations per minute (rpm) // - Rotational speed in rotations per minute (rpm)
const scalar rpm_; const scalar rpm_;
@ -105,9 +105,9 @@ class mixerRotor
//- Return coordinate system //- Return coordinate system
const coordinateSystem& cs() const const cylindricalCS& cs() const
{ {
return csPtr_(); return cs_;
} }
//- Calculate moving mask //- Calculate moving mask