swirlFlowRateInletVelocityFvPatchVectorField.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) 2011-2024 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::swirlFlowRateInletVelocityFvPatchVectorField
26 
27 Description
28  Velocity inlet boundary condition creating a normal velocity field to match
29  the specified mass or volumetric flow rate, and radial and tangential
30  velocity fields specified by functions of time and radius or by a given
31  angular speed.
32 
33  For a mass-based flux:
34  - the flow rate should be provided in kg/s
35  - if \c rho is "none" the flow rate is in m3/s
36  - otherwise \c rho should correspond to the name of the density field
37  - if the density field cannot be found in the database, the user must
38  specify the inlet density using the \c rhoInlet entry
39 
40  For a volumetric-based flux:
41  - the flow rate is in m3/s
42 
43 Usage
44  \table
45  Property | Description | Required | Default value
46  origin | Origin of rotation | no | patch centre
47  axis | Axis of rotation | no | patch normal
48  massFlowRate | Mass flow rate [kg/s] | no |
49  volumetricFlowRate | Volumetric flow rate [m^3/s] | no |
50  rho | Density field name | no | rho
51  rhoInlet | Inlet density | no |
52  radialVelocity | Radial velocity [m/s] | yes |
53  omega | Angular velocity of the frame | no |
54  tangentialVelocity | Tangential velocity [m/s] | no |
55  \endtable
56 
57  Example of the boundary condition specification:
58  \verbatim
59  <patchName>
60  {
61  type swirlFlowRateInletVelocity;
62  origin (0 0 0);
63  axis (0 0 1);
64  volumetricFlowRate constant 0.2;
65  radialVelocity constant 10;
66  omega constant 100 [rpm];
67  }
68  \endverbatim
69 
70  The \c volumetricFlowRate or \c massFlowRate and the \c omega entries are
71  \c Function1 of time, see Foam::Function1s. The \c radialVelocity and
72  \c tangentialVelocity entries are \c Function2 of time and radius,
73  see Foam::Function2s.
74 
75  Note:
76  - \c rhoInlet is required for the case of a mass flow rate, where the
77  density field is not available at start-up
78  - The value is positive into the domain (as an inlet)
79  - May not work correctly for transonic inlets
80  - Strange behaviour with potentialFoam since the U equation is not solved
81 
82 See also
83  Foam::fixedValueFvPatchField
84  Foam::Function1s
85  Foam::Function2s
86 
87 SourceFiles
88  swirlFlowRateInletVelocityFvPatchVectorField.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef swirlFlowRateInletVelocityFvPatchVectorField_H
93 #define swirlFlowRateInletVelocityFvPatchVectorField_H
94 
96 #include "Function2.H"
97 #include "omega1.H"
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 namespace Foam
102 {
103 /*---------------------------------------------------------------------------*\
104  Class swirlFlowRateInletVelocityFvPatchVectorField Declaration
105 \*---------------------------------------------------------------------------*/
106 
107 class swirlFlowRateInletVelocityFvPatchVectorField
108 :
109  public fixedValueFvPatchVectorField
110 {
111  // Private Data
112 
113  //- Origin of the rotation
114  const vector origin_;
115 
116  //- Axis of the rotation
117  const vector axis_;
118 
119  //- Inlet integral flow rate
120  autoPtr<Function1<scalar>> flowRate_;
121 
122  //- Is the flow-rate volumetric?
123  bool volumetric_;
124 
125  //- Name of the density field used to normalise the mass flux
126  word rhoName_;
127 
128  //- Rho initialisation value (for start; if value not supplied)
129  const scalar rhoInlet_;
130 
131  //- Radial velocity
132  autoPtr<Function2<scalar>> radialVelocity_;
133 
134  //- Angular velocity of the frame
135  autoPtr<Function1s::omega> omega_;
136 
137  //- Tangential velocity
138  autoPtr<Function2<scalar>> tangentialVelocity_;
139 
140 
141  // Private Member Functions
142 
143  //- Update the patch values given the appropriate density type and value
144  template<class RhoType>
145  void updateValues(const RhoType& rho);
146 
147 
148 public:
149 
150  //- Runtime type information
151  TypeName("swirlFlowRateInletVelocity");
152 
153 
154  // Constructors
155 
156  //- Construct from patch, internal field and dictionary
158  (
159  const fvPatch&,
161  const dictionary&
162  );
163 
164  //- Construct by mapping given
165  // flowRateInletVelocityFvPatchVectorField
166  // onto a new patch
168  (
170  const fvPatch&,
172  const fieldMapper&
173  );
174 
175  //- Disallow copy without setting internal field reference
177  (
179  ) = delete;
180 
181  //- Copy constructor setting internal field reference
183  (
186  );
187 
188  //- Construct and return a clone setting internal field reference
190  (
192  ) const
193  {
195  (
197  );
198  }
199 
200 
201  // Member Functions
202 
203  //- Update the coefficients associated with the patch field
204  virtual void updateCoeffs();
205 
206  //- Write
207  virtual void write(Ostream&) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
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 list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Velocity inlet boundary condition creating a normal velocity field to match the specified mass or vol...
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
swirlFlowRateInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("swirlFlowRateInletVelocity")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49