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()))
79 /
gSum(alpha*rho*profile*patch().magSf());
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 meanVelocity_(
false),
165 rhoInlet_(dict.lookupOrDefault<scalar>(
"rhoInlet", -vGreat)),
168 if (dict.found(
"meanVelocity"))
170 meanVelocity_ =
true;
174 else if (dict.found(
"volumetricFlowRate"))
176 meanVelocity_ =
false;
180 else if (dict.found(
"massFlowRate"))
182 meanVelocity_ =
false;
185 rhoName_ =
word(dict.lookupOrDefault<
word>(
"rho",
"rho"));
192 ) <<
"Please supply 'meanVelocity', 'volumetricFlowRate' or" 196 if (dict.found(
"profile"))
206 if (!canEvaluate() || dict.found(
"value"))
230 flowRate_(ptf.flowRate_,
false),
231 profile_(ptf.profile_,
false),
232 meanVelocity_(ptf.meanVelocity_),
233 volumetric_(ptf.volumetric_),
234 rhoName_(ptf.rhoName_),
235 rhoInlet_(ptf.rhoInlet_),
236 alphaName_(ptf.alphaName_),
250 flowRate_(ptf.flowRate_,
false),
251 profile_(ptf.profile_,
false),
252 meanVelocity_(ptf.meanVelocity_),
253 volumetric_(ptf.volumetric_),
254 rhoName_(ptf.rhoName_),
255 rhoInlet_(ptf.rhoInlet_),
256 alphaName_(ptf.alphaName_),
269 fixedValueFvPatchVectorField::autoMap(m);
284 fixedValueFvPatchVectorField::rmap(ptf, addr);
287 refCast<const flowRateInletVelocityFvPatchVectorField>(ptf);
289 if (profile_.valid() && canEvaluate())
291 y_.
rmap(tiptf.y_, addr);
301 fixedValueFvPatchVectorField::reset(ptf);
304 refCast<const flowRateInletVelocityFvPatchVectorField>(ptf);
306 if (profile_.valid() && canEvaluate())
323 <<
"Cannot evaluate flow rate on a non-parallel processor case" 332 updateValues(alphap);
339 fixedValueFvPatchVectorField::updateCoeffs();
347 if (profile_.valid())
353 writeEntryIfDifferent<word>(os,
"rho",
"rho", rhoName_);
354 writeEntryIfDifferent<scalar>(os,
"rhoInlet", -vGreat, rhoInlet_);
356 writeEntryIfDifferent<word>(os,
"alpha",
word::null, alphaName_);
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)
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
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.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write.
virtual void write(Ostream &) const
Write.
Macros for easy insertion into run-time selection tables.
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Type gSum(const FieldField< Field, Type > &f)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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 creating a velocity field with optionally specified profile normal ...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Type gMax(const FieldField< Field, Type > &f)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
static bool & parRun()
Is this a parallel run?
#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...
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
void reset(const Field< Type > &)
Reset the field values to the given field.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
static autoPtr< Function1< Type > > New(const word &name, const dictionary &dict)
Selector.
A class representing the concept of 1 (scalar(1)) used to avoid unnecessary manipulations for objects...