activeBaffleVelocityFvPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 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 Group
28  grpCoupledBoundaryConditions
29 
30 Description
31  This velocity boundary condition simulates the opening of a baffle due
32  to local flow conditions, by merging the behaviours of wall and cyclic
33  conditions. The baffle joins two mesh regions, where the open fraction
34  determines the interpolation weights applied to each cyclic- and
35  neighbour-patch contribution.
36 
37  We determine whether the baffle is opening or closing from the sign of
38  the net force across the baffle, from which the baffle open fraction is
39  updated using:
40 
41  \f[
42  x = x_{old} + sign(F_{net})\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  dt | simulation time step
51  DT | time taken to open the baffle
52  F_{net} | net force across 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 | cylclic patch name | yes |
62  orientation | 1 or -1 used to switch flow direction | yes|
63  openFraction | current opatch open fraction [0-1]| yes |
64  openingTime | time taken to open the baffle | yes |
65  maxOpenFractionDelta | max open fraction change per timestep | yes |
66  \endtable
67 
68  Example of the boundary condition specification:
69  \verbatim
70  <patchName>
71  {
72  type activeBaffleVelocity;
73  p p;
74  cyclicPatch cyclic1;
75  orientation 1;
76  openFraction 0.2;
77  openingTime 5.0;
78  maxOpenFractionDelta 0.1;
79  }
80  \endverbatim
81 
82 See also
83  Foam::fixedValueFvPatchField
84  Foam::cyclicFvPatchField
85 
86 SourceFiles
87  activeBaffleVelocityFvPatchVectorField.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef activeBaffleVelocityFvPatchVectorField_H
92 #define activeBaffleVelocityFvPatchVectorField_H
93 
94 #include "fvPatchFields.H"
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 namespace Foam
100 {
101 
102 /*---------------------------------------------------------------------------*\
103  Class activeBaffleVelocityFvPatchVectorField Declaration
104 \*---------------------------------------------------------------------------*/
105 
106 class activeBaffleVelocityFvPatchVectorField
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 patch.
123  // Used to change the direction of opening without the need for
124  // reordering the patch faces
125  label orientation_;
126 
127  //- Initial wall patch areas
128  vectorField initWallSf_;
129 
130  //- Initial this-side 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 
149 public:
150 
151  //- Runtime type information
152  TypeName("activeBaffleVelocity");
153 
154 
155  // Constructors
156 
157  //- Construct from patch and internal field
159  (
160  const fvPatch&,
162  );
163 
164  //- Construct from patch, internal field and dictionary
166  (
167  const fvPatch&,
169  const dictionary&
170  );
171 
172  //- Construct by mapping given activeBaffleVelocityFvPatchVectorField
173  // onto a new patch
175  (
177  const fvPatch&,
179  const fvPatchFieldMapper&
180  );
181 
182  //- Construct as copy
184  (
186  );
187 
188  //- Construct and return a clone
189  virtual tmp<fvPatchVectorField> clone() const
190  {
192  (
194  );
195  }
196 
197  //- Construct as copy setting internal field reference
199  (
202  );
203 
204  //- Construct and return a clone setting internal field reference
206  (
208  ) const
209  {
211  (
213  );
214  }
215 
216 
217  // Member functions
218 
219  // Mapping functions
220 
221  //- Map (and resize as needed) from self given a mapping object
222  virtual void autoMap(const fvPatchFieldMapper&);
223 
224  //- Reverse map the given fvPatchField onto this fvPatchField
225  virtual void rmap(const fvPatchVectorField&, const labelList&);
226 
227 
228  //- Update the coefficients associated with the patch field
229  virtual void updateCoeffs();
230 
231  //- Write
232  virtual void write(Ostream&) const;
233 };
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 } // End namespace Foam
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #endif
244 // ************************************************************************* //
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:137
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
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:65
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:53
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:54
This velocity boundary condition simulates the opening of a baffle due to local flow conditions...
Namespace for OpenFOAM.