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();
145 rhoInlet_(
dict.lookupOrDefault<scalar>(
"rhoInlet", -vGreat)),
146 alphaName_(
dict.lookupOrDefault<
word>(
"alpha",
word::null))
148 if (
dict.found(
"meanVelocity"))
150 meanVelocity_ =
true;
154 else if (
dict.found(
"volumetricFlowRate"))
156 meanVelocity_ =
false;
160 else if (
dict.found(
"massFlowRate"))
162 meanVelocity_ =
false;
165 rhoName_ =
word(
dict.lookupOrDefault<
word>(
"rho",
"rho"));
172 ) <<
"Please supply 'meanVelocity', 'volumetricFlowRate' or"
176 if (
dict.found(
"profile"))
186 if (!canEvaluate() ||
dict.found(
"value"))
210 flowRate_(ptf.flowRate_, false),
211 profile_(ptf.profile_, false),
212 meanVelocity_(ptf.meanVelocity_),
213 volumetric_(ptf.volumetric_),
214 rhoName_(ptf.rhoName_),
215 rhoInlet_(ptf.rhoInlet_),
216 alphaName_(ptf.alphaName_),
219 profile_.
valid() && canEvaluate()
235 flowRate_(ptf.flowRate_, false),
236 profile_(ptf.profile_, false),
237 meanVelocity_(ptf.meanVelocity_),
238 volumetric_(ptf.volumetric_),
239 rhoName_(ptf.rhoName_),
240 rhoInlet_(ptf.rhoInlet_),
241 alphaName_(ptf.alphaName_),
255 fixedValueFvPatchVectorField::map(ptf, mapper);
258 refCast<const flowRateInletVelocityFvPatchVectorField>(ptf);
260 if (profile_.valid() && canEvaluate())
262 mapper(y_, tiptf.y_);
272 fixedValueFvPatchVectorField::reset(ptf);
275 refCast<const flowRateInletVelocityFvPatchVectorField>(ptf);
277 if (profile_.valid() && canEvaluate())
294 <<
"Cannot evaluate flow rate on a non-parallel processor case"
303 updateValues(alphap);
310 fixedValueFvPatchVectorField::updateCoeffs();
318 if (profile_.valid())
324 writeEntryIfDifferent<word>(os,
"rho",
"rho", rhoName_);
325 writeEntryIfDifferent<scalar>(os,
"rhoInlet", -vGreat, rhoInlet_);
327 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)