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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2014-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::fixedNormalInletOutletVelocityFvPatchVectorField
28 
29 Group
30  grpInletBoundaryConditions grpOutletBoundaryConditions
31 
32 Description
33  This velocity inlet/outlet boundary condition combines a fixed normal
34  component obtained from the "normalVelocity" patchField supplied with a
35  fixed or zero-gradiented tangential component.
36 
37  The tangential component is set depending on the direction
38  of the flow and the setting of "fixTangentialInflow":
39  - Outflow: apply zero-gradient condition to tangential components
40  - Inflow:
41  - fixTangentialInflow is true
42  apply value provided by the normalVelocity patchField to the
43  tangential components
44  - fixTangentialInflow is false
45  apply zero-gradient condition to tangential components.
46 
47 Usage
48  \table
49  Property | Description | Required | Default value
50  phi | flux field name | no | phi
51  fixTangentialInflow | If true fix the tangential component for inflow | yes |
52  normalVelocity | patchField providing the normal velocity field | yes |
53  \endtable
54 
55  Example of the boundary condition specification:
56  \verbatim
57  <patchName>
58  {
59  type fixedNormalInletOutletVelocity;
60 
61  fixTangentialInflow false;
62  normalVelocity
63  {
64  type uniformFixedValue;
65  uniformValue sine;
66  uniformValueCoeffs
67  {
68  frequency 1;
69  amplitude table
70  (
71  (0 0)
72  (2 0.088)
73  (8 0.088)
74  );
75  scale (0 1 0);
76  level (0 0 0);
77  }
78  }
79 
80  value uniform (0 0 0);
81  }
82  \endverbatim
83 
84 SourceFiles
85  fixedNormalInletOutletVelocityFvPatchVectorField.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef fixedNormalInletOutletVelocityFvPatchVectorField_H
90 #define fixedNormalInletOutletVelocityFvPatchVectorField_H
91 
92 #include "fvPatchFields.H"
94 #include "Switch.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class fixedNormalInletOutletVelocityFvPatchVectorField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class fixedNormalInletOutletVelocityFvPatchVectorField
106 :
107  public directionMixedFvPatchVectorField
108 {
109 protected:
110 
111  // Protected data
112 
113  //- Flux field name
114  word phiName_;
115 
116  //- Set true to fix the tangential component for inflow
117  Switch fixTangentialInflow_;
118 
119  //- BC which provided the normal component of the velocity
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("fixedNormalInletOutletVelocity");
127 
128 
129  // Constructors
130 
131  //- Construct from patch and internal field
133  (
134  const fvPatch&,
136  );
137 
138  //- Construct from patch, internal field and dictionary
140  (
141  const fvPatch&,
143  const dictionary&
144  );
145 
146  //- Construct by mapping given
147  // fixedNormalInletOutletVelocityFvPatchVectorField onto a new patch
149  (
151  const fvPatch&,
153  const fvPatchFieldMapper&
154  );
155 
156  //- Construct as copy
158  (
160  );
161 
162  //- Construct and return a clone
163  virtual tmp<fvPatchVectorField> clone() const
164  {
166  (
168  );
169  }
170 
171  //- Construct as copy setting internal field reference
173  (
176  );
177 
178  //- Construct and return a clone setting internal field reference
180  (
182  ) const
183  {
185  (
187  );
188  }
189 
190 
191  // Member functions
192 
193  // Attributes
194 
195  //- Return true: this patch field is altered by assignment
196  virtual bool assignable() const
197  {
198  return true;
199  }
200 
201 
202  // Access
203 
204  //- Return the name of phi
205  const word& phiName() const
206  {
207  return phiName_;
208  }
209 
210  //- Return reference to the name of phi to allow adjustment
211  word& phiName()
212  {
213  return phiName_;
214  }
215 
216  Switch fixTangentialInflow() const
217  {
219  }
220 
221  //- Return the BC which provides the normal component of velocity
222  const fvPatchVectorField& normalVelocity() const
223  {
224  return normalVelocity_();
225  }
226 
227 
228  // Mapping functions
229 
230  //- Map (and resize as needed) from self given a mapping object
231  virtual void autoMap
232  (
233  const fvPatchFieldMapper&
234  );
235 
236  //- Reverse map the given fvPatchField onto this fvPatchField
237  virtual void rmap
238  (
239  const fvPatchVectorField&,
240  const labelList&
241  );
242 
243 
244  //- Update the coefficients associated with the patch field
245  virtual void updateCoeffs();
246 
247  //- Write
248  virtual void write(Ostream&) const;
249 
250 
251  // Member operators
252 
253  virtual void operator=(const fvPatchField<vector>& pvf);
254 };
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 } // End namespace Foam
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #endif
264 
265 // ************************************************************************* //
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Switch fixTangentialInflow_
Set true to fix the tangential component for inflow.
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...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:68
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
TypeName("fixedNormalInletOutletVelocity")
Runtime type information.
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
A class for handling words, derived from Foam::string.
Definition: word.H:63
fixedNormalInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
virtual bool assignable() const
Return true: this patch field is altered by assignment.
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...
Definition: areaFieldsFwd.H:42
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
tmp< fvPatchVectorField > normalVelocity_
BC which provided the normal component of the velocity.