fixedNormalInletOutletVelocityFvPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2014-2019 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 Description
28 
29  This velocity inlet/outlet boundary condition combines a fixed normal
30  component obtained from the "normalVelocity" patchField supplied with a
31  fixed or zero-gradiented tangential component depending on the direction
32  of the flow and the setting of "fixTangentialInflow":
33  - Outflow: apply zero-gradient condition to tangential components
34  - Inflow:
35  - fixTangentialInflow is true
36  apply value provided by the normalVelocity patchField to the
37  tangential components
38  - fixTangentialInflow is false
39  apply zero-gradient condition to tangential components.
40 
41 Usage
42  \table
43  Property | Description | Required | Default value
44  phi | flux field name | no | phi
45  fixTangentialInflow | If true fix the tangential component for inflow | yes |
46  normalVelocity | patchField providing the normal velocity field | yes |
47  \endtable
48 
49  Example of the boundary condition specification:
50  \verbatim
51  <patchName>
52  {
53  type fixedNormalInletOutletVelocity;
54 
55  fixTangentialInflow false;
56  normalVelocity
57  {
58  type uniformFixedValue;
59  uniformValue sine;
60  uniformValueCoeffs
61  {
62  frequency 1;
63  amplitude table
64  (
65  (0 0)
66  (2 0.088)
67  (8 0.088)
68  );
69  scale (0 1 0);
70  level (0 0 0);
71  }
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  //- Copy constructor
150  (
152  );
153 
154  //- Construct and return a clone
155  virtual tmp<fvPatchVectorField> clone() const
156  {
158  (
160  );
161  }
162 
163  //- Copy constructor 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  // Attributes
186 
187  //- Return true: this patch field is altered by assignment
188  virtual bool assignable() const
189  {
190  return true;
191  }
192 
193 
194  // Access
195 
196  //- Return the name of phi
197  const word& phiName() const
198  {
199  return phiName_;
200  }
201 
202  //- Return reference to the name of phi to allow adjustment
203  word& phiName()
204  {
205  return phiName_;
206  }
209  {
210  return fixTangentialInflow_;
211  }
212 
213  //- Return the BC which provides the normal component of velocity
214  const fvPatchVectorField& normalVelocity() const
215  {
216  return normalVelocity_();
217  }
218 
219 
220  // Mapping functions
221 
222  //- Map (and resize as needed) from self given a mapping object
223  // Used to update fields following mesh topology change
224  virtual void autoMap(const fvPatchFieldMapper&);
225 
226  //- Reverse map the given fvPatchField onto this fvPatchField
227  // Used to reconstruct fields
228  virtual void rmap(const fvPatchVectorField&, const labelList&);
229 
230 
231  //- Update the coefficients associated with the patch field
232  virtual void updateCoeffs();
234  //- Write
235  virtual void write(Ostream&) const;
236 
237 
238  // Member Operators
239 
240  virtual void operator=(const fvPatchField<vector>& pvf);
241 };
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 } // End namespace Foam
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
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:158
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/any.
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.