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 as copy setting internal field reference
164  (
167  );
168 
169  //- Return a clone
170  virtual tmp<fvPatchField<vector>> clone() const
171  {
172  return fvPatchField<vector>::Clone(*this);
173  }
174 
175  //- Clone with an internal field reference
177  (
179  ) const
180  {
181  return fvPatchField<vector>::Clone(*this, iF);
182  }
183 
184 
185  // Member Functions
186 
187  //- True: this patch field is altered by assignment.
188  virtual bool assignable() const { return true; }
189 
190 
191  // Access
192 
193  //- Return the name of phi
194  const word& phiName() const
195  {
196  return phiName_;
197  }
198 
199  //- Return reference to the name of phi to allow adjustment
200  word& phiName()
201  {
202  return phiName_;
203  }
204 
205  Switch fixTangentialInflow() const
206  {
207  return fixTangentialInflow_;
208  }
209 
210  //- Return the BC which provides the normal component of velocity
211  const fvPatchVectorField& normalVelocity() const
212  {
213  return normalVelocity_();
214  }
216 
217  // Mapping functions
218 
219  //- Map (and resize as needed) from self given a mapping object
220  virtual void autoMap
221  (
222  const fvPatchFieldMapper&
223  );
224 
225  //- Reverse map the given fvPatchField onto this fvPatchField
226  virtual void rmap
227  (
229  const labelList&
230  );
231 
232 
233  //- Update the coefficients associated with the patch field
234  virtual void updateCoeffs();
235 
236  //- Write
237  virtual void write(Ostream&) const;
238 
239 
240  // Member operators
241 
242  virtual void operator=(const fvPatchField<vector>& pvf);
243 };
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace Foam
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
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.
virtual tmp< fvPatchField< vector > > clone() const
Return a clone.
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.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
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...
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.