37template<
class RhoFieldType>
38void Foam::fv::radialActuationDiskSource::
39addRadialActuationDiskAxialInertialResistance
42 const labelList&
cells,
43 const scalarField& Vcells,
44 const RhoFieldType&
rho,
54 const Field<vector> zoneCellCentres(
mesh().cellCentres(),
cells);
55 const Field<scalar> zoneCellVolumes(
mesh().cellVolumes(),
cells);
57 const vector avgCentre =
gSum(zoneCellVolumes*zoneCellCentres)/
V();
58 const scalar maxR =
gMax(
mag(zoneCellCentres - avgCentre));
60 const scalar intCoeffs =
62 + radialCoeffs_[1]*
sqr(maxR)/2.0
63 + radialCoeffs_[2]*
pow4(maxR)/3.0;
65 if (
mag(intCoeffs) < VSMALL)
68 <<
"Radial distribution coefficients lead to zero polynomial." <<
nl
69 <<
"radialCoeffs = " << radialCoeffs_
81 rhoRef = rhoRef +
rho[celli];
83 reduce(Uref, sumOp<vector>());
84 reduce(rhoRef, sumOp<scalar>());
85 reduce(szMonitorCells, sumOp<label>());
87 if (szMonitorCells == 0)
90 <<
"No cell is available for incoming velocity monitoring."
94 Uref /= szMonitorCells;
95 rhoRef /= szMonitorCells;
100 if (
Cp <= VSMALL || Ct <= VSMALL)
103 <<
"Cp and Ct must be greater than zero." <<
nl
104 <<
"Cp = " <<
Cp <<
", Ct = " << Ct
108 const scalar a = 1.0 -
Cp/Ct;
117 *(radialCoeffs_[0] + radialCoeffs_[1]*r2 + radialCoeffs_[2]*
sqr(r2))
120 Usource[
cells[i]] += ((Vcells[
cells[i]]/
V_)*Tr[i]*E) & Uref;
139 <<
"Average centre: " << avgCentre <<
nl
140 <<
"Maximum radius: " << maxR <<
endl;
virtual OFstream & file()
Return access to the file (if only 1).
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
autoPtr< Function1< scalar > > UvsCtPtr_
Velocity vs thrust coefficients.
vector diskDir() const
Normal disk direction, evaluated at timeOutputValue.
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.
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(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
dimensionedScalar pow4(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
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.