37Foam::flowRateInletVelocityFvPatchVectorField::
38flowRateInletVelocityFvPatchVectorField
49 extrapolateProfile_(false)
53Foam::flowRateInletVelocityFvPatchVectorField::
54flowRateInletVelocityFvPatchVectorField
63 rhoInlet_(
dict.getOrDefault<scalar>(
"rhoInlet", -VGREAT)),
67 dict.getOrDefault<
Switch>(
"extrapolateProfile", false)
85 <<
"Please supply either 'volumetricFlowRate' or"
86 <<
" 'massFlowRate' and 'rho'" <<
nl
105Foam::flowRateInletVelocityFvPatchVectorField::
106flowRateInletVelocityFvPatchVectorField
115 flowRate_(ptf.flowRate_.clone()),
116 rhoName_(ptf.rhoName_),
117 rhoInlet_(ptf.rhoInlet_),
118 volumetric_(ptf.volumetric_),
119 extrapolateProfile_(ptf.extrapolateProfile_)
123Foam::flowRateInletVelocityFvPatchVectorField::
124flowRateInletVelocityFvPatchVectorField
130 flowRate_(ptf.flowRate_.clone()),
131 rhoName_(ptf.rhoName_),
132 rhoInlet_(ptf.rhoInlet_),
133 volumetric_(ptf.volumetric_),
134 extrapolateProfile_(ptf.extrapolateProfile_)
138Foam::flowRateInletVelocityFvPatchVectorField::
139flowRateInletVelocityFvPatchVectorField
146 flowRate_(ptf.flowRate_.clone()),
147 rhoName_(ptf.rhoName_),
148 rhoInlet_(ptf.rhoInlet_),
149 volumetric_(ptf.volumetric_),
150 extrapolateProfile_(ptf.extrapolateProfile_)
156template<
class RhoType>
157void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
162 const scalar t = db().time().timeOutputValue();
166 if (extrapolateProfile_)
177 nUp =
min(nUp, scalar(0));
179 const scalar flowRate = flowRate_->value(t);
180 const scalar estimatedFlowRate = -
gSum(
rho*(this->patch().magSf()*nUp));
182 if (estimatedFlowRate > 0.5*flowRate)
184 nUp *= (
mag(flowRate)/
mag(estimatedFlowRate));
188 nUp -= ((flowRate - estimatedFlowRate)/
gSum(
rho*patch().magSf()));
199 const scalar avgU = -flowRate_->value(t)/
gSum(
rho*
patch().magSf());
212 if (volumetric_ || rhoName_ ==
"none")
219 if (db().foundObject<volScalarField>(rhoName_))
232 <<
"Did not find registered density field " << rhoName_
233 <<
" and no constant density 'rhoInlet' specified"
237 updateValues(rhoInlet_);
241 fixedValueFvPatchVectorField::updateCoeffs();
248 flowRate_->writeData(
os);
254 if (extrapolateProfile_)
256 os.
writeEntry(
"extrapolateProfile", extrapolateProfile_);
258 writeEntry(
"value",
os);
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...
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,...
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
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 updateCoeffs()
Update the coefficients associated with the patch field.
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
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 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)
const std::string patch
OpenFOAM patch number as a std::string.
Type gSum(const FieldField< Field, Type > &f)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)