49 extrapolateProfile_(false)
64 rhoInlet_(
dict.getOrDefault<scalar>(
"rhoInlet", -VGREAT)),
68 dict.getOrDefault<
Switch>(
"extrapolateProfile", false)
80 dict.readIfPresent(
"rho", rhoName_);
88 <<
"Please supply either 'volumetricFlowRate' or"
89 <<
" 'massFlowRate' (optional: with 'rho')" <<
nl
94 if (!this->readValueEntry(
dict))
104 const flowRateInletVelocityFvPatchVectorField& ptf,
106 const DimensionedField<vector, volMesh>& iF,
107 const fvPatchFieldMapper& mapper
110 fixedValueFvPatchField<
vector>(ptf,
p, iF, mapper),
111 flowRate_(ptf.flowRate_.clone()),
112 rhoName_(ptf.rhoName_),
113 rhoInlet_(ptf.rhoInlet_),
114 volumetric_(ptf.volumetric_),
115 extrapolateProfile_(ptf.extrapolateProfile_)
126 flowRate_(ptf.flowRate_.clone()),
127 rhoName_(ptf.rhoName_),
128 rhoInlet_(ptf.rhoInlet_),
129 volumetric_(ptf.volumetric_),
130 extrapolateProfile_(ptf.extrapolateProfile_)
142 flowRate_(ptf.flowRate_.clone()),
143 rhoName_(ptf.rhoName_),
144 rhoInlet_(ptf.rhoInlet_),
145 volumetric_(ptf.volumetric_),
146 extrapolateProfile_(ptf.extrapolateProfile_)
152template<
class RhoType>
153void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
158 const scalar t = db().time().timeOutputValue();
162 if (extrapolateProfile_)
173 nUp =
min(nUp, scalar(0));
175 const scalar flowRate = flowRate_->value(t);
176 const scalar estimatedFlowRate = -
gSum(
rho*(this->patch().magSf()*nUp));
178 if (estimatedFlowRate > 0.5*flowRate)
180 nUp *= (
mag(flowRate)/
mag(estimatedFlowRate));
184 nUp -= ((flowRate - estimatedFlowRate)/
gSum(
rho*
patch().magSf()));
195 const scalar avgU = -flowRate_->value(t)/
gSum(
rho*patch().magSf());
208 if (volumetric_ || rhoName_ ==
"none")
218 =
patch().cfindPatchField<volScalarField>(rhoName_)
229 <<
"Did not find registered density field " << rhoName_
230 <<
" and no constant density 'rhoInlet' specified"
234 updateValues(rhoInlet_);
238 fixedValueFvPatchVectorField::updateCoeffs();
245 flowRate_->writeData(
os);
251 if (extrapolateProfile_)
253 os.
writeEntry(
"extrapolateProfile", extrapolateProfile_);
266 flowRateInletVelocityFvPatchVectorField
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr)
An optional selector, with fallback redirection.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Velocity inlet boundary condition either correcting the extrapolated velocity or creating a uniform v...
virtual void write(Ostream &) const
Write.
virtual tmp< fvPatchField< vector > > clone() const
Return a clone.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
flowRateInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#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,...
const std::string patch
OpenFOAM patch number as a std::string.
Type gSum(const FieldField< Field, Type > &f)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Field< vector > vectorField
Specialisation of Field<T> for vector.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
fvPatchField< vector > fvPatchVectorField
constexpr char nl
The newline '\n' character (0x0a).