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