37 template<
class RhoFieldType>
38 void Foam::fv::radialActuationDiskSource::
39 addRadialActuationDiskAxialInertialResistance
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;
label sink_
Flag for body forces to act as a source (false) or a sink (true)
vector diskDir_
Surface-normal vector of the actuator disk pointing downstream.
scalar V_
Sum of cell volumes.
virtual OFstream & file()
Return access to the file (if only 1)
void size(const label n)
Older name for setAddressableSize.
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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.
const fvMesh & mesh_
Reference to the mesh database.
scalar writeFileEnd_
End time for file output.
const labelList & cells() const noexcept
Return const access to the cell selection.
autoPtr< Function1< scalar > > UvsCpPtr_
Velocity vs power coefficients.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char tab
The tab '\t' character(0x09)
const Time & time() const
Return the top-level database.
autoPtr< Function1< scalar > > UvsCtPtr_
Velocity vs thrust coefficients.
#define forAll(list, i)
Loop across all elements in list.
scalar V() const noexcept
Return const access to the total cell volume.
Type gSum(const FieldField< Field, Type > &f)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word & name() const noexcept
Return const access to the source name.
const volScalarField & Cp
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
scalar timeOutputValue() const
Return current time value.
dimensionedScalar pow4(const dimensionedScalar &ds)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
labelList monitorCells_
Set of cells whereat the incoming velocity is monitored.
scalar diskArea_
Actuator disk planar surface area [m2].
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
scalar writeFileStart_
Start time for file output.
static constexpr const zero Zero
Global zero (0)