41 fixedValueFvPatchVectorField(p, iF),
44 cyclicPatchLabel_(-1),
51 maxOpenFractionDelta_(0),
53 minThresholdValue_(0),
68 fixedValueFvPatchVectorField(ptf, p, iF, mapper),
70 cyclicPatchName_(ptf.cyclicPatchName_),
71 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
72 orientation_(ptf.orientation_),
73 initWallSf_(ptf.initWallSf_),
74 initCyclicSf_(ptf.initCyclicSf_),
75 nbrCyclicSf_(ptf.nbrCyclicSf_),
76 openFraction_(ptf.openFraction_),
77 openingTime_(ptf.openingTime_),
78 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
80 minThresholdValue_(ptf.minThresholdValue_),
82 baffleActivated_(ptf.baffleActivated_)
94 fixedValueFvPatchVectorField(p, iF, dict,
false),
96 cyclicPatchName_(dict.
lookup(
"cyclicPatch")),
110 fvPatchVectorField::operator=(
Zero);
114 initWallSf_ = p.
Sf();
115 initCyclicSf_ = p.
boundaryMesh()[cyclicPatchLabel_].Sf();
116 nbrCyclicSf_ = refCast<const cyclicFvPatch>
119 ).neighbFvPatch().Sf();
124 dict.
lookup(
"p") >> pName_;
135 fixedValueFvPatchVectorField(ptf),
137 cyclicPatchName_(ptf.cyclicPatchName_),
138 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
139 orientation_(ptf.orientation_),
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_)
160 fixedValueFvPatchVectorField(ptf, iF),
162 cyclicPatchName_(ptf.cyclicPatchName_),
163 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
164 orientation_(ptf.orientation_),
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_)
185 fixedValueFvPatchVectorField::autoMap(m);
197 Info <<
"faceArea[active] "<< i <<
endl;
200 if (patch().size() > 0)
202 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
203 initWallSf_ = patch().patchSlice(areas);
204 initCyclicSf_ = patch().boundaryMesh()
208 nbrCyclicSf_ = refCast<const cyclicFvPatch>
210 patch().boundaryMesh()
214 ).neighbFvPatch().patch().patchSlice(areas);
224 fixedValueFvPatchVectorField::rmap(ptf, addr);
227 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
228 initWallSf_ = patch().patchSlice(areas);
229 initCyclicSf_ = patch().boundaryMesh()
233 nbrCyclicSf_ = refCast<const cyclicFvPatch>
235 patch().boundaryMesh()
239 ).neighbFvPatch().patch().patchSlice(areas);
250 if (curTimeIndex_ != this->db().time().
timeIndex())
258 const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
259 const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
266 scalar valueDiff = 0;
271 forAll(cyclicFaceCells, facei)
273 valueDiff +=p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
277 forAll(nbrFaceCells, facei)
279 valueDiff -=p[nbrFaceCells[facei]]*
mag(initCyclicSf_[facei]);
282 Info<<
"Force difference = " << valueDiff <<
endl;
286 forAll(cyclicFaceCells, facei)
288 valueDiff += p[cyclicFaceCells[facei]];
291 forAll(nbrFaceCells, facei)
293 valueDiff -= p[nbrFaceCells[facei]];
296 Info<<
"Pressure difference = " << valueDiff <<
endl;
299 if ((
mag(valueDiff) >
mag(minThresholdValue_)) || baffleActivated_)
307 this->db().time().deltaT().value()/openingTime_,
308 maxOpenFractionDelta_
315 baffleActivated_ =
true;
319 openFraction_ =
max(
min(1 - 1
e-6, openFraction_), 1
e-6);
322 Info<<
"Open fraction = " << openFraction_ <<
endl;
325 vectorField newSfw((1 - openFraction_)*initWallSf_);
328 Sfw[facei] = newSfw[facei];
334 openFraction_*initCyclicSf_;
337 mag(cyclicPatch.Sf());
341 openFraction_*nbrCyclicSf_;
346 curTimeIndex_ = this->db().time().timeIndex();
349 fixedValueFvPatchVectorField::updateCoeffs();
357 writeEntryIfDifferent<word>(os,
"p",
"p", pName_);
358 writeEntry(os,
"cyclicPatch", cyclicPatchName_);
361 writeEntry(os,
"maxOpenFractionDelta", maxOpenFractionDelta_);
362 writeEntry(os,
"openFraction", openFraction_);
363 writeEntry(os,
"minThresholdValue", minThresholdValue_);
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
This boundary condition is applied to the flow velocity, to simulate the opening or closure of a baff...
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
const scalarField & magSf() const
Return face area magnitudes.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
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...
label findPatchID(const word &patchName) const
Find patch index given a name.
virtual void write(Ostream &) const
Write.
Pre-declare related SubField type.
Macros for easy insertion into run-time selection tables.
virtual void write(Ostream &) const
Write.
const labelUList & faceCells() const
Return face-cell addressing.
A class for handling words, derived from string.
const polyPatch & patch() const
Return the polyPatch.
activePressureForceBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
label readLabel(Istream &is)
virtual label size() const
Return size.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const vectorField & Sf() const
Return face area vectors.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
const doubleScalar e
Elementary charge.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.