42 fixedValueFvPatchVectorField(
p, iF,
dict, false),
43 pName_(
dict.lookupOrDefault<
word>(
"p",
"p")),
44 cyclicPatchName_(
dict.lookup(
"cyclicPatch")),
45 cyclicPatchLabel_(
p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
46 orientation_(
dict.lookup<
label>(
"orientation")),
50 openFraction_(
dict.lookup<scalar>(
"openFraction")),
51 openingTime_(
dict.lookup<scalar>(
"openingTime")),
52 maxOpenFractionDelta_(
dict.lookup<scalar>(
"maxOpenFractionDelta")),
54 minThresholdValue_(
dict.lookup<scalar>(
"minThresholdValue")),
63 initCyclicSf_ =
p.boundaryMesh()[cyclicPatchLabel_].Sf();
64 nbrCyclicSf_ = refCast<const cyclicFvPatch>
66 p.boundaryMesh()[cyclicPatchLabel_]
67 ).neighbFvPatch().Sf();
72 dict.lookup(
"p") >> pName_;
86 fixedValueFvPatchVectorField(ptf,
p, iF, mapper),
88 cyclicPatchName_(ptf.cyclicPatchName_),
89 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
90 orientation_(ptf.orientation_),
91 initWallSf_(ptf.initWallSf_),
92 initCyclicSf_(ptf.initCyclicSf_),
93 nbrCyclicSf_(ptf.nbrCyclicSf_),
94 openFraction_(ptf.openFraction_),
95 openingTime_(ptf.openingTime_),
96 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
98 minThresholdValue_(ptf.minThresholdValue_),
100 baffleActivated_(ptf.baffleActivated_)
111 fixedValueFvPatchVectorField(ptf, iF),
113 cyclicPatchName_(ptf.cyclicPatchName_),
114 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
115 orientation_(ptf.orientation_),
116 initWallSf_(ptf.initWallSf_),
117 initCyclicSf_(ptf.initCyclicSf_),
118 nbrCyclicSf_(ptf.nbrCyclicSf_),
119 openFraction_(ptf.openFraction_),
120 openingTime_(ptf.openingTime_),
121 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
123 minThresholdValue_(ptf.minThresholdValue_),
124 fBased_(ptf.fBased_),
125 baffleActivated_(ptf.baffleActivated_)
137 fixedValueFvPatchVectorField::map(ptf, mapper);
146 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
147 initWallSf_ = patch().patchSlice(areas);
148 initCyclicSf_ = patch().boundaryMesh()
152 nbrCyclicSf_ = refCast<const cyclicFvPatch>
154 patch().boundaryMesh()
158 ).neighbFvPatch().patch().patchSlice(areas);
167 fixedValueFvPatchVectorField::reset(ptf);
170 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
171 initWallSf_ = patch().patchSlice(areas);
172 initCyclicSf_ = patch().boundaryMesh()
176 nbrCyclicSf_ = refCast<const cyclicFvPatch>
178 patch().boundaryMesh()
182 ).neighbFvPatch().patch().patchSlice(areas);
193 if (curTimeIndex_ != this->db().time().
timeIndex())
201 const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
202 const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
209 scalar valueDiff = 0;
214 forAll(cyclicFaceCells, facei)
216 valueDiff +=
p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
220 forAll(nbrFaceCells, facei)
222 valueDiff -=
p[nbrFaceCells[facei]]*
mag(initCyclicSf_[facei]);
225 Info<<
"Force difference = " << valueDiff <<
endl;
229 forAll(cyclicFaceCells, facei)
231 valueDiff +=
p[cyclicFaceCells[facei]];
234 forAll(nbrFaceCells, facei)
236 valueDiff -=
p[nbrFaceCells[facei]];
239 Info<<
"Pressure difference = " << valueDiff <<
endl;
242 if ((
mag(valueDiff) >
mag(minThresholdValue_)) || baffleActivated_)
250 this->db().time().deltaT().value()/openingTime_,
251 maxOpenFractionDelta_
258 baffleActivated_ =
true;
262 openFraction_ =
max(
min(1 - 1
e-6, openFraction_), 1
e-6);
265 Info<<
"Open fraction = " << openFraction_ <<
endl;
268 vectorField newSfw((1 - openFraction_)*initWallSf_);
271 Sfw[facei] = newSfw[facei];
277 openFraction_*initCyclicSf_;
280 mag(cyclicPatch.Sf());
284 openFraction_*nbrCyclicSf_;
289 curTimeIndex_ = this->db().time().timeIndex();
292 fixedValueFvPatchVectorField::updateCoeffs();
300 writeEntryIfDifferent<word>(os,
"p",
"p", pName_);
301 writeEntry(os,
"cyclicPatch", cyclicPatchName_);
304 writeEntry(os,
"maxOpenFractionDelta", maxOpenFractionDelta_);
305 writeEntry(os,
"openFraction", openFraction_);
306 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 map(const fvPatchVectorField &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
A list of keyword definitions, which are a keyword followed by any number of values (e....
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.
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)