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-2012 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  \heading Patch usage
58 
59  \table
60  Property | Description | Required | Default value
61  p | pressure field name | no | p
62  cyclicPatch | cylclic patch name | yes |
63  orientation | 1 or -1 used to switch flow direction | yes|
64  openFraction | current opatch open fraction [0-1]| yes |
65  openingTime | time taken to open the baffle | yes |
66  maxOpenFractionDelta | max open fraction change per timestep | yes |
67  \endtable
68 
69  Example of the boundary condition specification:
70  \verbatim
71  myPatch
72  {
73  type activeBaffleVelocity;
74  p p;
75  cyclicPatch cyclic1;
76  orientation 1;
77  openFraction 0.2;
78  openingTime 5.0;
79  maxOpenFractionDelta 0.1;
80  }
81  \endverbatim
82 
83 SeeAlso
84  Foam::fixedValueFvPatchField
85  Foam::cyclicFvPatchField
86 
87 SourceFiles
88  activeBaffleVelocityFvPatchVectorField.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef activeBaffleVelocityFvPatchVectorField_H
93 #define activeBaffleVelocityFvPatchVectorField_H
94 
95 #include "fvPatchFields.H"
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 namespace Foam
101 {
102 
103 /*---------------------------------------------------------------------------*\
104  Class activeBaffleVelocityFvPatchVectorField Declaration
105 \*---------------------------------------------------------------------------*/
106 
107 class activeBaffleVelocityFvPatchVectorField
108 :
109  public fixedValueFvPatchVectorField
110 {
111  // Private data
112 
113  //- Name of the pressure field used to calculate the force
114  // on the active baffle
115  word pName_;
116 
117  //- Name of the cyclic patch used when the active baffle is open
118  word cyclicPatchName_;
119 
120  //- Index of the cyclic patch used when the active baffle is open
122 
123  //- Orientation (1 or -1) of the active baffle patch.
124  // Used to change the direction of opening without the need for
125  // reordering the patch faces
127 
128  //- Initial wall patch areas
130 
131  //- Initial this-side cyclic patch areas
133 
134  //- Initial neighbour-side cyclic patch areas
136 
137  //- Current fraction of the active baffle which is open
138  scalar openFraction_;
139 
140  //- Time taken for the active baffle to open
141  scalar openingTime_;
142 
143  //- Maximum fractional change to the active baffle openness
144  // per time-step
145  scalar maxOpenFractionDelta_;
146 
148 
149 
150 public:
151 
152  //- Runtime type information
153  TypeName("activeBaffleVelocity");
154 
155 
156  // Constructors
157 
158  //- Construct from patch and internal field
160  (
161  const fvPatch&,
163  );
164 
165  //- Construct from patch, internal field and dictionary
167  (
168  const fvPatch&,
170  const dictionary&
171  );
172 
173  //- Construct by mapping given activeBaffleVelocityFvPatchVectorField
174  // onto a new patch
176  (
178  const fvPatch&,
181  );
182 
183  //- Construct as copy
185  (
187  );
188 
189  //- Construct and return a clone
190  virtual tmp<fvPatchVectorField> clone() const
191  {
193  (
195  );
196  }
197 
198  //- Construct as copy setting internal field reference
200  (
203  );
204 
205  //- Construct and return a clone setting internal field reference
207  (
209  ) const
210  {
212  (
214  );
215  }
216 
217 
218  // Member functions
219 
220  // Mapping functions
221 
222  //- Map (and resize as needed) from self given a mapping object
223  virtual void autoMap(const fvPatchFieldMapper&);
224 
225  //- Reverse map the given fvPatchField onto this fvPatchField
226  virtual void rmap(const fvPatchVectorField&, const labelList&);
227 
228 
229  //- Update the coefficients associated with the patch field
230  virtual void updateCoeffs();
231 
232  //- Write
233  virtual void write(Ostream&) const;
234 };
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Foam::activeBaffleVelocityFvPatchVectorField::maxOpenFractionDelta_
scalar maxOpenFractionDelta_
Maximum fractional change to the active baffle openness.
Definition: activeBaffleVelocityFvPatchVectorField.H:199
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::activeBaffleVelocityFvPatchVectorField::TypeName
TypeName("activeBaffleVelocity")
Runtime type information.
Foam::activeBaffleVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: activeBaffleVelocityFvPatchVectorField.H:244
Foam::activeBaffleVelocityFvPatchVectorField::rmap
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: activeBaffleVelocityFvPatchVectorField.C:186
Foam::activeBaffleVelocityFvPatchVectorField::openFraction_
scalar openFraction_
Current fraction of the active baffle which is open.
Definition: activeBaffleVelocityFvPatchVectorField.H:192
Foam::activeBaffleVelocityFvPatchVectorField::initCyclicSf_
vectorField initCyclicSf_
Initial this-side cyclic patch areas.
Definition: activeBaffleVelocityFvPatchVectorField.H:186
Foam::activeBaffleVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: activeBaffleVelocityFvPatchVectorField.C:292
Foam::activeBaffleVelocityFvPatchVectorField::orientation_
label orientation_
Orientation (1 or -1) of the active baffle patch.
Definition: activeBaffleVelocityFvPatchVectorField.H:180
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:49
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::activeBaffleVelocityFvPatchVectorField::initWallSf_
vectorField initWallSf_
Initial wall patch areas.
Definition: activeBaffleVelocityFvPatchVectorField.H:183
Foam::activeBaffleVelocityFvPatchVectorField::activeBaffleVelocityFvPatchVectorField
activeBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: activeBaffleVelocityFvPatchVectorField.C:36
Foam::activeBaffleVelocityFvPatchVectorField::cyclicPatchName_
word cyclicPatchName_
Name of the cyclic patch used when the active baffle is open.
Definition: activeBaffleVelocityFvPatchVectorField.H:172
Foam::activeBaffleVelocityFvPatchVectorField::openingTime_
scalar openingTime_
Time taken for the active baffle to open.
Definition: activeBaffleVelocityFvPatchVectorField.H:195
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::activeBaffleVelocityFvPatchVectorField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: activeBaffleVelocityFvPatchVectorField.C:157
Foam::activeBaffleVelocityFvPatchVectorField::curTimeIndex_
label curTimeIndex_
Definition: activeBaffleVelocityFvPatchVectorField.H:201
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: activeBaffleVelocityFvPatchVectorField.C:210
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::activeBaffleVelocityFvPatchVectorField::nbrCyclicSf_
vectorField nbrCyclicSf_
Initial neighbour-side cyclic patch areas.
Definition: activeBaffleVelocityFvPatchVectorField.H:189
Foam::activeBaffleVelocityFvPatchVectorField
This velocity boundary condition simulates the opening of a baffle due to local flow conditions,...
Definition: activeBaffleVelocityFvPatchVectorField.H:161
fvPatchFields.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
fixedValueFvPatchFields.H
Foam::activeBaffleVelocityFvPatchVectorField::cyclicPatchLabel_
label cyclicPatchLabel_
Index of the cyclic patch used when the active baffle is open.
Definition: activeBaffleVelocityFvPatchVectorField.H:175
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::activeBaffleVelocityFvPatchVectorField::pName_
word pName_
Name of the pressure field used to calculate the force.
Definition: activeBaffleVelocityFvPatchVectorField.H:169
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51