35 void Foam::flowRateInletVelocityFvPatchVectorField::setWallDist()
41 patch().patch().boundaryMesh().findPatchIDs<wallPolyPatch>()
44 const patchPatchDist pwd(patch().patch(), otherPatchIDs);
49 area_ =
gSum(patch().magSf());
54 Foam::flowRateInletVelocityFvPatchVectorField::profile()
58 return profile_->value(y_);
62 return tmp<scalarField>(
new scalarField(size(), scalar(1)));
67 template<
class ScaleType,
class AlphaType,
class RhoType>
68 void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
70 const ScaleType& scale,
71 const AlphaType&
alpha,
78 -(scale*flowRate_->value(db().time().userTimeValue()))
85 template<
class AlphaType>
86 void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
88 const AlphaType&
alpha
93 updateValues(area_,
alpha, one());
95 else if (volumetric_ || rhoName_ ==
"none")
97 updateValues(one(),
alpha, one());
102 if (db().foundObject<volScalarField>(rhoName_))
104 const fvPatchField<scalar>& rhop =
107 updateValues(one(),
alpha, rhop);
115 <<
"Did not find registered density field " << rhoName_
116 <<
" and no constant density 'rhoInlet' specified"
120 updateValues(one(),
alpha, rhoInlet_);
126 bool Foam::flowRateInletVelocityFvPatchVectorField::canEvaluate()
130 || !patch().boundaryMesh().mesh().time().processorCase();
146 rhoInlet_(
dict.lookupOrDefault<scalar>(
"rhoInlet", -vGreat)),
147 alphaName_(
dict.lookupOrDefault<
word>(
"alpha",
word::null))
149 if (
dict.found(
"meanVelocity"))
151 meanVelocity_ =
true;
155 else if (
dict.found(
"volumetricFlowRate"))
157 meanVelocity_ =
false;
161 else if (
dict.found(
"massFlowRate"))
163 meanVelocity_ =
false;
166 rhoName_ =
word(
dict.lookupOrDefault<
word>(
"rho",
"rho"));
173 ) <<
"Please supply 'meanVelocity', 'volumetricFlowRate' or"
177 if (
dict.found(
"profile"))
187 if (!canEvaluate() ||
dict.found(
"value"))
211 flowRate_(ptf.flowRate_, false),
212 profile_(ptf.profile_, false),
213 meanVelocity_(ptf.meanVelocity_),
214 volumetric_(ptf.volumetric_),
215 rhoName_(ptf.rhoName_),
216 rhoInlet_(ptf.rhoInlet_),
217 alphaName_(ptf.alphaName_),
220 profile_.
valid() && canEvaluate()
236 flowRate_(ptf.flowRate_, false),
237 profile_(ptf.profile_, false),
238 meanVelocity_(ptf.meanVelocity_),
239 volumetric_(ptf.volumetric_),
240 rhoName_(ptf.rhoName_),
241 rhoInlet_(ptf.rhoInlet_),
242 alphaName_(ptf.alphaName_),
256 fixedValueFvPatchVectorField::map(ptf, mapper);
259 refCast<const flowRateInletVelocityFvPatchVectorField>(ptf);
261 if (profile_.valid() && canEvaluate())
263 mapper(y_, tiptf.y_);
273 fixedValueFvPatchVectorField::reset(ptf);
276 refCast<const flowRateInletVelocityFvPatchVectorField>(ptf);
278 if (profile_.valid() && canEvaluate())
295 <<
"Cannot evaluate flow rate on a non-parallel processor case"
304 updateValues(alphap);
311 fixedValueFvPatchVectorField::updateCoeffs();
319 if (profile_.valid())
325 writeEntryIfDifferent<word>(os,
"rho",
"rho", rhoName_);
326 writeEntryIfDifferent<scalar>(os,
"rhoInlet", -vGreat, rhoInlet_);
328 writeEntryIfDifferent<word>(os,
"alpha",
word::null, alphaName_);
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 > > New(const word &name, const dictionary &dict)
Selector.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static bool & parRun()
Is this a parallel run?
A list of keyword definitions, which are a keyword followed by any number of values (e....
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Velocity inlet boundary condition creating a velocity field with optionally specified profile normal ...
flowRateInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void map(const fvPatchVectorField &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
A class representing the concept of 1 (scalar(1)) used to avoid unnecessary manipulations for objects...
A class for managing temporary objects.
A class for handling words, derived from string.
static const word null
An empty word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
bool valid(const PtrList< ModelType > &l)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gSum(const FieldField< Field, Type > &f)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
VolField< scalar > volScalarField
Field< vector > vectorField
Specialisation of Field<T> for vector.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Type gMax(const FieldField< Field, Type > &f)