ENH: Updated rotor source - better handling of compressibility and code refactoring

This commit is contained in:
andy
2012-06-11 11:25:39 +01:00
parent 64ff9905dc
commit 05e5d474e1
3 changed files with 42 additions and 14 deletions

View File

@ -465,22 +465,15 @@ Foam::rotorDiskSource::~rotorDiskSource()
void Foam::rotorDiskSource::calculate
(
const vectorField& U,
const scalarField& alphag,
const scalarField& thetag,
vectorField& force,
const bool divideVolume,
const bool output
) const
{
const scalarField& V = mesh_.V();
const bool compressible = rhoName_ != "none";
tmp<volScalarField> trho
(
compressible
? mesh_.lookupObject<volScalarField>(rhoName_)
: volScalarField::null()
);
const bool compressible = this->compressible();
tmp<volScalarField> trho(rho());
// logging info
scalar dragEff = 0.0;
@ -518,7 +511,7 @@ void Foam::rotorDiskSource::calculate
blade_.interpolate(radius, twist, chord, i1, i2, invDr);
// flip geometric angle if blade is spinning in reverse (clockwise)
scalar alphaGeom = alphag[i] + twist;
scalar alphaGeom = thetag[i] + twist;
if (omega_ < 0)
{
alphaGeom = mathematical::pi - alphaGeom;
@ -685,7 +678,7 @@ bool Foam::rotorDiskSource::read(const dictionary& dict)
if (debug)
{
writeField("alphag", trim_->thetag()(), true);
writeField("thetag", trim_->thetag()(), true);
writeField("faceArea", area_, true);
}

View File

@ -253,7 +253,11 @@ public:
// Member Functions
// 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
// (Cylindrical r, theta, z)
inline const List<point>& x() const;
@ -261,6 +265,12 @@ public:
//- Return the rotor co-ordinate system (r, theta, z)
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
@ -268,7 +278,7 @@ public:
void calculate
(
const vectorField& U,
const scalarField& alphag,
const scalarField& thetag,
vectorField& force,
const bool divideVolume = true,
const bool output = true

View File

@ -25,6 +25,13 @@ License
#include "rotorDiskSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::scalar Foam::rotorDiskSource::omega() const
{
return omega_;
}
const Foam::List<Foam::point>& Foam::rotorDiskSource::x() const
{
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();
}
}
// ************************************************************************* //