activeBaffleVelocityFvPatchVectorField.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::activeBaffleVelocityFvPatchVectorField
26 
27 Description
28  This velocity boundary condition simulates the opening of a baffle due
29  to local flow conditions, by merging the behaviours of wall and cyclic
30  conditions. The baffle joins two mesh regions, where the open fraction
31  determines the interpolation weights applied to each cyclic- and
32  neighbour-patch contribution.
33 
34  We determine whether the baffle is opening or closing from the sign of
35  the net force across the baffle, from which the baffle open fraction is
36  updated using:
37 
38  \f[
39  x = x_{old} + sign(F_{net})\frac{dt}{DT}
40  \f]
41 
42  where
43 
44  \vartable
45  x | baffle open fraction [0-1]
46  x_{old} | baffle open fraction on previous evaluation
47  dt | simulation time step
48  DT | time taken to open the baffle
49  F_{net} | net force across the baffle
50  \endvartable
51 
52  The open fraction is then applied to scale the patch areas.
53 
54 Usage
55  \table
56  Property | Description | Required | Default value
57  p | pressure field name | no | p
58  cyclicPatch | cyclic patch name | yes |
59  orientation | 1 or -1 used to switch flow direction | yes|
60  openFraction | current patch open fraction [0-1]| yes |
61  openingTime | time taken to open the baffle | yes |
62  maxOpenFractionDelta | max open fraction change per timestep | yes |
63  \endtable
64 
65  Example of the boundary condition specification:
66  \verbatim
67  <patchName>
68  {
69  type activeBaffleVelocity;
70  p p;
71  cyclicPatch cyclic1;
72  orientation 1;
73  openFraction 0.2;
74  openingTime 5.0;
75  maxOpenFractionDelta 0.1;
76  }
77  \endverbatim
78 
79 See also
80  Foam::fixedValueFvPatchField
81  Foam::cyclicFvPatchField
82 
83 SourceFiles
84  activeBaffleVelocityFvPatchVectorField.C
85 
86 \*---------------------------------------------------------------------------*/
87 
88 #ifndef activeBaffleVelocityFvPatchVectorField_H
89 #define activeBaffleVelocityFvPatchVectorField_H
90 
91 #include "fvPatchFields.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class activeBaffleVelocityFvPatchVectorField Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class activeBaffleVelocityFvPatchVectorField
104 :
105  public fixedValueFvPatchVectorField
106 {
107  // Private Data
108 
109  //- Name of the pressure field used to calculate the force
110  // on the active baffle
111  word pName_;
112 
113  //- Name of the cyclic patch used when the active baffle is open
114  word cyclicPatchName_;
115 
116  //- Index of the cyclic patch used when the active baffle is open
117  label cyclicPatchLabel_;
118 
119  //- Orientation (1 or -1) of the active baffle patch.
120  // Used to change the direction of opening without the need for
121  // reordering the patch faces
122  label orientation_;
123 
124  //- Initial wall patch areas
125  vectorField initWallSf_;
126 
127  //- Initial this-side cyclic patch areas
128  vectorField initCyclicSf_;
129 
130  //- Initial neighbour-side cyclic patch areas
131  vectorField nbrCyclicSf_;
132 
133  //- Current fraction of the active baffle which is open
134  scalar openFraction_;
135 
136  //- Time taken for the active baffle to open
137  scalar openingTime_;
138 
139  //- Maximum fractional change to the active baffle openness
140  // per time-step
141  scalar maxOpenFractionDelta_;
142 
143  label curTimeIndex_;
144 
145 
146 public:
147 
148  //- Runtime type information
149  TypeName("activeBaffleVelocity");
150 
151 
152  // Constructors
153 
154  //- Construct from patch, internal field and dictionary
156  (
157  const fvPatch&,
159  const dictionary&
160  );
161 
162  //- Construct by mapping given activeBaffleVelocityFvPatchVectorField
163  // onto a new patch
165  (
167  const fvPatch&,
169  const fvPatchFieldMapper&
170  );
171 
172  //- Disallow copy without setting internal field reference
174  (
176  ) = delete;
177 
178  //- Copy constructor setting internal field reference
180  (
183  );
184 
185  //- Construct and return a clone setting internal field reference
187  (
189  ) const
190  {
192  (
194  );
195  }
196 
197 
198  // Member Functions
199 
200  // Mapping functions
201 
202  //- Map the given fvPatchField onto this fvPatchField
203  virtual void map
204  (
205  const fvPatchVectorField&,
206  const fvPatchFieldMapper&
207  );
208 
209  //- Reset the fvPatchField to the given fvPatchField
210  // Used for mesh to mesh mapping
211  virtual void reset(const fvPatchVectorField&);
212 
213 
214  //- Update the coefficients associated with the patch field
215  virtual void updateCoeffs();
216 
217  //- Write
218  virtual void write(Ostream&) const;
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
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 velocity boundary condition simulates the opening of a baffle due to local flow conditions,...
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
TypeName("activeBaffleVelocity")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
activeBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void map(const fvPatchVectorField &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
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.