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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::flowRateInletVelocityFvPatchVectorField
29 
30 Group
31  grpInletBoundaryConditions
32 
33 Description
34  Velocity inlet boundary condition either correcting the extrapolated
35  velocity or creating a uniform velocity field normal to the patch adjusted
36  to match the specified flow rate
37 
38  For a mass-based flux:
39  - the flow rate should be provided in kg/s
40  - if \c rho is "none" the flow rate is in m3/s
41  - otherwise \c rho should correspond to the name of the density field
42  - if the density field cannot be found in the database, the user must
43  specify the inlet density using the \c rhoInlet entry
44 
45  For a volumetric-based flux:
46  - the flow rate is in m3/s
47 
48 Usage
49  \table
50  Property | Description | Required | Default value
51  massFlowRate | mass flow rate [kg/s] | no |
52  volumetricFlowRate | volumetric flow rate [m3/s]| no |
53  rho | density field name | no | rho
54  rhoInlet | inlet density | no |
55  extrapolateProfile | Extrapolate velocity profile | no | false
56  \endtable
57 
58  Example of the boundary condition specification for a volumetric flow rate:
59  \verbatim
60  <patchName>
61  {
62  type flowRateInletVelocity;
63  volumetricFlowRate 0.2;
64  extrapolateProfile yes;
65  value uniform (0 0 0);
66  }
67  \endverbatim
68 
69  Example of the boundary condition specification for a mass flow rate:
70  \verbatim
71  <patchName>
72  {
73  type flowRateInletVelocity;
74  massFlowRate 0.2;
75  extrapolateProfile yes;
76  rho rho;
77  rhoInlet 1.0;
78  value uniform (0 0 0);
79  }
80  \endverbatim
81 
82  The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
83 
84 Note
85  - \c rhoInlet is required for the case of a mass flow rate, where the
86  density field is not available at start-up
87  - The value is positive into the domain (as an inlet)
88  - May not work correctly for transonic inlets
89  - Strange behaviour with potentialFoam since the U equation is not solved
90 
91 See also
92  Foam::fixedValueFvPatchField
93  Foam::Function1Types
94  Foam::flowRateOutletVelocityFvPatchVectorField
95 
96 SourceFiles
97  flowRateInletVelocityFvPatchVectorField.C
98 
99 \*---------------------------------------------------------------------------*/
100 
101 #ifndef flowRateInletVelocityFvPatchVectorField_H
102 #define flowRateInletVelocityFvPatchVectorField_H
103 
104 #include "fixedValueFvPatchFields.H"
105 #include "Function1.H"
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 namespace Foam
110 {
111 
112 /*---------------------------------------------------------------------------*\
113  Class flowRateInletVelocityFvPatchVectorField Declaration
114 \*---------------------------------------------------------------------------*/
115 
116 class flowRateInletVelocityFvPatchVectorField
117 :
118  public fixedValueFvPatchVectorField
119 {
120  // Private Data
121 
122  //- Inlet integral flow rate
123  autoPtr<Function1<scalar>> flowRate_;
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  //- Is volumetric?
132  bool volumetric_;
133 
134  //- Set true to extrapolate the velocity profile from the interior
135  Switch extrapolateProfile_;
136 
137 
138  // Private Member Functions
139 
140  //- Update the patch values given the appropriate density type and value
141  template<class RhoType>
142  void updateValues(const RhoType& rho);
143 
144 
145 public:
146 
147  //- Runtime type information
148  TypeName("flowRateInletVelocity");
149 
150 
151  // Constructors
152 
153  //- Construct from patch and internal field
155  (
156  const fvPatch&,
158  );
159 
160  //- Construct from patch, internal field and dictionary
162  (
163  const fvPatch&,
165  const dictionary&
166  );
167 
168  //- Construct by mapping given
169  // flowRateInletVelocityFvPatchVectorField
170  // onto a new patch
172  (
174  const fvPatch&,
176  const fvPatchFieldMapper&
177  );
178 
179  //- Construct as copy
181  (
183  );
184 
185  //- Construct and return a clone
186  virtual tmp<fvPatchVectorField> clone() const
187  {
189  (
191  );
192  }
193 
194  //- Construct as copy setting internal field reference
196  (
199  );
200 
201  //- Construct and return a clone setting internal field reference
203  (
205  ) const
206  {
208  (
210  );
211  }
212 
213 
214  // Member Functions
215 
216  //- Update the coefficients associated with the patch field
217  virtual void updateCoeffs();
218 
219  //- Write
220  virtual void write(Ostream&) const;
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
Foam::flowRateInletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: flowRateInletVelocityFvPatchVectorField.C:245
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::flowRateInletVelocityFvPatchVectorField::TypeName
TypeName("flowRateInletVelocity")
Runtime type information.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::flowRateInletVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: flowRateInletVelocityFvPatchVectorField.H:215
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Function1.H
rho
rho
Definition: readInitialConditions.H:88
Foam::flowRateInletVelocityFvPatchVectorField::flowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: flowRateInletVelocityFvPatchVectorField.C:39
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: flowRateInletVelocityFvPatchVectorField.C:205
Foam::flowRateInletVelocityFvPatchVectorField
Velocity inlet boundary condition either correcting the extrapolated velocity or creating a uniform v...
Definition: flowRateInletVelocityFvPatchVectorField.H:145
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
fixedValueFvPatchFields.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54