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-2023 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, internal field and dictionary
125  (
126  const fvPatch&,
128  const dictionary&
129  );
130 
131  //- Construct by mapping given
132  // fixedNormalInletOutletVelocityFvPatchVectorField onto a new patch
134  (
136  const fvPatch&,
138  const fvPatchFieldMapper&
139  );
140 
141  //- Disallow copy without setting internal field reference
143  (
145  ) = delete;
146 
147  //- Copy constructor setting internal field reference
149  (
152  );
153 
154  //- Construct and return a clone setting internal field reference
156  (
158  ) const
159  {
161  (
163  );
164  }
165 
166 
167  // Member Functions
168 
169  // Attributes
170 
171  //- Return true: this patch field is altered by assignment
172  virtual bool assignable() const
173  {
174  return true;
175  }
176 
177 
178  // Access
179 
180  //- Return the name of phi
181  const word& phiName() const
182  {
183  return phiName_;
184  }
185 
186  //- Return reference to the name of phi to allow adjustment
187  word& phiName()
188  {
189  return phiName_;
190  }
191 
193  {
194  return fixTangentialInflow_;
195  }
196 
197  //- Return the BC which provides the normal component of velocity
198  const fvPatchVectorField& normalVelocity() const
199  {
200  return normalVelocity_();
201  }
202 
203 
204  // Mapping functions
205 
206  //- Map the given fvPatchField onto this fvPatchField
207  virtual void map
208  (
209  const fvPatchVectorField&,
210  const fvPatchFieldMapper&
211  );
212 
213  //- Reset the fvPatchField to the given fvPatchField
214  // Used for mesh to mesh mapping
215  virtual void reset(const fvPatchVectorField&);
216 
217 
218  //- Update the coefficients associated with the patch field
219  virtual void updateCoeffs();
220 
221  //- Write
222  virtual void write(Ostream&) const;
223 
224 
225  // Member Operators
226 
227  virtual void operator=(const fvPatchField<vector>& pvf);
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This velocity inlet/outlet boundary condition combines a fixed normal component obtained from the "no...
fixedNormalInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("fixedNormalInletOutletVelocity")
Runtime type information.
virtual void map(const fvPatchVectorField &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual bool assignable() const
Return true: this patch field is altered by assignment.
const fvPatchVectorField & normalVelocity() const
Return the BC which provides the normal component of velocity.
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.