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-2016 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  This boundary condition provides a velocity boundary condition, derived
32  from the flux (volumetric or mass-based), whose direction is assumed
33  to be normal to the patch.
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  rhoInlet | inlet density | no |
51  extrapolateProfile | Extrapolate velocity profile | no | false
52  \endtable
53 
54  Example of the boundary condition specification for a volumetric flow rate:
55  \verbatim
56  <patchName>
57  {
58  type flowRateInletVelocity;
59  volumetricFlowRate 0.2;
60  extrapolateProfile yes;
61  value uniform (0 0 0);
62  }
63  \endverbatim
64 
65  Example of the boundary condition specification for a mass flow rate:
66  \verbatim
67  <patchName>
68  {
69  type flowRateInletVelocity;
70  massFlowRate 0.2;
71  extrapolateProfile yes;
72  rho rho;
73  rhoInlet 1.0;
74  value uniform (0 0 0);
75  }
76  \endverbatim
77 
78  The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
79 
80 Note
81  - \c rhoInlet is required for the case of a mass flow rate, where the
82  density field is not available at start-up
83  - The value is positive into the domain (as an inlet)
84  - May not work correctly for transonic inlets
85  - Strange behaviour with potentialFoam since the U equation is not solved
86 
87 See also
88  Foam::fixedValueFvPatchField
89  Foam::Function1Types
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  //- Set true to extrapolate the velocity profile from the interior
130  Switch extrapolateProfile_;
131 
132 
133  // Private member functions
134 
135  //- Update the patch values given the appropriate density type and value
136  template<class RhoType>
137  void updateValues(const RhoType& rho);
138 
139 
140 public:
141 
142  //- Runtime type information
143  TypeName("flowRateInletVelocity");
144 
145 
146  // Constructors
147 
148  //- Construct from patch and internal field
150  (
151  const fvPatch&,
153  );
154 
155  //- Construct from patch, internal field and dictionary
157  (
158  const fvPatch&,
160  const dictionary&
161  );
162 
163  //- Construct by mapping given
164  // flowRateInletVelocityFvPatchVectorField
165  // onto a new patch
167  (
169  const fvPatch&,
171  const fvPatchFieldMapper&
172  );
173 
174  //- Construct as copy
176  (
178  );
179 
180  //- Construct and return a clone
181  virtual tmp<fvPatchVectorField> clone() const
182  {
184  (
186  );
187  }
188 
189  //- Construct as copy setting internal field reference
191  (
194  );
195 
196  //- Construct and return a clone setting internal field reference
198  (
200  ) const
201  {
203  (
205  );
206  }
207 
208 
209  // Member functions
210 
211  //- Update the coefficients associated with the patch field
212  virtual void updateCoeffs();
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
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.
This boundary condition provides a velocity boundary condition, derived from the flux (volumetric or ...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
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:54
TypeName("flowRateInletVelocity")
Runtime type information.
Namespace for OpenFOAM.