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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::activeBaffleVelocityFvPatchVectorField
28 
29 Group
30  grpCoupledBoundaryConditions
31 
32 Description
33  This velocity boundary condition simulates the opening of a baffle due
34  to local flow conditions, by merging the behaviours of wall and cyclic
35  conditions. The baffle joins two mesh regions, where the open fraction
36  determines the interpolation weights applied to each cyclic- and
37  neighbour-patch contribution.
38 
39  We determine whether the baffle is opening or closing from the sign of
40  the net force across the baffle, from which the baffle open fraction is
41  updated using:
42 
43  \f[
44  x = x_{old} + sign(F_{net})\frac{dt}{DT}
45  \f]
46 
47  where
48 
49  \vartable
50  x | baffle open fraction [0-1]
51  x_{old} | baffle open fraction on previous evaluation
52  dt | simulation time step
53  DT | time taken to open the baffle
54  F_{net} | net force across the baffle
55  \endvartable
56 
57  The open fraction is then applied to scale the patch areas.
58 
59 Usage
60  \table
61  Property | Description | Required | Default value
62  p | pressure field name | no | p
63  cyclicPatch | cylclic patch name | yes |
64  orientation | 1 or -1 used to switch flow direction | yes|
65  openFraction | current opatch open fraction [0-1]| yes |
66  openingTime | time taken to open the baffle | yes |
67  maxOpenFractionDelta | max open fraction change per timestep | yes |
68  \endtable
69 
70  Example of the boundary condition specification:
71  \verbatim
72  <patchName>
73  {
74  type activeBaffleVelocity;
75  p p;
76  cyclicPatch cyclic1;
77  orientation 1;
78  openFraction 0.2;
79  openingTime 5.0;
80  maxOpenFractionDelta 0.1;
81  }
82  \endverbatim
83 
84 See also
85  Foam::fixedValueFvPatchField
86  Foam::cyclicFvPatchField
87 
88 SourceFiles
89  activeBaffleVelocityFvPatchVectorField.C
90 
91 \*---------------------------------------------------------------------------*/
92 
93 #ifndef activeBaffleVelocityFvPatchVectorField_H
94 #define activeBaffleVelocityFvPatchVectorField_H
95 
96 #include "fvPatchFields.H"
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 namespace Foam
102 {
103 
104 /*---------------------------------------------------------------------------*\
105  Class activeBaffleVelocityFvPatchVectorField Declaration
106 \*---------------------------------------------------------------------------*/
107 
108 class activeBaffleVelocityFvPatchVectorField
109 :
110  public fixedValueFvPatchVectorField
111 {
112  // Private data
113 
114  //- Name of the pressure field used to calculate the force
115  // on the active baffle
116  word pName_;
117 
118  //- Name of the cyclic patch used when the active baffle is open
119  word cyclicPatchName_;
120 
121  //- Index of the cyclic patch used when the active baffle is open
122  label cyclicPatchLabel_;
123 
124  //- Orientation (1 or -1) of the active baffle patch.
125  // Used to change the direction of opening without the need for
126  // reordering the patch faces
127  label orientation_;
128 
129  //- Initial wall patch areas
130  vectorField initWallSf_;
131 
132  //- Initial this-side cyclic patch areas
133  vectorField initCyclicSf_;
134 
135  //- Initial neighbour-side cyclic patch areas
136  vectorField nbrCyclicSf_;
137 
138  //- Current fraction of the active baffle which is open
139  scalar openFraction_;
140 
141  //- Time taken for the active baffle to open
142  scalar openingTime_;
143 
144  //- Maximum fractional change to the active baffle openness
145  // per time-step
146  scalar maxOpenFractionDelta_;
147 
148  label curTimeIndex_;
149 
150 
151 public:
152 
153  //- Runtime type information
154  TypeName("activeBaffleVelocity");
155 
156 
157  // Constructors
158 
159  //- Construct from patch and internal field
161  (
162  const fvPatch&,
164  );
165 
166  //- Construct from patch, internal field and dictionary
168  (
169  const fvPatch&,
171  const dictionary&
172  );
173 
174  //- Construct by mapping given activeBaffleVelocityFvPatchVectorField
175  // onto a new patch
177  (
179  const fvPatch&,
181  const fvPatchFieldMapper&
182  );
183 
184  //- Construct as copy
186  (
188  );
189 
190  //- Construct and return a clone
191  virtual tmp<fvPatchVectorField> clone() const
192  {
194  (
196  );
197  }
198 
199  //- Construct as copy setting internal field reference
201  (
204  );
205 
206  //- Construct and return a clone setting internal field reference
208  (
210  ) const
211  {
213  (
215  );
216  }
217 
218 
219  // Member functions
220 
221  // Mapping functions
222 
223  //- Map (and resize as needed) from self given a mapping object
224  virtual void autoMap(const fvPatchFieldMapper&);
225 
226  //- Reverse map the given fvPatchField onto this fvPatchField
227  virtual void rmap(const fvPatchVectorField&, const labelList&);
228 
229 
230  //- Update the coefficients associated with the patch field
231  virtual void updateCoeffs();
232 
233  //- Write
234  virtual void write(Ostream&) const;
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
Foam::fvPatchField< vector >
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::activeBaffleVelocityFvPatchVectorField::TypeName
TypeName("activeBaffleVelocity")
Runtime type information.
Foam::activeBaffleVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: activeBaffleVelocityFvPatchVectorField.H:245
Foam::activeBaffleVelocityFvPatchVectorField::rmap
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: activeBaffleVelocityFvPatchVectorField.C:190
Foam::activeBaffleVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: activeBaffleVelocityFvPatchVectorField.C:296
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::Field< vector >
Foam::activeBaffleVelocityFvPatchVectorField::activeBaffleVelocityFvPatchVectorField
activeBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: activeBaffleVelocityFvPatchVectorField.C:39
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::activeBaffleVelocityFvPatchVectorField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: activeBaffleVelocityFvPatchVectorField.C:161
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: activeBaffleVelocityFvPatchVectorField.C:214
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::activeBaffleVelocityFvPatchVectorField
This velocity boundary condition simulates the opening of a baffle due to local flow conditions,...
Definition: activeBaffleVelocityFvPatchVectorField.H:162
Foam::fvPatchVectorField
fvPatchField< vector > fvPatchVectorField
Definition: fvPatchFieldsFwd.H:43
fvPatchFields.H
Foam::List< label >
fixedValueFvPatchFields.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54