37template<
class AlphaFieldType,
class RhoFieldType>
38void Foam::fv::actuationDiskSource::calc
40 const AlphaFieldType&
alpha,
41 const RhoFieldType&
rho,
55 calcVariableScalingMethod(
alpha,
rho, eqn);
65template<
class AlphaFieldType,
class RhoFieldType>
66void Foam::fv::actuationDiskSource::calcFroudeMethod
68 const AlphaFieldType&
alpha,
69 const RhoFieldType&
rho,
80 label szMonitorCells = monitorCells_.size();
82 for (
const label celli : monitorCells_)
85 rhoRef = rhoRef +
rho[celli];
87 reduce(Uref, sumOp<vector>());
88 reduce(rhoRef, sumOp<scalar>());
89 reduce(szMonitorCells, sumOp<label>());
91 if (szMonitorCells == 0)
94 <<
"No cell is available for incoming velocity monitoring."
98 Uref /= szMonitorCells;
99 rhoRef /= szMonitorCells;
101 const scalar Ct = sink_*UvsCtPtr_->value(
mag(Uref));
102 const scalar
Cp = sink_*UvsCpPtr_->value(
mag(Uref));
104 if (
Cp <= VSMALL || Ct <= VSMALL)
107 <<
"Cp and Ct must be greater than zero." <<
nl
108 <<
"Cp = " <<
Cp <<
", Ct = " << Ct
113 const scalar a = 1.0 -
Cp/Ct;
114 const scalar
T = 2.0*rhoRef*diskArea_*
magSqr(Uref & diskDir_)*a*(1 - a);
116 for (
const label celli : cells_)
118 Usource[celli] += ((cellsV[celli]/V())*
T)*diskDir_;
123 mesh_.time().timeOutputValue() >= writeFileStart_
124 && mesh_.time().timeOutputValue() <= writeFileEnd_
127 Ostream&
os = file();
128 writeCurrentTime(
os);
136template<
class AlphaFieldType,
class RhoFieldType>
137void Foam::fv::actuationDiskSource::calcVariableScalingMethod
139 const AlphaFieldType&
alpha,
140 const RhoFieldType&
rho,
141 fvMatrix<vector>& eqn
151 label szMonitorCells = monitorCells_.size();
153 for (
const label celli : monitorCells_)
156 rhoRef = rhoRef +
rho[celli];
158 reduce(Uref, sumOp<vector>());
159 reduce(rhoRef, sumOp<scalar>());
160 reduce(szMonitorCells, sumOp<label>());
162 if (szMonitorCells == 0)
165 <<
"No cell is available for incoming velocity monitoring."
169 Uref /= szMonitorCells;
170 const scalar magUref =
mag(Uref);
171 rhoRef /= szMonitorCells;
175 scalar rhoDisk = 0.0;
178 for (
const label celli : cells_)
180 Udisk +=
U[celli]*cellsV[celli];
181 rhoDisk +=
rho[celli]*cellsV[celli];
182 totalV += cellsV[celli];
184 reduce(Udisk, sumOp<vector>());
185 reduce(rhoDisk, sumOp<scalar>());
186 reduce(totalV, sumOp<scalar>());
191 <<
"No cell in the actuator disk."
196 const scalar magUdisk =
mag(Udisk);
199 if (
mag(Udisk) < SMALL)
202 <<
"Velocity spatial-averaged on actuator disk is zero." <<
nl
203 <<
"Please check if the initial U field is zero."
208 const scalar Ct = sink_*UvsCtPtr_->value(magUref);
209 const scalar
Cp = sink_*UvsCpPtr_->value(magUref);
211 if (
Cp <= VSMALL || Ct <= VSMALL)
214 <<
"Cp and Ct must be greater than zero." <<
nl
215 <<
"Cp = " <<
Cp <<
", Ct = " << Ct
220 const scalar CtStar = Ct*
sqr(magUref/magUdisk);
221 const scalar CpStar =
Cp*
pow3(magUref/magUdisk);
224 const scalar
T = 0.5*rhoRef*diskArea_*
magSqr(Udisk & diskDir_)*CtStar;
225 const scalar P = 0.5*rhoRef*diskArea_*
pow3(
mag(Udisk & diskDir_))*CpStar;
227 for (
const label celli : cells_)
229 Usource[celli] += (cellsV[celli]/totalV*
T)*diskDir_;
234 mesh_.time().timeOutputValue() >= writeFileStart_
235 && mesh_.time().timeOutputValue() <= writeFileEnd_
238 Ostream&
os = file();
239 writeCurrentTime(
os);
242 << Udisk <<
tab << CpStar <<
tab << CtStar <<
tab <<
T <<
tab << P
enum forceMethodType forceMethod_
The type of the force computation method.
@ FROUDE
"Froude's ideal actuator disk method"
@ VARIABLE_SCALING
"Variable-scaling actuator disk method"
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)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar pow3(const dimensionedScalar &ds)
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)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
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)