mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated rotor source - better handling of compressibility and code refactoring
This commit is contained in:
@ -465,22 +465,15 @@ Foam::rotorDiskSource::~rotorDiskSource()
|
|||||||
void Foam::rotorDiskSource::calculate
|
void Foam::rotorDiskSource::calculate
|
||||||
(
|
(
|
||||||
const vectorField& U,
|
const vectorField& U,
|
||||||
const scalarField& alphag,
|
const scalarField& thetag,
|
||||||
vectorField& force,
|
vectorField& force,
|
||||||
const bool divideVolume,
|
const bool divideVolume,
|
||||||
const bool output
|
const bool output
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const scalarField& V = mesh_.V();
|
const scalarField& V = mesh_.V();
|
||||||
const bool compressible = rhoName_ != "none";
|
const bool compressible = this->compressible();
|
||||||
|
tmp<volScalarField> trho(rho());
|
||||||
tmp<volScalarField> trho
|
|
||||||
(
|
|
||||||
compressible
|
|
||||||
? mesh_.lookupObject<volScalarField>(rhoName_)
|
|
||||||
: volScalarField::null()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// logging info
|
// logging info
|
||||||
scalar dragEff = 0.0;
|
scalar dragEff = 0.0;
|
||||||
@ -518,7 +511,7 @@ void Foam::rotorDiskSource::calculate
|
|||||||
blade_.interpolate(radius, twist, chord, i1, i2, invDr);
|
blade_.interpolate(radius, twist, chord, i1, i2, invDr);
|
||||||
|
|
||||||
// flip geometric angle if blade is spinning in reverse (clockwise)
|
// flip geometric angle if blade is spinning in reverse (clockwise)
|
||||||
scalar alphaGeom = alphag[i] + twist;
|
scalar alphaGeom = thetag[i] + twist;
|
||||||
if (omega_ < 0)
|
if (omega_ < 0)
|
||||||
{
|
{
|
||||||
alphaGeom = mathematical::pi - alphaGeom;
|
alphaGeom = mathematical::pi - alphaGeom;
|
||||||
@ -685,7 +678,7 @@ bool Foam::rotorDiskSource::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
writeField("alphag", trim_->thetag()(), true);
|
writeField("thetag", trim_->thetag()(), true);
|
||||||
writeField("faceArea", area_, true);
|
writeField("faceArea", area_, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -253,7 +253,11 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Return the rotational speed [rad/s]
|
||||||
|
// Positive anti-clockwise when looking along -ve lift direction
|
||||||
|
inline scalar omega() const;
|
||||||
|
|
||||||
//- Return the cell centre positions in local rotor frame
|
//- Return the cell centre positions in local rotor frame
|
||||||
// (Cylindrical r, theta, z)
|
// (Cylindrical r, theta, z)
|
||||||
inline const List<point>& x() const;
|
inline const List<point>& x() const;
|
||||||
@ -261,6 +265,12 @@ public:
|
|||||||
//- Return the rotor co-ordinate system (r, theta, z)
|
//- Return the rotor co-ordinate system (r, theta, z)
|
||||||
inline const cylindricalCS& coordSys() const;
|
inline const cylindricalCS& coordSys() const;
|
||||||
|
|
||||||
|
//- Return true if solving a compressible case
|
||||||
|
inline bool compressible() const;
|
||||||
|
|
||||||
|
//- Return the density field [kg/m3]
|
||||||
|
inline tmp<volScalarField> rho() const;
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
@ -268,7 +278,7 @@ public:
|
|||||||
void calculate
|
void calculate
|
||||||
(
|
(
|
||||||
const vectorField& U,
|
const vectorField& U,
|
||||||
const scalarField& alphag,
|
const scalarField& thetag,
|
||||||
vectorField& force,
|
vectorField& force,
|
||||||
const bool divideVolume = true,
|
const bool divideVolume = true,
|
||||||
const bool output = true
|
const bool output = true
|
||||||
|
|||||||
@ -25,6 +25,13 @@ License
|
|||||||
|
|
||||||
#include "rotorDiskSource.H"
|
#include "rotorDiskSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::rotorDiskSource::omega() const
|
||||||
|
{
|
||||||
|
return omega_;
|
||||||
|
}
|
||||||
|
|
||||||
const Foam::List<Foam::point>& Foam::rotorDiskSource::x() const
|
const Foam::List<Foam::point>& Foam::rotorDiskSource::x() const
|
||||||
{
|
{
|
||||||
return x_;
|
return x_;
|
||||||
@ -37,5 +44,23 @@ const Foam::cylindricalCS& Foam::rotorDiskSource::coordSys() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::rotorDiskSource::compressible() const
|
||||||
|
{
|
||||||
|
return rhoName_ != "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::rotorDiskSource::rho() const
|
||||||
|
{
|
||||||
|
if (compressible())
|
||||||
|
{
|
||||||
|
return mesh_.lookupObject<volScalarField>(rhoName_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return volScalarField::null();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user