42 fixedValueFvPatchVectorField(
p, iF,
dict, false),
43 pName_(
dict.lookupOrDefault<
word>(
"p",
"p")),
44 cyclicPatchName_(
dict.lookup(
"cyclicPatch")),
45 cyclicPatchLabel_(
p.patch().boundaryMesh().
findIndex(cyclicPatchName_)),
46 orientation_(
dict.lookup<
label>(
"orientation")),
51 openingTime_(
dict.lookup<scalar>(
"openingTime",
dimTime)),
57 minThresholdValue_(
dict.lookup<scalar>(
"minThresholdValue",
dimPressure)),
58 fBased_(
dict.lookup<bool>(
"forceBased")),
66 initCyclicSf_ =
p.boundaryMesh()[cyclicPatchLabel_].Sf();
67 nbrCyclicSf_ = refCast<const cyclicFvPatch>
69 p.boundaryMesh()[cyclicPatchLabel_]
70 ).neighbFvPatch().Sf();
75 dict.lookup(
"p") >> pName_;
89 fixedValueFvPatchVectorField(ptf,
p, iF, mapper),
91 cyclicPatchName_(ptf.cyclicPatchName_),
92 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
93 orientation_(ptf.orientation_),
94 initWallSf_(ptf.initWallSf_),
95 initCyclicSf_(ptf.initCyclicSf_),
96 nbrCyclicSf_(ptf.nbrCyclicSf_),
97 openFraction_(ptf.openFraction_),
98 openingTime_(ptf.openingTime_),
99 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
101 minThresholdValue_(ptf.minThresholdValue_),
102 fBased_(ptf.fBased_),
103 baffleActivated_(ptf.baffleActivated_)
114 fixedValueFvPatchVectorField(ptf, iF),
116 cyclicPatchName_(ptf.cyclicPatchName_),
117 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
118 orientation_(ptf.orientation_),
119 initWallSf_(ptf.initWallSf_),
120 initCyclicSf_(ptf.initCyclicSf_),
121 nbrCyclicSf_(ptf.nbrCyclicSf_),
122 openFraction_(ptf.openFraction_),
123 openingTime_(ptf.openingTime_),
124 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
126 minThresholdValue_(ptf.minThresholdValue_),
127 fBased_(ptf.fBased_),
128 baffleActivated_(ptf.baffleActivated_)
140 fixedValueFvPatchVectorField::map(ptf, mapper);
149 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
150 initWallSf_ = patch().patchSlice(areas);
151 initCyclicSf_ = patch().boundaryMesh()
155 nbrCyclicSf_ = refCast<const cyclicFvPatch>
157 patch().boundaryMesh()
161 ).neighbFvPatch().patch().patchSlice(areas);
170 fixedValueFvPatchVectorField::reset(ptf);
173 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
174 initWallSf_ = patch().patchSlice(areas);
175 initCyclicSf_ = patch().boundaryMesh()
179 nbrCyclicSf_ = refCast<const cyclicFvPatch>
181 patch().boundaryMesh()
185 ).neighbFvPatch().patch().patchSlice(areas);
196 if (curTimeIndex_ != this->db().time().
timeIndex())
204 const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
205 const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
212 scalar valueDiff = 0;
217 forAll(cyclicFaceCells, facei)
219 valueDiff +=
p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
223 forAll(nbrFaceCells, facei)
225 valueDiff -=
p[nbrFaceCells[facei]]*
mag(initCyclicSf_[facei]);
228 Info<<
"Force difference = " << valueDiff <<
endl;
232 forAll(cyclicFaceCells, facei)
234 valueDiff +=
p[cyclicFaceCells[facei]];
237 forAll(nbrFaceCells, facei)
239 valueDiff -=
p[nbrFaceCells[facei]];
242 Info<<
"Pressure difference = " << valueDiff <<
endl;
245 if ((
mag(valueDiff) >
mag(minThresholdValue_)) || baffleActivated_)
253 this->db().time().deltaT().value()/openingTime_,
254 maxOpenFractionDelta_
261 baffleActivated_ =
true;
265 openFraction_ =
max(
min(1 - 1
e-6, openFraction_), 1
e-6);
268 Info<<
"Open fraction = " << openFraction_ <<
endl;
271 vectorField newSfw((1 - openFraction_)*initWallSf_);
274 Sfw[facei] = newSfw[facei];
280 openFraction_*initCyclicSf_;
283 mag(cyclicPatch.Sf());
287 openFraction_*nbrCyclicSf_;
292 curTimeIndex_ = this->db().time().timeIndex();
295 fixedValueFvPatchVectorField::updateCoeffs();
303 writeEntryIfDifferent<word>(os,
"p",
"p", pName_);
304 writeEntry(os,
"cyclicPatch", cyclicPatchName_);
307 writeEntry(os,
"maxOpenFractionDelta", maxOpenFractionDelta_);
308 writeEntry(os,
"openFraction", openFraction_);
309 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 reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchVectorField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Abstract base class for field mapping.
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.
const dimensionSet dimPressure
Ostream & endl(Ostream &os)
Add newline and flush stream.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
const unitConversion unitFraction