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);
200 fixedValueFvPatchVectorField::rmap(ptf, addr);
203 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
204 initWallSf_ = patch().patchSlice(areas);
205 initCyclicSf_ = patch().boundaryMesh()
209 nbrCyclicSf_ = refCast<const cyclicFvPatch>
211 patch().boundaryMesh()
215 ).neighbFvPatch().patch().patchSlice(areas);
226 if (curTimeIndex_ != this->db().time().
timeIndex())
234 const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
235 const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
242 scalar valueDiff = 0;
247 forAll(cyclicFaceCells, facei)
249 valueDiff +=p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
253 forAll(nbrFaceCells, facei)
255 valueDiff -=p[nbrFaceCells[facei]]*
mag(initCyclicSf_[facei]);
258 Info<<
"Force difference = " << valueDiff <<
endl;
262 forAll(cyclicFaceCells, facei)
264 valueDiff += p[cyclicFaceCells[facei]];
267 forAll(nbrFaceCells, facei)
269 valueDiff -= p[nbrFaceCells[facei]];
272 Info<<
"Pressure difference = " << valueDiff <<
endl;
275 if ((
mag(valueDiff) >
mag(minThresholdValue_)) || baffleActivated_)
283 this->db().time().deltaT().value()/openingTime_,
284 maxOpenFractionDelta_
291 baffleActivated_ =
true;
295 openFraction_ =
max(
min(1 - 1
e-6, openFraction_), 1
e-6);
298 Info<<
"Open fraction = " << openFraction_ <<
endl;
301 vectorField newSfw((1 - openFraction_)*initWallSf_);
304 Sfw[facei] = newSfw[facei];
310 openFraction_*initCyclicSf_;
313 mag(cyclicPatch.Sf());
317 openFraction_*nbrCyclicSf_;
322 curTimeIndex_ = this->db().time().timeIndex();
325 fixedValueFvPatchVectorField::updateCoeffs();
333 writeEntryIfDifferent<word>(os,
"p",
"p", pName_);
334 writeEntry(os,
"cyclicPatch", cyclicPatchName_);
337 writeEntry(os,
"maxOpenFractionDelta", maxOpenFractionDelta_);
338 writeEntry(os,
"openFraction", openFraction_);
339 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.
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 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.
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.
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.