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  //- True: this patch field is altered by assignment.
194  virtual bool assignable() const { return true; }
195 
196 
197  // Access
198 
199  //- Return the name of phi
200  const word& phiName() const
201  {
202  return phiName_;
203  }
204 
205  //- Return reference to the name of phi to allow adjustment
206  word& phiName()
207  {
208  return phiName_;
209  }
210 
211  Switch fixTangentialInflow() const
212  {
213  return fixTangentialInflow_;
214  }
215 
216  //- Return the BC which provides the normal component of velocity
217  const fvPatchVectorField& normalVelocity() const
218  {
219  return normalVelocity_();
220  }
221 
222 
223  // Mapping functions
224 
225  //- Map (and resize as needed) from self given a mapping object
226  virtual void autoMap
227  (
228  const fvPatchFieldMapper&
229  );
230 
231  //- Reverse map the given fvPatchField onto this fvPatchField
232  virtual void rmap
233  (
235  const labelList&
236  );
237 
238 
239  //- Update the coefficients associated with the patch field
240  virtual void updateCoeffs();
241 
242  //- Write
243  virtual void write(Ostream&) const;
244 
245 
246  // Member operators
247 
248  virtual void operator=(const fvPatchField<vector>& pvf);
249 };
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 } // End namespace Foam
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #endif
259 
260 // ************************************************************************* //
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.
fvPatchField< vector > fvPatchVectorField
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:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
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:56
virtual bool assignable() const
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.