activePressureForceBaffleVelocityFvPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::activePressureForceBaffleVelocityFvPatchVectorField
26 
27 Description
28  This boundary condition is applied to the flow velocity, to simulate the
29  opening or closure of a baffle due to local pressure or force changes,
30  by merging the behaviours of wall and cyclic conditions.
31 
32  The baffle joins two mesh regions, where the open fraction determines
33  the interpolation weights applied to each cyclic- and neighbour-patch
34  contribution. This means that this is boundary condition is meant to be
35  used in an extra wall beyond an existing cyclic patch pair.
36 
37  Once the threshold is crossed, this condition activated and continues to
38  open or close at a fixed rate using
39 
40  \f[
41  x = x_{old} + s \times \frac{dt}{DT}
42  \f]
43 
44  where
45 
46  \vartable
47  x | baffle open fraction [0-1]
48  x_{old} | baffle open fraction on previous evaluation
49  s | sign for orientation: 1 to open or -1 to close
50  dt | simulation time step
51  DT | time taken to open the baffle
52  \endvartable
53 
54  The open fraction is then applied to scale the patch areas.
55 
56 Usage
57  \table
58  Property | Description | Required | Default value
59  p | pressure field name | no | p
60  cyclicPatch | cyclic patch name | yes |
61  orientation | 1 to open or -1 to close | yes|
62  openFraction | current open fraction [0-1] | yes |
63  openingTime | time taken to open or close the baffle | yes |
64  maxOpenFractionDelta | max fraction change per timestep | yes |
65  minThresholdValue | minimum absolute pressure or
66  force difference for activation | yes |
67  forceBased | force (true) or pressure-based (false) activation | yes |
68  \endtable
69 
70  Example of the boundary condition specification:
71  \verbatim
72  <patchName>
73  {
74  type activePressureForceBaffleVelocity;
75  p p;
76  cyclicPatch cyclic1;
77  orientation 1;
78  openFraction 0.2;
79  openingTime 5.0;
80  maxOpenFractionDelta 0.1;
81  minThresholdValue 0.01;
82  forceBased false;
83  }
84  \endverbatim
85 
86 SourceFiles
87  activePressureForceBaffleVelocityFvPatchVectorField.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef activePressureForceBaffleVelocityFvPatchVectorField_H
92 #define activePressureForceBaffleVelocityFvPatchVectorField_H
93 
94 #include "fvPatchFields.H"
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 namespace Foam
100 {
101 
102 /*---------------------------------------------------------------------------*\
103  Class activePressureForceBaffleVelocityFvPatchVectorField Declaration
104 \*---------------------------------------------------------------------------*/
105 
106 class activePressureForceBaffleVelocityFvPatchVectorField
107 :
108  public fixedValueFvPatchVectorField
109 {
110  // Private Data
111 
112  //- Name of the pressure field used to calculate the force
113  // on the active baffle
114  word pName_;
115 
116  //- Name of the cyclic patch used when the active baffle is open
117  word cyclicPatchName_;
118 
119  //- Index of the cyclic patch used when the active baffle is open
120  label cyclicPatchLabel_;
121 
122  //- Orientation (1 or -1) of the active baffle mode
123  // Used to change the direction of opening or closing the baffle
124  label orientation_;
125 
126  //- Initial wall patch areas
127  vectorField initWallSf_;
128 
129  //- Initial cyclic patch areas
130  vectorField initCyclicSf_;
131 
132  //- Initial neighbour-side cyclic patch areas
133  vectorField nbrCyclicSf_;
134 
135  //- Current fraction of the active baffle which is open
136  scalar openFraction_;
137 
138  //- Time taken for the active baffle to open
139  scalar openingTime_;
140 
141  //- Maximum fractional change to the active baffle openness
142  // per time-step
143  scalar maxOpenFractionDelta_;
144 
145  label curTimeIndex_;
146 
147  //- Minimum value for the active baffle to start opening
148  scalar minThresholdValue_;
149 
150  //- Force based active baffle
151  bool fBased_;
152 
153  //- Baffle is activated
154  bool baffleActivated_;
155 
156 
157 public:
158 
159  //- Runtime type information
160  TypeName("activePressureForceBaffleVelocity");
161 
162 
163  // Constructors
164 
165  //- Construct from patch, internal field and dictionary
167  (
168  const fvPatch&,
169  const DimensionedField<vector, volMesh>&,
170  const dictionary&
171  );
172 
173  //- Construct by mapping given
174  // activePressureForceBaffleVelocityFvPatchVectorField
175  // onto a new patch
177  (
179  const fvPatch&,
181  const fieldMapper&
182  );
183 
184  //- Disallow copy without setting internal field reference
186  (
188  ) = delete;
189 
190  //- Copy constructor setting internal field reference
192  (
195  );
196 
197  //- Construct and return a clone setting internal field reference
199  (
201  ) const
202  {
204  (
206  (
207  *this,
208  iF
209  )
210  );
211  }
212 
213 
214  // Member Functions
215 
216  // Mapping functions
217 
218  //- Map the given fvPatchField onto this fvPatchField
219  virtual void map(const fvPatchVectorField&, const fieldMapper&);
220 
221  //- Reset the fvPatchField to the given fvPatchField
222  // Used for mesh to mesh mapping
223  virtual void reset(const fvPatchVectorField&);
224 
225 
226  //- Update the coefficients associated with the patch field
227  virtual void updateCoeffs();
228 
229  //- Write
230  virtual void write(Ostream&) const;
231 };
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace Foam
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
This boundary condition is applied to the flow velocity, to simulate the opening or closure of a baff...
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
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.
TypeName("activePressureForceBaffleVelocity")
Runtime type information.
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.
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:91
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Field< vector > vectorField
Specialisation of Field<T> for vector.