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-2020 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 [m^3/s]| no |
47  rho | density field name | no | rho
48  rhoInlet | inlet density | no |
49  alpha | volume fraction field name | no |
50  extrapolateProfile | Extrapolate velocity profile | no | false
51  \endtable
52 
53  Example of the boundary condition specification for a volumetric flow rate:
54  \verbatim
55  <patchName>
56  {
57  type flowRateInletVelocity;
58  volumetricFlowRate 0.2;
59  extrapolateProfile yes;
60  value uniform (0 0 0);
61  }
62  \endverbatim
63 
64  Example of the boundary condition specification for a mass flow rate:
65  \verbatim
66  <patchName>
67  {
68  type flowRateInletVelocity;
69  massFlowRate 0.2;
70  extrapolateProfile yes;
71  rho rho;
72  rhoInlet 1.0;
73  value uniform (0 0 0);
74  }
75  \endverbatim
76 
77  The \c flowRate entry is a \c Function1 of time, see Foam::Function1s.
78 
79 Note
80  - \c rhoInlet is required for the case of a mass flow rate, where the
81  density field is not available at start-up
82  - The value is positive into the domain (as an inlet)
83  - May not work correctly for transonic inlets
84  - Strange behaviour with potentialFoam since the U equation is not solved
85 
86 See also
87  Foam::fixedValueFvPatchField
88  Foam::Function1s
89  Foam::flowRateOutletVelocityFvPatchVectorField
90 
91 SourceFiles
92  flowRateInletVelocityFvPatchVectorField.C
93 
94 \*---------------------------------------------------------------------------*/
95 
96 #ifndef flowRateInletVelocityFvPatchVectorField_H
97 #define flowRateInletVelocityFvPatchVectorField_H
98 
100 #include "Function1.H"
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 namespace Foam
105 {
106 
107 /*---------------------------------------------------------------------------*\
108  Class flowRateInletVelocityFvPatchVectorField Declaration
109 \*---------------------------------------------------------------------------*/
110 
111 class flowRateInletVelocityFvPatchVectorField
112 :
113  public fixedValueFvPatchVectorField
114 {
115  // Private Data
116 
117  //- Inlet integral flow rate
118  autoPtr<Function1<scalar>> flowRate_;
119 
120  //- Is volumetric?
121  bool volumetric_;
122 
123  //- Name of the density field used to normalize the mass flux
124  word rhoName_;
125 
126  //- Rho initialisation value (for start; if value not supplied)
127  scalar rhoInlet_;
128 
129  //- Name of the volume fraction field used to convert to interstitial
130  // velocity
131  word alphaName_;
132 
133  //- Set true to extrapolate the velocity profile from the interior
134  Switch extrapolateProfile_;
135 
136 
137  // Private Member Functions
138 
139  //- Update the patch values given the appropriate volume fraction and
140  // density types and values
141  template<class AlphaType, class RhoType>
142  void updateValues(const AlphaType& alpha, const RhoType& rho);
143 
144  //- Update the patch values given the appropriate volume fraction type
145  // and values
146  template<class AlphaType>
147  void updateValues(const AlphaType& alpha);
148 
149 
150 public:
151 
152  //- Runtime type information
153  TypeName("flowRateInletVelocity");
154 
155 
156  // Constructors
157 
158  //- Construct from patch and internal field
160  (
161  const fvPatch&,
163  );
164 
165  //- Construct from patch, internal field and dictionary
167  (
168  const fvPatch&,
170  const dictionary&
171  );
172 
173  //- Construct by mapping given
174  // flowRateInletVelocityFvPatchVectorField
175  // onto a new patch
177  (
179  const fvPatch&,
181  const fvPatchFieldMapper&
182  );
183 
184  //- Copy constructor
186  (
188  );
189 
190  //- Construct and return a clone
191  virtual tmp<fvPatchVectorField> clone() const
192  {
194  (
196  );
197  }
198 
199  //- Copy constructor setting internal field reference
201  (
204  );
205 
206  //- Construct and return a clone setting internal field reference
208  (
210  ) const
211  {
213  (
215  );
216  }
217 
218 
219  // Member Functions
220 
221  //- Update the coefficients associated with the patch field
222  virtual void updateCoeffs();
223 
224  //- Write
225  virtual void write(Ostream&) const;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
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:54
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
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.