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")
),
csPtr_
(
coordinateSystem::New
cs_
(
"coordinateSystem",
dict_.subDict("coordinateSystem")
)
),
rpm_(readScalar(dict_.lookup("rpm"))),
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();
Info<< "Mixer mesh:" << nl
@ -302,9 +315,9 @@ bool Foam::mixerGgiFvMesh::update()
// Rotational speed needs to be converted from rpm
movePoints
(
csPtr_->globalPosition
cs_.globalPosition
(
csPtr_->localPosition(allPoints())
cs_.localPosition(allPoints())
+ vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0)
*movingPointsMask()
)

View file

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

View file

@ -173,16 +173,30 @@ Foam::turboFvMesh::turboFvMesh
)
).subDict(typeName + "Coeffs")
),
csPtr_
(
coordinateSystem::New
cs_
(
"coordinateSystem",
dict_.subDict("coordinateSystem")
)
),
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
<< " origin: " << cs().origin() << nl
<< " axis : " << cs().axis() << endl;
@ -215,9 +229,9 @@ bool Foam::turboFvMesh::update()
{
movePoints
(
csPtr_->globalPosition
cs_.globalPosition
(
csPtr_->localPosition(allPoints())
cs_.localPosition(allPoints())
+ movingPoints()*time().deltaT().value()
)
);

View file

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

View file

@ -380,22 +380,35 @@ Foam::mixerFvMesh::mixerFvMesh
)
).subDict(typeName + "Coeffs")
),
csPtr_
(
coordinateSystem::New
cs_
(
"coordinateSystem",
dict_.subDict("coordinateSystem")
)
),
rpm_(readScalar(dict_.lookup("rpm"))),
rotatingRegionMarker_
(
dict_.lookupOrDefault<point>("rotatingRegionMarker", csPtr_->origin())
dict_.lookupOrDefault<point>("rotatingRegionMarker", cs_.origin())
),
attachDetach_(dict_.lookupOrDefault<bool>("attachDetach", false)),
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_
<< " Attach-detach action = " << attachDetach_ << endl;
@ -438,9 +451,9 @@ bool Foam::mixerFvMesh::update()
// Move points. Rotational speed needs to be converted from rpm
movePoints
(
csPtr_->globalPosition
cs_.globalPosition
(
csPtr_->localPosition(allPoints())
cs_.localPosition(allPoints())
+ vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0)
*movingPointsMask()
)

View file

@ -58,7 +58,7 @@ class mixerFvMesh
dictionary dict_;
//- Coordinate system
autoPtr<coordinateSystem> csPtr_;
cylindricalCS cs_;
// - Rotational speed in rotations per minute (rpm)
scalar rpm_;
@ -115,9 +115,9 @@ public:
// Member Functions
//- 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

View file

@ -308,20 +308,17 @@ Foam::mixerRotor::mixerRotor
:
name_(name),
mesh_(mesh),
csPtr_
(
coordinateSystem::New
cs_
(
"coordinateSystem",
dict.subDict("coordinateSystem")
)
),
rpm_(readScalar(dict.lookup("rpm"))),
movingSliderName_(dict.lookup("movingPatch")),
staticSliderName_(dict.lookup("staticPatch")),
rotatingRegionMarker_
(
dict.lookupOrDefault<point>("rotatingRegionMarker", csPtr_->origin())
dict.lookupOrDefault<point>("rotatingRegionMarker", cs_.origin())
),
invertMotionMask_
(
@ -331,6 +328,29 @@ Foam::mixerRotor::mixerRotor
attachDetach_(dict.lookupOrDefault<bool>("attachDetach", true)),
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
<< " origin : " << cs().origin() << nl
<< " axis : " << cs().axis() << nl
@ -365,10 +385,10 @@ Foam::tmp<Foam::vectorField> Foam::mixerRotor::pointMotion() const
mpm = 1 - mpm;
}
return csPtr_->globalPosition
return cs_.globalPosition
(
// 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
) - mesh_.allPoints();
}

View file

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