44 fixedValueFvPatchVectorField(
p, iF),
47 cyclicPatchLabel_(-1),
53 maxOpenFractionDelta_(0),
55 minThresholdValue_(0),
71 fixedValueFvPatchVectorField(ptf,
p, iF, mapper),
73 cyclicPatchName_(ptf.cyclicPatchName_),
74 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
75 initWallSf_(ptf.initWallSf_),
76 initCyclicSf_(ptf.initCyclicSf_),
77 nbrCyclicSf_(ptf.nbrCyclicSf_),
78 openFraction_(ptf.openFraction_),
79 openingTime_(ptf.openingTime_),
80 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
82 minThresholdValue_(ptf.minThresholdValue_),
84 baffleActivated_(ptf.baffleActivated_),
85 opening_(ptf.opening_)
97 fixedValueFvPatchVectorField(
p, iF,
dict, false),
98 pName_(
dict.getOrDefault<
word>(
"p",
"p")),
104 openFraction_(
dict.
get<scalar>(
"openFraction")),
105 openingTime_(
dict.
get<scalar>(
"openingTime")),
106 maxOpenFractionDelta_(
dict.
get<scalar>(
"maxOpenFractionDelta")),
108 minThresholdValue_(
dict.
get<scalar>(
"minThresholdValue")),
117 initWallSf_ =
p.Sf();
118 initCyclicSf_ =
p.boundaryMesh()[cyclicPatchLabel_].Sf();
119 nbrCyclicSf_ = refCast<const cyclicFvPatch>
121 p.boundaryMesh()[cyclicPatchLabel_],
123 ).neighbFvPatch().Sf();
126 dict.readIfPresent(
"p", pName_);
136 fixedValueFvPatchVectorField(ptf),
138 cyclicPatchName_(ptf.cyclicPatchName_),
139 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
140 initWallSf_(ptf.initWallSf_),
141 initCyclicSf_(ptf.initCyclicSf_),
142 nbrCyclicSf_(ptf.nbrCyclicSf_),
143 openFraction_(ptf.openFraction_),
144 openingTime_(ptf.openingTime_),
145 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
147 minThresholdValue_(ptf.minThresholdValue_),
148 fBased_(ptf.fBased_),
149 baffleActivated_(ptf.baffleActivated_),
150 opening_(ptf.opening_)
161 fixedValueFvPatchVectorField(ptf, iF),
163 cyclicPatchName_(ptf.cyclicPatchName_),
164 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
165 initWallSf_(ptf.initWallSf_),
166 initCyclicSf_(ptf.initCyclicSf_),
167 nbrCyclicSf_(ptf.nbrCyclicSf_),
168 openFraction_(ptf.openFraction_),
169 openingTime_(ptf.openingTime_),
170 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
172 minThresholdValue_(ptf.minThresholdValue_),
173 fBased_(ptf.fBased_),
174 baffleActivated_(ptf.baffleActivated_),
175 opening_(ptf.opening_)
186 fixedValueFvPatchVectorField::autoMap(m);
198 Info <<
"faceArea[active] "<< i <<
endl;
202 if (
patch().size() > 0)
205 initWallSf_ =
patch().patchSlice(areas);
207 patch().boundaryMesh()[cyclicPatchLabel_].patchSlice(areas);
208 nbrCyclicSf_ = refCast<const cyclicFvPatch>
210 patch().boundaryMesh()
214 ).neighbFvPatch().patch().patchSlice(areas);
225 fixedValueFvPatchVectorField::rmap(ptf, addr);
229 initWallSf_ =
patch().patchSlice(areas);
231 patch().boundaryMesh()[cyclicPatchLabel_].patchSlice(areas);
232 nbrCyclicSf_ = refCast<const cyclicFvPatch>
234 patch().boundaryMesh()
238 ).neighbFvPatch().patch().patchSlice(areas);
250 if (curTimeIndex_ != this->db().time().
timeIndex())
255 const fvPatch& cyclicPatch =
patch().boundaryMesh()[cyclicPatchLabel_];
256 const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
257 const fvPatch& nbrPatch =
258 refCast<const cyclicFvPatch>(cyclicPatch).neighbFvPatch();
260 const labelList& nbrFaceCells = nbrPatch.patch().faceCells();
262 scalar valueDiff = 0;
265 forAll(cyclicFaceCells, facei)
267 valueDiff +=
p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
271 forAll(nbrFaceCells, facei)
273 valueDiff -=
p[nbrFaceCells[facei]]*
mag(initCyclicSf_[facei]);
278 valueDiff = valueDiff/
gSum(
patch().magSf());
281 reduce(valueDiff, sumOp<scalar>());
287 Info<<
"Force difference = " << valueDiff <<
endl;
291 Info<<
"Area-averaged pressure difference = "
292 << valueDiff <<
endl;
296 if (
mag(valueDiff) >
mag(minThresholdValue_) || baffleActivated_)
306 this->db().time().deltaT().value()/openingTime_,
307 maxOpenFractionDelta_
314 baffleActivated_ =
true;
318 openFraction_ =
max(
min(1 - 1
e-6, openFraction_), 1
e-6);
323 Info<<
"Open fraction = " << openFraction_ <<
endl;
326 scalar areaFraction = 0.0;
330 areaFraction = openFraction_;
334 areaFraction = 1 - openFraction_;
337 if (
patch().boundaryMesh().
mesh().moving())
343 initWallSf_ =
patch().Sf();
344 initCyclicSf_ =
patch().boundaryMesh()[cyclicPatchLabel_].Sf();
345 nbrCyclicSf_ = refCast<const cyclicFvPatch>
347 patch().boundaryMesh()[cyclicPatchLabel_]
348 ).neighbFvPatch().Sf();
353 vectorField newSfw((1 - areaFraction)*initWallSf_);
356 Sfw[facei] = newSfw[facei];
361 const_cast<vectorField&
>(cyclicPatch.Sf()) = areaFraction*initCyclicSf_;
363 const_cast<scalarField&
>(cyclicPatch.magSf()) =
mag(cyclicPatch.Sf());
366 const_cast<vectorField&
>(nbrPatch.Sf()) = areaFraction*nbrCyclicSf_;
370 curTimeIndex_ = this->db().time().timeIndex();
373 fixedValueFvPatchVectorField::updateCoeffs();
384 os.
writeEntry(
"maxOpenFractionDelta", maxOpenFractionDelta_);
389 writeEntry(
"value",
os);
400 activePressureForceBaffleVelocityFvPatchVectorField