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_)
128 flowRate_(ptf.flowRate_,
false),
129 volumetric_(ptf.volumetric_),
130 rhoName_(ptf.rhoName_),
131 rhoInlet_(ptf.rhoInlet_),
132 alphaName_(ptf.alphaName_),
133 extrapolateProfile_(ptf.extrapolateProfile_)
145 flowRate_(ptf.flowRate_,
false),
146 volumetric_(ptf.volumetric_),
147 rhoName_(ptf.rhoName_),
148 rhoInlet_(ptf.rhoInlet_),
149 alphaName_(ptf.alphaName_),
150 extrapolateProfile_(ptf.extrapolateProfile_)
156 template<
class AlphaType,
class RhoType>
157 void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
159 const AlphaType& alpha,
163 const scalar t = db().time().timeOutputValue();
167 if (extrapolateProfile_)
178 nUp =
min(nUp, scalar(0));
180 const scalar flowRate = flowRate_->
value(t);
181 const scalar estimatedFlowRate =
182 -
gSum(alpha*rho*(this->patch().magSf()*nUp));
184 if (estimatedFlowRate/flowRate > 0.5)
186 nUp *=
mag(flowRate)/
mag(estimatedFlowRate);
191 (flowRate - estimatedFlowRate)
192 /
gSum(alpha*rho*patch().magSf());
204 -flowRate_->
value(t)/
gSum(alpha*rho*patch().magSf());
210 template<
class AlphaType>
211 void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
213 const AlphaType& alpha
216 if (volumetric_ || rhoName_ ==
"none")
218 updateValues(alpha,
one());
223 if (db().foundObject<volScalarField>(rhoName_))
228 updateValues(alpha, rhop);
236 <<
"Did not find registered density field " << rhoName_
237 <<
" and no constant density 'rhoInlet' specified" 241 updateValues(alpha, rhoInlet_);
259 updateValues(alphap);
266 fixedValueFvPatchVectorField::updateCoeffs();
276 writeEntryIfDifferent<word>(os,
"rho",
"rho", rhoName_);
277 writeEntryIfDifferent<scalar>(os,
"rhoInlet", -vGreat, rhoInlet_);
279 writeEntryIfDifferent<word>(os,
"alpha",
word::null, alphaName_);
280 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)
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) independent variable.
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...