flowRateInletVelocityFvPatchVectorField.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-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::flowRateInletVelocityFvPatchVectorField
26 
27 Description
28  Velocity inlet boundary condition either correcting the extrapolated
29  velocity or creating a uniform velocity field normal to the patch adjusted
30  to match the specified flow rate
31 
32  For a mass-based flux:
33  - the flow rate should be provided in kg/s
34  - if \c rho is "none" the flow rate is in m3/s
35  - otherwise \c rho should correspond to the name of the density field
36  - if the density field cannot be found in the database, the user must
37  specify the inlet density using the \c rhoInlet entry
38 
39  For a volumetric-based flux:
40  - the flow rate is in m3/s
41 
42 Usage
43  \table
44  Property | Description | Required | Default value
45  massFlowRate | mass flow rate [kg/s] | no |
46  volumetricFlowRate | volumetric flow rate [m3/s]| no |
47  rho | density field name | no | rho
48  rhoInlet | inlet density | no |
49  extrapolateProfile | Extrapolate velocity profile | no | false
50  \endtable
51 
52  Example of the boundary condition specification for a volumetric flow rate:
53  \verbatim
54  <patchName>
55  {
56  type flowRateInletVelocity;
57  volumetricFlowRate 0.2;
58  extrapolateProfile yes;
59  value uniform (0 0 0);
60  }
61  \endverbatim
62 
63  Example of the boundary condition specification for a mass flow rate:
64  \verbatim
65  <patchName>
66  {
67  type flowRateInletVelocity;
68  massFlowRate 0.2;
69  extrapolateProfile yes;
70  rho rho;
71  rhoInlet 1.0;
72  value uniform (0 0 0);
73  }
74  \endverbatim
75 
76  The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
77 
78 Note
79  - \c rhoInlet is required for the case of a mass flow rate, where the
80  density field is not available at start-up
81  - The value is positive into the domain (as an inlet)
82  - May not work correctly for transonic inlets
83  - Strange behaviour with potentialFoam since the U equation is not solved
84 
85 See also
86  Foam::fixedValueFvPatchField
87  Foam::Function1Types
88  Foam::flowRateOutletVelocityFvPatchVectorField
89 
90 SourceFiles
91  flowRateInletVelocityFvPatchVectorField.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef flowRateInletVelocityFvPatchVectorField_H
96 #define flowRateInletVelocityFvPatchVectorField_H
97 
99 #include "Function1.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 
106 /*---------------------------------------------------------------------------*\
107  Class flowRateInletVelocityFvPatchVectorField Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 class flowRateInletVelocityFvPatchVectorField
111 :
112  public fixedValueFvPatchVectorField
113 {
114  // Private Data
115 
116  //- Inlet integral flow rate
117  autoPtr<Function1<scalar>> flowRate_;
118 
119  //- Is volumetric?
120  bool volumetric_;
121 
122  //- Name of the density field used to normalize the mass flux
123  word rhoName_;
124 
125  //- Rho initialisation value (for start; if value not supplied)
126  scalar rhoInlet_;
127 
128  //- Set true to extrapolate the velocity profile from the interior
129  Switch extrapolateProfile_;
130 
131 
132  // Private Member Functions
133 
134  //- Update the patch values given the appropriate density type and value
135  template<class RhoType>
136  void updateValues(const RhoType& rho);
137 
138 
139 public:
140 
141  //- Runtime type information
142  TypeName("flowRateInletVelocity");
143 
144 
145  // Constructors
146 
147  //- Construct from patch and internal field
149  (
150  const fvPatch&,
152  );
153 
154  //- Construct from patch, internal field and dictionary
156  (
157  const fvPatch&,
159  const dictionary&
160  );
161 
162  //- Construct by mapping given
163  // flowRateInletVelocityFvPatchVectorField
164  // onto a new patch
166  (
168  const fvPatch&,
170  const fvPatchFieldMapper&
171  );
172 
173  //- Copy constructor
175  (
177  );
178 
179  //- Construct and return a clone
180  virtual tmp<fvPatchVectorField> clone() const
181  {
183  (
185  );
186  }
187 
188  //- Copy constructor setting internal field reference
190  (
193  );
194 
195  //- Construct and return a clone setting internal field reference
197  (
199  ) const
200  {
202  (
204  );
205  }
206 
207 
208  // Member Functions
210  //- Update the coefficients associated with the patch field
211  virtual void updateCoeffs();
212 
213  //- Write
214  virtual void write(Ostream&) const;
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
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
flowRateInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Velocity inlet boundary condition either correcting the extrapolated velocity or creating a uniform v...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
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
TypeName("flowRateInletVelocity")
Runtime type information.
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Namespace for OpenFOAM.