42 fixedValueFvPatchVectorField(
p, iF,
dict, false),
43 pName_(
dict.lookupOrDefault<
word>(
"p",
"p")),
44 cyclicPatchName_(
dict.lookup(
"cyclicPatch")),
45 cyclicPatchLabel_(
p.patch().boundaryMesh().
findIndex(cyclicPatchName_)),
46 orientation_(
dict.lookup<
label>(
"orientation")),
51 openingTime_(
dict.lookup<scalar>(
"openingTime",
dimTime)),
57 minThresholdValue_(
dict.lookup<scalar>(
"minThresholdValue",
dimPressure)),
58 fBased_(
dict.lookup<bool>(
"forceBased")),
66 initCyclicSf_ =
p.boundaryMesh()[cyclicPatchLabel_].Sf();
67 nbrCyclicSf_ = refCast<const cyclicFvPatch>
69 p.boundaryMesh()[cyclicPatchLabel_]
70 ).neighbFvPatch().Sf();
75 dict.lookup(
"p") >> pName_;
89 fixedValueFvPatchVectorField(ptf,
p, iF, mapper),
91 cyclicPatchName_(ptf.cyclicPatchName_),
92 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
93 orientation_(ptf.orientation_),
94 initWallSf_(ptf.initWallSf_),
95 initCyclicSf_(ptf.initCyclicSf_),
96 nbrCyclicSf_(ptf.nbrCyclicSf_),
97 openFraction_(ptf.openFraction_),
98 openingTime_(ptf.openingTime_),
99 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
101 minThresholdValue_(ptf.minThresholdValue_),
102 fBased_(ptf.fBased_),
103 baffleActivated_(ptf.baffleActivated_)
114 fixedValueFvPatchVectorField(ptf, iF),
116 cyclicPatchName_(ptf.cyclicPatchName_),
117 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
118 orientation_(ptf.orientation_),
119 initWallSf_(ptf.initWallSf_),
120 initCyclicSf_(ptf.initCyclicSf_),
121 nbrCyclicSf_(ptf.nbrCyclicSf_),
122 openFraction_(ptf.openFraction_),
123 openingTime_(ptf.openingTime_),
124 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
126 minThresholdValue_(ptf.minThresholdValue_),
127 fBased_(ptf.fBased_),
128 baffleActivated_(ptf.baffleActivated_)
140 fixedValueFvPatchVectorField::map(ptf, mapper);
149 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
150 initWallSf_ = patch().patchSlice(areas);
151 initCyclicSf_ = patch().boundaryMesh()
155 nbrCyclicSf_ = refCast<const cyclicFvPatch>
157 patch().boundaryMesh()
161 ).neighbFvPatch().patch().patchSlice(areas);
170 fixedValueFvPatchVectorField::reset(ptf);
173 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
174 initWallSf_ = patch().patchSlice(areas);
175 initCyclicSf_ = patch().boundaryMesh()
179 nbrCyclicSf_ = refCast<const cyclicFvPatch>
181 patch().boundaryMesh()
185 ).neighbFvPatch().patch().patchSlice(areas);
196 if (curTimeIndex_ != this->db().time().
timeIndex())
204 const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
205 const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
212 scalar valueDiff = 0;
215 forAll(cyclicFaceCells, facei)
217 valueDiff +=
p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
221 forAll(nbrFaceCells, facei)
223 valueDiff -=
p[nbrFaceCells[facei]]*
mag(initCyclicSf_[facei]);
229 valueDiff /=
gSum(patch().magSf());
232 Info<< (fBased_ ?
"Force" :
"Average pressure")
233 <<
" difference = " << valueDiff <<
endl;
235 if ((
mag(valueDiff) >
mag(minThresholdValue_)) || baffleActivated_)
243 this->db().time().deltaT().value()/openingTime_,
244 maxOpenFractionDelta_
251 baffleActivated_ =
true;
255 openFraction_ =
max(
min(1 - 1
e-6, openFraction_), 1
e-6);
258 Info<<
"Open fraction = " << openFraction_ <<
endl;
261 vectorField newSfw((1 - openFraction_)*initWallSf_);
264 Sfw[facei] = newSfw[facei];
270 openFraction_*initCyclicSf_;
273 mag(cyclicPatch.Sf());
277 openFraction_*nbrCyclicSf_;
282 curTimeIndex_ = this->db().time().timeIndex();
285 fixedValueFvPatchVectorField::updateCoeffs();
293 writeEntryIfDifferent<word>(os,
"p",
"p", pName_);
294 writeEntry(os,
"cyclicPatch", cyclicPatchName_);
297 writeEntry(os,
"maxOpenFractionDelta", maxOpenFractionDelta_);
298 writeEntry(os,
"openFraction", openFraction_);
299 writeEntry(os,
"minThresholdValue", minThresholdValue_);
#define forAll(list, i)
Loop across all elements in list.
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...
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Pre-declare related SubField type.
This boundary condition is applied to the flow velocity, to simulate the opening or closure of a baff...
virtual void write(Ostream &) const
Write.
activePressureForceBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchVectorField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Abstract base class for field mapping.
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 operator=(const UList< Type > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
const polyPatch & patch() const
Return the polyPatch.
const scalarField & magSf() const
Return face area magnitudes.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const vectorField & Sf() const
Return face area vectors.
const labelUList & faceCells() const
Return face-cell addressing.
A class for handling words, derived from string.
Type gSum(const FieldField< Field, Type > &f)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const dimensionSet dimPressure
Ostream & endl(Ostream &os)
Add newline and flush stream.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
const unitConversion unitFraction