37 template<
class RhoFieldType>
40 const RhoFieldType&
rho,
44 const bool divideVolume,
53 scalar AOAmin = GREAT;
54 scalar AOAmax = -GREAT;
57 const bool hasCache = bool(Rcyl_);
61 if (area_[i] > ROOTVSMALL)
63 const label celli = cells_[i];
65 const scalar radius = x_[i].x();
71 : coordSys_.R(mesh_.C()[celli])
84 Uc.y() = radius*omega_ - Uc.y();
93 blade_.interpolate(radius, twist, chord, i1, i2, invDr);
96 scalar alphaGeom = thetag[i] + twist;
117 const label profile1 = blade_.profileID()[i1];
118 const label profile2 = blade_.profileID()[i2];
122 profiles_[profile1].Cdl(
alphaEff, Cd1, Cl1);
126 profiles_[profile2].Cdl(
alphaEff, Cd2, Cl2);
128 scalar Cd = invDr*(Cd2 - Cd1) + Cd1;
129 scalar Cl = invDr*(Cl2 - Cl1) + Cl1;
132 scalar tipFactor =
neg(radius/rMax_ - tipEffect_);
141 dragEff += rhoRef_*localForce.y();
142 liftEff += rhoRef_*localForce.z();
148 force[celli] =
transform(Rcyl, localForce);
152 force[celli] /= V[celli];
165 <<
" min/max(AOA) = " <<
radToDeg(AOAmin) <<
", " 167 <<
" Effective drag = " << dragEff <<
nl 168 <<
" Effective lift = " << liftEff <<
endl;
181 if (mesh_.time().writeTime() || writeNow)
183 if (cells_.size() !=
values.size())
186 <<
"Size mismatch. Number of cells " 187 << cells_.size() <<
" != number of values " 200 auto&
field = tfield.ref().primitiveFieldRef();
Different types of constants.
dimensionSet invTransform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
Dimensionless.
dimensionedScalar neg(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
constexpr scalar twoPi(2 *M_PI)
A class for handling words, derived from Foam::string.
volScalarField pDyn(IOobject("pDyn", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimPressure, Zero))
constexpr scalar pi(M_PI)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=PatchField< Type >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static Ostream & output(Ostream &os, const IntRange< T > &range)
void writeField(const word &name, const List< Type > &values, const bool writeNow=false) const
Helper function to write rotor values.
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
volScalarField alphaEff("alphaEff", turbulence->nu()/Pr+alphat)
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Tensor of scalars, i.e. Tensor<scalar>.
Do not request registration (bool: false)
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)