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-2022 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  //- Disallow copy without setting internal field reference
150  (
152  ) = delete;
153 
154  //- Copy constructor setting internal field reference
156  (
159  );
160 
161  //- Construct and return a clone setting internal field reference
163  (
165  ) const
166  {
168  (
170  );
171  }
172 
173 
174  // Member Functions
175 
176  // Attributes
177 
178  //- Return true: this patch field is altered by assignment
179  virtual bool assignable() const
180  {
181  return true;
182  }
183 
184 
185  // Access
186 
187  //- Return the name of phi
188  const word& phiName() const
189  {
190  return phiName_;
191  }
192 
193  //- Return reference to the name of phi to allow adjustment
194  word& phiName()
195  {
196  return phiName_;
197  }
200  {
201  return fixTangentialInflow_;
202  }
203 
204  //- Return the BC which provides the normal component of velocity
205  const fvPatchVectorField& normalVelocity() const
206  {
207  return normalVelocity_();
208  }
209 
210 
211  // Mapping functions
212 
213  //- Map (and resize as needed) from self given a mapping object
214  // Used to update fields following mesh topology change
215  virtual void autoMap(const fvPatchFieldMapper&);
216 
217  //- Reverse map the given fvPatchField onto this fvPatchField
218  // Used to reconstruct fields
219  virtual void rmap(const fvPatchVectorField&, const labelList&);
220 
221  //- Reset the fvPatchField to the given fvPatchField
222  // Used for mesh to mesh mapping
223  virtual void reset(const fvPatchVectorField&);
225 
226  //- Update the coefficients associated with the patch field
227  virtual void updateCoeffs();
228 
229  //- Write
230  virtual void write(Ostream&) const;
231 
232 
233  // Member Operators
234 
235  virtual void operator=(const fvPatchField<vector>& pvf);
236 };
237 
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 } // End namespace Foam
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #endif
246 
247 // ************************************************************************* //
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:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
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.
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.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
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...
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.