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-2016 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 Usage
45  \table
46  Property | Description | Required | Default value
47  phi | flux field name | no | phi
48  fixTangentialInflow | If true fix the tangential component for inflow | yes |
49  normalVelocity | patchField providing the normal velocity field | yes |
50  \endtable
51 
52  Example of the boundary condition specification:
53  \verbatim
54  <patchName>
55  {
56  type fixedNormalInletOutletVelocity;
57 
58  fixTangentialInflow false;
59  normalVelocity
60  {
61  type uniformFixedValue;
62  uniformValue sine;
63  uniformValueCoeffs
64  {
65  frequency 1;
66  amplitude table
67  (
68  (0 0)
69  (2 0.088)
70  (8 0.088)
71  );
72  scale (0 1 0);
73  level (0 0 0);
74  }
75  }
76 
77  value uniform (0 0 0);
78  }
79  \endverbatim
80 
81 SourceFiles
82  fixedNormalInletOutletVelocityFvPatchVectorField.C
83 
84 \*---------------------------------------------------------------------------*/
85 
86 #ifndef fixedNormalInletOutletVelocityFvPatchVectorField_H
87 #define fixedNormalInletOutletVelocityFvPatchVectorField_H
88 
89 #include "fvPatchFields.H"
91 #include "Switch.H"
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class fixedNormalInletOutletVelocityFvPatchVectorField Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class fixedNormalInletOutletVelocityFvPatchVectorField
103 :
104  public directionMixedFvPatchVectorField
105 {
106  // Private data
107 
108  //- Flux field name
109  word phiName_;
110 
111  //- Set true to fix the tangential component for inflow
112  Switch fixTangentialInflow_;
113 
114  //- BC which provided the normal component of the velocity
115  tmp<fvPatchVectorField> normalVelocity_;
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("fixedNormalInletOutletVelocity");
122 
123 
124  // Constructors
125 
126  //- Construct from patch and internal field
128  (
129  const fvPatch&,
131  );
132 
133  //- Construct from patch, internal field and dictionary
135  (
136  const fvPatch&,
138  const dictionary&
139  );
140 
141  //- Construct by mapping given
142  // fixedNormalInletOutletVelocityFvPatchVectorField onto a new patch
144  (
146  const fvPatch&,
148  const fvPatchFieldMapper&
149  );
150 
151  //- Construct as copy
153  (
155  );
156 
157  //- Construct and return a clone
158  virtual tmp<fvPatchVectorField> clone() const
159  {
161  (
163  );
164  }
165 
166  //- Construct as copy setting internal field reference
168  (
171  );
172 
173  //- Construct and return a clone setting internal field reference
175  (
177  ) const
178  {
180  (
182  );
183  }
184 
185 
186  // Member functions
187 
188  // Attributes
189 
190  //- Return true: this patch field is altered by assignment
191  virtual bool assignable() const
192  {
193  return true;
194  }
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  }
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  );
231  //- Reverse map the given fvPatchField onto this fvPatchField
232  virtual void rmap
233  (
234  const fvPatchVectorField&,
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 };
250 
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 } // End namespace Foam
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #endif
259 
260 // ************************************************************************* //
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
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 any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
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
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
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 string.
Definition: word.H:59
fixedNormalInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
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...
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.