41 fixedValueFvPatchVectorField(p, iF),
44 cyclicPatchLabel_(-1),
51 maxOpenFractionDelta_(0),
53 minThresholdValue_(0),
67 fixedValueFvPatchVectorField(p, iF, dict,
false),
69 cyclicPatchName_(dict.
lookup(
"cyclicPatch")),
75 openFraction_(dict.
lookup<scalar>(
"openFraction")),
76 openingTime_(dict.
lookup<scalar>(
"openingTime")),
77 maxOpenFractionDelta_(dict.
lookup<scalar>(
"maxOpenFractionDelta")),
79 minThresholdValue_(dict.
lookup<scalar>(
"minThresholdValue")),
83 fvPatchVectorField::operator=(
Zero);
88 initCyclicSf_ = p.
boundaryMesh()[cyclicPatchLabel_].Sf();
89 nbrCyclicSf_ = refCast<const cyclicFvPatch>
92 ).neighbFvPatch().Sf();
97 dict.
lookup(
"p") >> pName_;
111 fixedValueFvPatchVectorField(ptf, p, iF, mapper),
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_)
136 fixedValueFvPatchVectorField(ptf, iF),
138 cyclicPatchName_(ptf.cyclicPatchName_),
139 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
140 orientation_(ptf.orientation_),
141 initWallSf_(ptf.initWallSf_),
142 initCyclicSf_(ptf.initCyclicSf_),
143 nbrCyclicSf_(ptf.nbrCyclicSf_),
144 openFraction_(ptf.openFraction_),
145 openingTime_(ptf.openingTime_),
146 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
148 minThresholdValue_(ptf.minThresholdValue_),
149 fBased_(ptf.fBased_),
150 baffleActivated_(ptf.baffleActivated_)
161 fixedValueFvPatchVectorField::autoMap(m);
169 forAll(patch().boundaryMesh().
mesh().faceAreas(), i)
171 if (
mag(patch().boundaryMesh().
mesh().faceAreas()[i]) == 0)
173 Info <<
"faceArea[active] "<< i <<
endl;
176 if (patch().size() > 0)
178 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
179 initWallSf_ = patch().patchSlice(areas);
180 initCyclicSf_ = patch().boundaryMesh()
184 nbrCyclicSf_ = refCast<const cyclicFvPatch>
186 patch().boundaryMesh()
190 ).neighbFvPatch().patch().patchSlice(areas);
201 fixedValueFvPatchVectorField::rmap(ptf, addr);
204 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
205 initWallSf_ = patch().patchSlice(areas);
206 initCyclicSf_ = patch().boundaryMesh()
210 nbrCyclicSf_ = refCast<const cyclicFvPatch>
212 patch().boundaryMesh()
216 ).neighbFvPatch().patch().patchSlice(areas);
225 fixedValueFvPatchVectorField::reset(ptf);
228 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
229 initWallSf_ = patch().patchSlice(areas);
230 initCyclicSf_ = patch().boundaryMesh()
234 nbrCyclicSf_ = refCast<const cyclicFvPatch>
236 patch().boundaryMesh()
240 ).neighbFvPatch().patch().patchSlice(areas);
251 if (curTimeIndex_ != this->db().time().
timeIndex())
259 const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
260 const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
267 scalar valueDiff = 0;
272 forAll(cyclicFaceCells, facei)
274 valueDiff +=p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
278 forAll(nbrFaceCells, facei)
280 valueDiff -=p[nbrFaceCells[facei]]*
mag(initCyclicSf_[facei]);
283 Info<<
"Force difference = " << valueDiff <<
endl;
287 forAll(cyclicFaceCells, facei)
289 valueDiff += p[cyclicFaceCells[facei]];
292 forAll(nbrFaceCells, facei)
294 valueDiff -= p[nbrFaceCells[facei]];
297 Info<<
"Pressure difference = " << valueDiff <<
endl;
300 if ((
mag(valueDiff) >
mag(minThresholdValue_)) || baffleActivated_)
308 this->db().time().deltaT().value()/openingTime_,
309 maxOpenFractionDelta_
316 baffleActivated_ =
true;
320 openFraction_ =
max(
min(1 - 1
e-6, openFraction_), 1
e-6);
323 Info<<
"Open fraction = " << openFraction_ <<
endl;
326 vectorField newSfw((1 - openFraction_)*initWallSf_);
329 Sfw[facei] = newSfw[facei];
335 openFraction_*initCyclicSf_;
338 mag(cyclicPatch.Sf());
342 openFraction_*nbrCyclicSf_;
347 curTimeIndex_ = this->db().time().timeIndex();
350 fixedValueFvPatchVectorField::updateCoeffs();
358 writeEntryIfDifferent<word>(os,
"p",
"p", pName_);
359 writeEntry(os,
"cyclicPatch", cyclicPatchName_);
362 writeEntry(os,
"maxOpenFractionDelta", maxOpenFractionDelta_);
363 writeEntry(os,
"openFraction", openFraction_);
364 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.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const scalarField & magSf() const
Return face area magnitudes.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
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.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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)
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.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.