flowRateOutletVelocityFvPatchVectorField.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) 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::flowRateOutletVelocityFvPatchVectorField
26 
27 Group
28  grpOutletBoundaryConditions
29 
30 Description
31  Velocity outlet boundary condition which corrects the extrapolated velocity
32  to match the specified flow rate.
33 
34  For a mass-based flux:
35  - the flow rate should be provided in kg/s
36  - if \c rho is "none" the flow rate is in m^3/s
37  - otherwise \c rho should correspond to the name of the density field
38  - if the density field cannot be found in the database, the user must
39  specify the outlet density using the \c rhoOutlet entry
40 
41  For a volumetric-based flux:
42  - the flow rate is in m^3/s
43 
44 Usage
45  \table
46  Property | Description | Required | Default value
47  massFlowRate | mass flow rate [kg/s] | no |
48  volumetricFlowRate | volumetric flow rate [m^3/s]| no |
49  rho | density field name | no | rho
50  rhoOutlet | outlet density | no |
51  \endtable
52 
53  Example of the boundary condition specification for a volumetric flow rate:
54  \verbatim
55  <patchName>
56  {
57  type flowRateOutletVelocity;
58  volumetricFlowRate 0.2;
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 flowRateOutletVelocity;
68  massFlowRate 0.2;
69  rhoOutlet 1.0;
70  value uniform (0 0 0);
71  }
72  \endverbatim
73 
74  The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
75 
76 Note
77  - \c rhoOutlet is required for the case of a mass flow rate, where the
78  density field is not available at start-up
79  - The value is positive out of the domain (as an outlet)
80  - May not work correctly for transonic outlets
81  - Strange behaviour with potentialFoam since the U equation is not solved
82 
83 See also
84  Foam::fixedValueFvPatchField
85  Foam::Function1Types
86  Foam::flowRateInletVelocityFvPatchVectorField
87 
88 SourceFiles
89  flowRateOutletVelocityFvPatchVectorField.C
90 
91 \*---------------------------------------------------------------------------*/
92 
93 #ifndef flowRateOutletVelocityFvPatchVectorField_H
94 #define flowRateOutletVelocityFvPatchVectorField_H
95 
97 #include "Function1.H"
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 namespace Foam
102 {
103 
104 /*---------------------------------------------------------------------------*\
105  Class flowRateOutletVelocityFvPatchVectorField Declaration
106 \*---------------------------------------------------------------------------*/
107 
108 class flowRateOutletVelocityFvPatchVectorField
109 :
110  public fixedValueFvPatchVectorField
111 {
112  // Private data
113 
114  //- Outlet integral flow rate
115  autoPtr<Function1<scalar>> flowRate_;
116 
117  //- Is volumetric?
118  bool volumetric_;
119 
120  //- Name of the density field used to normalize the mass flux
121  word rhoName_;
122 
123  //- Rho initialisation value (for start; if value not supplied)
124  scalar rhoOutlet_;
125 
126 
127  // Private member functions
128 
129  //- Update the patch values given the appropriate density type and value
130  template<class RhoType>
131  void updateValues(const RhoType& rho);
133 
134 public:
135 
136  //- Runtime type information
137  TypeName("flowRateOutletVelocity");
138 
139 
140  // Constructors
141 
142  //- Construct from patch and internal field
144  (
145  const fvPatch&,
147  );
148 
149  //- Construct from patch, internal field and dictionary
151  (
152  const fvPatch&,
154  const dictionary&
155  );
156 
157  //- Construct by mapping given
158  // flowRateOutletVelocityFvPatchVectorField
159  // onto a new patch
161  (
163  const fvPatch&,
165  const fvPatchFieldMapper&
166  );
167 
168  //- Construct as copy
170  (
172  );
173 
174  //- Construct and return a clone
175  virtual tmp<fvPatchVectorField> clone() const
176  {
178  (
180  );
181  }
182 
183  //- Construct as copy setting internal field reference
185  (
188  );
189 
190  //- Construct and return a clone setting internal field reference
192  (
194  ) const
195  {
197  (
199  );
200  }
201 
202 
203  // Member functions
204 
205  //- Update the coefficients associated with the patch field
206  virtual void updateCoeffs();
207 
208  //- Write
209  virtual void write(Ostream&) const;
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
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
Foam::fvPatchFieldMapper.
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
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...
TypeName("flowRateOutletVelocity")
Runtime type information.
Velocity outlet boundary condition which corrects the extrapolated velocity to match the specified fl...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for managing temporary objects.
Definition: PtrList.H:53
flowRateOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.