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
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 as copy setting internal field reference
192  (
195  );
196 
197  //- Return a clone
198  virtual tmp<fvPatchField<vector>> clone() const
199  {
200  return fvPatchField<vector>::Clone(*this);
201  }
202 
203  //- Clone with an internal field reference
205  (
207  ) const
208  {
209  return fvPatchField<vector>::Clone(*this, iF);
210  }
211 
212 
213  // Member functions
214 
215  // Mapping functions
216 
217  //- Map (and resize as needed) from self given a mapping object
218  virtual void autoMap(const fvPatchFieldMapper&);
219 
220  //- Reverse map the given fvPatchField onto this fvPatchField
221  virtual void rmap(const fvPatchVectorField&, const labelList&);
222 
223 
224  //- Update the coefficients associated with the patch field
225  virtual void updateCoeffs();
226 
227  //- Write
228  virtual void write(Ostream&) const;
229 };
230 
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
virtual tmp< fvPatchField< vector > > clone() const
Return a clone.
fvPatchField< vector > fvPatchVectorField
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
TypeName("activeBaffleVelocity")
Runtime type information.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:607
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.
A FieldMapper for finite-volume patch fields.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
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.
List< label > labelList
A List of labels.
Definition: List.H:61
A class for managing temporary objects.
Definition: HashPtrTable.H:50
This velocity boundary condition simulates the opening of a baffle due to local flow conditions...
Namespace for OpenFOAM.