44 { fanFlowDirection::ffdOut,
"out" },
53 const DimensionedField<scalar, volMesh>& iF
56 totalPressureFvPatchScalarField(
p, iF),
59 nonDimensional_(false),
74 fanCurve_(
rhs.fanCurve_.clone()),
75 direction_(
rhs.direction_),
76 nonDimensional_(
rhs.nonDimensional_),
91 direction_(fanFlowDirectionNames_.get(
"direction",
dict)),
92 nonDimensional_(
dict.getOrDefault(
"nonDimensional", false)),
97 if (
dict.found(
"file"))
101 new Function1Types::TableFile<scalar>(
"fanCurve", dict, &this->db())
106 fanCurve_.reset(Function1<scalar>::New(
"fanCurve", dict, &this->db()));
111 rpm_.reset(Function1<scalar>::New(
"rpm",
dict, &this->db()));
112 dm_.reset(Function1<scalar>::New(
"dm",
dict, &this->db()));
119 const fanPressureFvPatchScalarField&
rhs
122 totalPressureFvPatchScalarField(
rhs),
123 fanCurve_(
rhs.fanCurve_.clone()),
124 direction_(
rhs.direction_),
125 nonDimensional_(
rhs.nonDimensional_),
138 fanCurve_(
rhs.fanCurve_.clone()),
139 direction_(
rhs.direction_),
140 nonDimensional_(
rhs.nonDimensional_),
158 const int dir = 2*direction_ - 1;
161 scalar volFlowRate = 0;
165 volFlowRate = dir*
gSum(phip);
170 volFlowRate = dir*
gSum(phip/rhop);
175 <<
"dimensions of phi are not correct\n"
176 <<
" on patch " <<
patch().name()
177 <<
" of field " << internalField().name()
178 <<
" in file " << internalField().objectPath() <<
nl
189 rpm = rpm_->value(this->db().time().timeOutputValue());
190 meanDiam = dm_->value(this->db().time().timeOutputValue());
203 scalar pdFan = fanCurve_->value(
max(volFlowRate, scalar(0)));
211 *
sqr(rpm * meanDiam) / 1800.0
218 patch().lookupPatchField<volVectorField>(
UName())
226 fanCurve_->writeData(
os);
227 os.writeEntry(
"direction", fanFlowDirectionNames_[direction_]);
231 os.writeEntry(
"nonDimensional",
"true");
245 fanPressureFvPatchScalarField
Macros for easy insertion into run-time selection tables.
const word UName(propsDict.getOrDefault< word >("U", "U"))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
This boundary condition can be applied to assign either a pressure inlet or outlet total pressure con...
fanPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
virtual void write(Ostream &os) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static const Enum< fanFlowDirection > fanFlowDirectionNames_
Fan flow direction names.
fanFlowDirection
Fan flow direction.
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
This boundary condition provides a total pressure condition. Four variants are possible:
virtual void write(Ostream &) const
Write.
const word & phiName() const
Return the name of the flux field.
const word & rhoName() const
Return the name of the density field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
totalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
const volScalarField & p0
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
constexpr scalar pi(M_PI)
const std::string patch
OpenFOAM patch number as a std::string.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Type gSum(const FieldField< Field, Type > &f)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
errorManipArg< error, int > exit(error &err, const int errNo=1)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).