45 alphaName_(word::null),
46 extrapolateProfile_(
false)
59 rhoInlet_(dict.lookupOrDefault<scalar>(
"rhoInlet", -vGreat)),
60 alphaName_(dict.lookupOrDefault<
word>(
"alpha", word::null)),
63 dict.lookupOrDefault<
Switch>(
"extrapolateProfile",
false)
66 if (dict.found(
"volumetricFlowRate"))
72 else if (dict.found(
"massFlowRate"))
76 rhoName_ =
word(dict.lookupOrDefault<
word>(
"rho",
"rho"));
83 ) <<
"Please supply either 'volumetricFlowRate' or" 88 if (dict.found(
"value"))
97 evaluate(Pstream::commsTypes::blocking);
112 flowRate_(ptf.flowRate_,
false),
113 volumetric_(ptf.volumetric_),
114 rhoName_(ptf.rhoName_),
115 rhoInlet_(ptf.rhoInlet_),
116 alphaName_(ptf.alphaName_),
117 extrapolateProfile_(ptf.extrapolateProfile_)
129 flowRate_(ptf.flowRate_,
false),
130 volumetric_(ptf.volumetric_),
131 rhoName_(ptf.rhoName_),
132 rhoInlet_(ptf.rhoInlet_),
133 alphaName_(ptf.alphaName_),
134 extrapolateProfile_(ptf.extrapolateProfile_)
140 template<
class AlphaType,
class RhoType>
141 void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
143 const AlphaType& alpha,
147 const scalar t = db().time().timeOutputValue();
151 if (extrapolateProfile_)
162 nUp =
min(nUp, scalar(0));
164 const scalar flowRate = flowRate_->
value(t);
165 const scalar estimatedFlowRate =
166 -
gSum(alpha*rho*(this->patch().magSf()*nUp));
168 if (estimatedFlowRate/flowRate > 0.5)
170 nUp *=
mag(flowRate)/
mag(estimatedFlowRate);
175 (flowRate - estimatedFlowRate)
176 /
gSum(alpha*rho*patch().magSf());
188 -flowRate_->
value(t)/
gSum(alpha*rho*patch().magSf());
194 template<
class AlphaType>
195 void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
197 const AlphaType& alpha
200 if (volumetric_ || rhoName_ ==
"none")
202 updateValues(alpha,
one());
207 if (db().foundObject<volScalarField>(rhoName_))
212 updateValues(alpha, rhop);
220 <<
"Did not find registered density field " << rhoName_
221 <<
" and no constant density 'rhoInlet' specified" 225 updateValues(alpha, rhoInlet_);
243 updateValues(alphap);
250 fixedValueFvPatchVectorField::updateCoeffs();
260 writeEntryIfDifferent<word>(os,
"rho",
"rho", rhoName_);
261 writeEntryIfDifferent<scalar>(os,
"rhoInlet", -vGreat, rhoInlet_);
263 writeEntryIfDifferent<word>(os,
"alpha",
word::null, alphaName_);
264 writeEntry(os,
"extrapolateProfile", extrapolateProfile_);
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
errorManipArg< error, int > exit(error &err, const int errNo=1)
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
volVectorField vectorField(fieldObject, mesh)
virtual void write(Ostream &) const
Write.
virtual void write(Ostream &) const
Write.
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Type gSum(const FieldField< Field, Type > &f)
virtual Type value(const scalar x) const =0
Return value as a function of scalar x.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
flowRateInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static const word null
An empty word.
Velocity inlet boundary condition either correcting the extrapolated velocity or creating a uniform v...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
A class representing the concept of 1 (scalar(1)) used to avoid unnecessary manipulations for objects...