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-2020 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 opatch 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 and internal field
156  (
157  const fvPatch&,
159  );
160 
161  //- Construct from patch, internal field and dictionary
163  (
164  const fvPatch&,
166  const dictionary&
167  );
168 
169  //- Construct by mapping given activeBaffleVelocityFvPatchVectorField
170  // onto a new patch
172  (
174  const fvPatch&,
176  const fvPatchFieldMapper&
177  );
178 
179  //- Disallow copy without setting internal field reference
181  (
183  ) = delete;
184 
185  //- Copy constructor setting internal field reference
187  (
190  );
191 
192  //- Construct and return a clone setting internal field reference
194  (
196  ) const
197  {
199  (
201  );
202  }
203 
204 
205  // Member Functions
206 
207  // Mapping functions
208 
209  //- Map (and resize as needed) from self given a mapping object
210  virtual void autoMap(const fvPatchFieldMapper&);
211 
212  //- Reverse map the given fvPatchField onto this fvPatchField
213  virtual void rmap(const fvPatchVectorField&, const labelList&);
214 
215 
216  //- Update the coefficients associated with the patch field
217  virtual void updateCoeffs();
218 
219  //- Write
220  virtual void write(Ostream&) const;
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
TypeName("activeBaffleVelocity")
Runtime type information.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
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.
Foam::fvPatchFieldMapper.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
Definition: PtrList.H:53
This velocity boundary condition simulates the opening of a baffle due to local flow conditions...
Namespace for OpenFOAM.