fixedNormalInletOutletVelocityFvPatchVectorField.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) 2014 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::fixedNormalInletOutletVelocityFvPatchVectorField
26 
27 Group
28  grpInletletBoundaryConditions grpOutletBoundaryConditions
29 
30 Description
31 
32  This velocity inlet/outlet boundary condition combines a fixed normal
33  component obtained from the "normalVelocity" patchField supplied with a
34  fixed or zero-gradiented tangential component depending on the direction
35  of the flow and the setting of "fixTangentialInflow":
36  - Outflow: apply zero-gradient condition to tangential components
37  - Inflow:
38  - fixTangentialInflow is true
39  apply value provided by the normalVelocity patchField to the
40  tangential components
41  - fixTangentialInflow is false
42  apply zero-gradient condition to tangential components.
43 
44  \heading Patch usage
45 
46  \table
47  Property | Description | Required | Default value
48  phi | flux field name | no | phi
49  fixTangentialInflow | If true fix the tangential component for inflow | yes |
50  normalVelocity | patchField providing the normal velocity field | yes |
51  \endtable
52 
53  Example of the boundary condition specification:
54  \verbatim
55  myPatch
56  {
57  type fixedNormalInletOutletVelocity;
58 
59  fixTangentialInflow false;
60  normalVelocity
61  {
62  type oscillatingFixedValue;
63  refValue uniform (0 1 0);
64  offset (0 -1 0);
65  amplitude table
66  (
67  ( 0 0)
68  ( 2 0.088)
69  ( 8 0.088)
70  );
71  frequency constant 1;
72  }
73 
74  value uniform (0 0 0);
75  }
76  \endverbatim
77 
78 SourceFiles
79  fixedNormalInletOutletVelocityFvPatchVectorField.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef fixedNormalInletOutletVelocityFvPatchVectorField_H
84 #define fixedNormalInletOutletVelocityFvPatchVectorField_H
85 
86 #include "fvPatchFields.H"
88 #include "Switch.H"
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 namespace Foam
93 {
94 
95 /*---------------------------------------------------------------------------*\
96  Class fixedNormalInletOutletVelocityFvPatchVectorField Declaration
97 \*---------------------------------------------------------------------------*/
98 
99 class fixedNormalInletOutletVelocityFvPatchVectorField
100 :
101  public directionMixedFvPatchVectorField
102 {
103  // Private data
104 
105  //- Flux field name
106  word phiName_;
107 
108  //- Set true to fix the tangential component for inflow
109  Switch fixTangentialInflow_;
110 
111  //- BC which provided the normal component of the velocity
112  tmp<fvPatchVectorField> normalVelocity_;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("fixedNormalInletOutletVelocity");
119 
120 
121  // Constructors
122 
123  //- Construct from patch and internal field
125  (
126  const fvPatch&,
128  );
129 
130  //- Construct from patch, internal field and dictionary
132  (
133  const fvPatch&,
135  const dictionary&
136  );
137 
138  //- Construct by mapping given
139  // fixedNormalInletOutletVelocityFvPatchVectorField onto a new patch
141  (
143  const fvPatch&,
145  const fvPatchFieldMapper&
146  );
147 
148  //- Construct as copy
150  (
152  );
153 
154  //- Construct and return a clone
155  virtual tmp<fvPatchVectorField> clone() const
156  {
158  (
160  );
161  }
162 
163  //- Construct as copy setting internal field reference
165  (
168  );
169 
170  //- Construct and return a clone setting internal field reference
172  (
174  ) const
175  {
177  (
179  );
180  }
181 
182 
183  // Member functions
184 
185  // Access
186 
187  //- Return the name of phi
188  const word& phiName() const
189  {
190  return phiName_;
191  }
192 
193  //- Return reference to the name of phi to allow adjustment
194  word& phiName()
195  {
196  return phiName_;
197  }
198 
200  {
201  return fixTangentialInflow_;
202  }
203 
204  //- Return the BC which provides the normal component of velocity
205  const fvPatchVectorField& normalVelocity() const
206  {
207  return normalVelocity_();
208  }
209 
210 
211  // Mapping functions
212 
213  //- Map (and resize as needed) from self given a mapping object
214  virtual void autoMap
215  (
216  const fvPatchFieldMapper&
217  );
219  //- Reverse map the given fvPatchField onto this fvPatchField
220  virtual void rmap
221  (
222  const fvPatchVectorField&,
223  const labelList&
224  );
225 
226 
227  //- Update the coefficients associated with the patch field
228  virtual void updateCoeffs();
229 
230  //- Write
231  virtual void write(Ostream&) const;
232 
233 
234  // Member operators
235 
236  virtual void operator=(const fvPatchField<vector>& pvf);
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #endif
247 
248 // ************************************************************************* //
fixedNormalInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const fvPatchVectorField & normalVelocity() const
Return the BC which provides the normal component of velocity.
This velocity inlet/outlet boundary condition combines a fixed normal component obtained from the "no...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
TypeName("fixedNormalInletOutletVelocity")
Runtime type information.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
A class for managing temporary objects.
Definition: PtrList.H:118