44 fixedValueFvPatchVectorField(
p, iF),
47 cyclicPatchLabel_(-1),
54 maxOpenFractionDelta_(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_),
92 pName_(
dict.getOrDefault<
word>(
"p",
"p")),
94 cyclicPatchLabel_(
p.patch().
boundaryMesh().findPatchID(cyclicPatchName_)),
95 orientation_(
dict.get<label>(
"orientation")),
104 ).neighbFvPatch().Sf()
106 openFraction_(
dict.get<scalar>(
"openFraction")),
107 openingTime_(
dict.get<scalar>(
"openingTime")),
108 maxOpenFractionDelta_(
dict.get<scalar>(
"maxOpenFractionDelta")),
121 fixedValueFvPatchVectorField(ptf),
123 cyclicPatchName_(ptf.cyclicPatchName_),
124 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
125 orientation_(ptf.orientation_),
126 initWallSf_(ptf.initWallSf_),
127 initCyclicSf_(ptf.initCyclicSf_),
128 nbrCyclicSf_(ptf.nbrCyclicSf_),
129 openFraction_(ptf.openFraction_),
130 openingTime_(ptf.openingTime_),
131 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
143 fixedValueFvPatchVectorField(ptf, iF),
145 cyclicPatchName_(ptf.cyclicPatchName_),
146 cyclicPatchLabel_(ptf.cyclicPatchLabel_),
147 orientation_(ptf.orientation_),
148 initWallSf_(ptf.initWallSf_),
149 initCyclicSf_(ptf.initCyclicSf_),
150 nbrCyclicSf_(ptf.nbrCyclicSf_),
151 openFraction_(ptf.openFraction_),
152 openingTime_(ptf.openingTime_),
153 maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
165 fixedValueFvPatchVectorField::autoMap(m);
173 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
174 initWallSf_ = patch().patchSlice(areas);
175 initCyclicSf_ = patch().boundaryMesh()
185 ).neighbFvPatch().patch().patchSlice(areas);
195 fixedValueFvPatchVectorField::rmap(ptf, addr);
198 const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
199 initWallSf_ = patch().patchSlice(areas);
200 initCyclicSf_ = patch().boundaryMesh()
210 ).neighbFvPatch().patch().patchSlice(areas);
222 if (curTimeIndex_ != this->db().time().
timeIndex())
229 const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_];
230 const labelUList& cyclicFaceCells = cyclicPatch.patch().faceCells();
235 const labelUList& nbrFaceCells = nbrPatch.patch().faceCells();
237 scalar forceDiff = 0;
240 forAll(cyclicFaceCells, facei)
242 forceDiff +=
p[cyclicFaceCells[facei]]*
mag(initCyclicSf_[facei]);
246 forAll(nbrFaceCells, facei)
248 forceDiff -=
p[nbrFaceCells[facei]]*
mag(nbrCyclicSf_[facei]);
256 this->db().time().deltaTValue()/openingTime_,
257 maxOpenFractionDelta_
259 *(orientation_*
sign(forceDiff))
262 openFraction_ =
clamp(openFraction_, scalar(1
e-6), scalar(1 - 1
e-6));
264 Info<<
"openFraction = " << openFraction_ <<
endl;
267 const vectorField newSfw((1 - openFraction_)*initWallSf_);
270 Sfw[facei] = newSfw[facei];
276 openFraction_*initCyclicSf_;
278 mag(cyclicPatch.Sf());
281 openFraction_*nbrCyclicSf_;
285 curTimeIndex_ = this->db().time().timeIndex();
288 fixedValueFvPatchVectorField::updateCoeffs();
295 os.writeEntryIfDifferent<
word>(
"p",
"p", pName_);
296 os.writeEntry(
"cyclicPatch", cyclicPatchName_);
297 os.writeEntry(
"orientation", orientation_);
298 os.writeEntry(
"openingTime", openingTime_);
299 os.writeEntry(
"maxOpenFractionDelta", maxOpenFractionDelta_);
300 os.writeEntry(
"openFraction", openFraction_);
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...
SubField< vector > subField
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
This velocity boundary condition simulates the opening of a baffle due to local flow conditions,...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void write(Ostream &) const
Write.
activeBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void operator=(const UList< vector > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
const polyPatch & patch() const noexcept
Return the polyPatch.
const scalarField & magSf() const
Return face area magnitudes, like the fvMesh::magSf() method.
const vectorField & Sf() const
Return face area vectors, like the fvMesh::Sf() method.
const labelUList & faceCells() const
Return face-cell addressing.
Lookup type of boundary radiation properties.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
const std::string patch
OpenFOAM patch number as a std::string.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
dimensionedScalar sign(const dimensionedScalar &ds)
List< label > labelList
A List of labels.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
UList< label > labelUList
A UList of labels.
fvPatchField< vector > fvPatchVectorField
#define forAll(list, i)
Loop across all elements in list.