37template<
class RhoFieldType>
38void Foam::fv::radialActuationDiskSource::
39addRadialActuationDiskAxialInertialResistance
42 const labelList&
cells,
43 const scalarField& Vcells,
44 const RhoFieldType&
rho,
55 const Field<vector> zoneCellCentres(
mesh().cellCentres(),
cells);
56 const Field<scalar> zoneCellVolumes(
mesh().cellVolumes(),
cells);
58 const vector avgCentre =
gSum(zoneCellVolumes*zoneCellCentres)/
V();
59 const scalar maxR =
gMax(
mag(zoneCellCentres - avgCentre));
61 const scalar intCoeffs =
63 + radialCoeffs_[1]*
sqr(maxR)/2.0
64 + radialCoeffs_[2]*
pow4(maxR)/3.0;
66 if (
mag(intCoeffs) < VSMALL)
69 <<
"Radial distribution coefficients lead to zero polynomial." <<
nl
70 <<
"radialCoeffs = " << radialCoeffs_
82 rhoRef = rhoRef +
rho[celli];
84 reduce(Uref, sumOp<vector>());
85 reduce(rhoRef, sumOp<scalar>());
86 reduce(szMonitorCells, sumOp<label>());
88 if (szMonitorCells == 0)
91 <<
"No cell is available for incoming velocity monitoring."
95 Uref /= szMonitorCells;
96 rhoRef /= szMonitorCells;
101 if (
Cp <= VSMALL || Ct <= VSMALL)
104 <<
"Cp and Ct must be greater than zero." <<
nl
105 <<
"Cp = " <<
Cp <<
", Ct = " << Ct
109 const scalar a = 1.0 -
Cp/Ct;
118 *(radialCoeffs_[0] + radialCoeffs_[1]*r2 + radialCoeffs_[2]*
sqr(r2))
121 Usource[
cells[i]] += ((Vcells[
cells[i]]/
V_)*Tr[i]*E) & Uref;
140 <<
"Average centre: " << avgCentre <<
nl
141 <<
"Maximum radius: " << maxR <<
endl;
scalar timeOutputValue() const
Return current time value.
void size(const label n)
Older name for setAddressableSize.
virtual OFstream & file()
Return access to the file (if only 1)
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
const Time & time() const
Return the top-level database.
autoPtr< Function1< scalar > > UvsCtPtr_
Velocity vs thrust coefficients.
vector diskDir_
Surface-normal vector of the actuator disk pointing downstream.
scalar writeFileEnd_
End time for file output.
scalar writeFileStart_
Start time for file output.
labelList monitorCells_
Set of cells whereat the incoming velocity is monitored.
autoPtr< Function1< scalar > > UvsCpPtr_
Velocity vs power coefficients.
label sink_
Flag for body forces to act as a source (false) or a sink (true)
scalar diskArea_
Actuator disk planar surface area [m2].
scalar V() const noexcept
Return const access to the total cell volume.
scalar V_
Sum of cell volumes.
const labelList & cells() const noexcept
Return const access to the cell selection.
const word & name() const noexcept
Return const access to the source name.
const fvMesh & mesh_
Reference to the mesh database.
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Tensor of scalars, i.e. Tensor<scalar>.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const volScalarField & Cp
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Type gSum(const FieldField< Field, Type > &f)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
dimensionedScalar pow4(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gMax(const FieldField< Field, Type > &f)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)
#define forAll(list, i)
Loop across all elements in list.