All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2023 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. See PDRMesh
36  for more details.
37 
38  Once the threshold is crossed, this condition activated and continues to
39  open or close at a fixed rate using
40 
41  \f[
42  x = x_{old} + s \times \frac{dt}{DT}
43  \f]
44 
45  where
46 
47  \vartable
48  x | baffle open fraction [0-1]
49  x_{old} | baffle open fraction on previous evaluation
50  s | sign for orientation: 1 to open or -1 to close
51  dt | simulation time step
52  DT | time taken to open the baffle
53  \endvartable
54 
55  The open fraction is then applied to scale the patch areas.
56 
57 Usage
58  \table
59  Property | Description | Required | Default value
60  p | pressure field name | no | p
61  cyclicPatch | cyclic patch name | yes |
62  orientation | 1 to open or -1 to close | yes|
63  openFraction | current open fraction [0-1] | yes |
64  openingTime | time taken to open or close the baffle | yes |
65  maxOpenFractionDelta | max fraction change per timestep | yes |
66  minThresholdValue | minimum absolute pressure or
67  force difference for activation | yes |
68  forceBased | force (true) or pressure-based (false) activation | yes |
69  \endtable
70 
71  Example of the boundary condition specification:
72  \verbatim
73  <patchName>
74  {
75  type activePressureForceBaffleVelocity;
76  p p;
77  cyclicPatch cyclic1;
78  orientation 1;
79  openFraction 0.2;
80  openingTime 5.0;
81  maxOpenFractionDelta 0.1;
82  minThresholdValue 0.01;
83  forceBased false;
84  }
85  \endverbatim
86 
87 SourceFiles
88  activePressureForceBaffleVelocityFvPatchVectorField.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef activePressureForceBaffleVelocityFvPatchVectorField_H
93 #define activePressureForceBaffleVelocityFvPatchVectorField_H
94 
95 #include "fvPatchFields.H"
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 namespace Foam
101 {
102 
103 /*---------------------------------------------------------------------------*\
104  Class activePressureForceBaffleVelocityFvPatchVectorField Declaration
105 \*---------------------------------------------------------------------------*/
106 
107 class activePressureForceBaffleVelocityFvPatchVectorField
108 :
109  public fixedValueFvPatchVectorField
110 {
111  // Private Data
112 
113  //- Name of the pressure field used to calculate the force
114  // on the active baffle
115  word pName_;
116 
117  //- Name of the cyclic patch used when the active baffle is open
118  word cyclicPatchName_;
119 
120  //- Index of the cyclic patch used when the active baffle is open
121  label cyclicPatchLabel_;
122 
123  //- Orientation (1 or -1) of the active baffle mode
124  // Used to change the direction of opening or closing the baffle
125  label orientation_;
126 
127  //- Initial wall patch areas
128  vectorField initWallSf_;
129 
130  //- Initial cyclic patch areas
131  vectorField initCyclicSf_;
132 
133  //- Initial neighbour-side cyclic patch areas
134  vectorField nbrCyclicSf_;
135 
136  //- Current fraction of the active baffle which is open
137  scalar openFraction_;
138 
139  //- Time taken for the active baffle to open
140  scalar openingTime_;
141 
142  //- Maximum fractional change to the active baffle openness
143  // per time-step
144  scalar maxOpenFractionDelta_;
145 
146  label curTimeIndex_;
147 
148  //- Minimum value for the active baffle to start opening
149  scalar minThresholdValue_;
150 
151  //- Force based active baffle
152  bool fBased_;
153 
154  //- Baffle is activated
155  bool baffleActivated_;
156 
157 
158 public:
159 
160  //- Runtime type information
161  TypeName("activePressureForceBaffleVelocity");
162 
163 
164  // Constructors
165 
166  //- Construct from patch, internal field and dictionary
168  (
169  const fvPatch&,
170  const DimensionedField<vector, volMesh>&,
171  const dictionary&
172  );
173 
174  //- Construct by mapping given
175  // activePressureForceBaffleVelocityFvPatchVectorField
176  // onto a new patch
178  (
180  const fvPatch&,
182  const fieldMapper&
183  );
184 
185  //- Disallow copy without setting internal field reference
187  (
189  ) = delete;
190 
191  //- Copy constructor setting internal field reference
193  (
196  );
197 
198  //- Construct and return a clone setting internal field reference
200  (
202  ) const
203  {
205  (
207  (
208  *this,
209  iF
210  )
211  );
212  }
213 
214 
215  // Member Functions
216 
217  // Mapping functions
218 
219  //- Map the given fvPatchField onto this fvPatchField
220  virtual void map(const fvPatchVectorField&, const fieldMapper&);
221 
222  //- Reset the fvPatchField to the given fvPatchField
223  // Used for mesh to mesh mapping
224  virtual void reset(const fvPatchVectorField&);
225 
226 
227  //- Update the coefficients associated with the patch field
228  virtual void updateCoeffs();
229 
230  //- Write
231  virtual void write(Ostream&) const;
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
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:88
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.