37 template<
class RhoFieldType>
38 void Foam::fv::radialActuationDiskSource::
39 addRadialActuationDiskAxialInertialResistance
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;
label sink_
Flag for body forces to act as a source (false) or a sink (true)
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.
vector diskDir() const
Normal disk direction, evaluated at timeOutputValue.
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 the current user-time value. (ie, after applying any timeToUserTime() conversion) ...
dimensionedScalar pow4(const dimensionedScalar &ds)
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].
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)
scalar writeFileStart_
Start time for file output.
static constexpr const zero Zero
Global zero (0)