flowRateOutletVelocityFvPatchVectorField.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) 2017-2024 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 Description
28  Velocity outlet boundary condition which corrects the extrapolated velocity
29  to match the specified flow rate.
30 
31  For a mass-based flux:
32  - the flow rate should be provided in kg/s
33  - if \c rho is "none" the flow rate is in m^3/s
34  - otherwise \c rho should correspond to the name of the density field
35  - if the density field cannot be found in the database, the user must
36  specify the outlet density using the \c rhoOutlet entry
37 
38  For a volumetric-based flux:
39  - the flow rate is in m^3/s
40 
41 Usage
42  \table
43  Property | Description | Required | Default value
44  massFlowRate | Mass flow rate [kg/s] | no |
45  volumetricFlowRate | Volumetric flow rate [m^3/s] | no |
46  rho | Density field name | no | rho
47  rhoOutlet | Outlet density | no |
48  \endtable
49 
50  Example of the boundary condition specification for a volumetric flow rate:
51  \verbatim
52  <patchName>
53  {
54  type flowRateOutletVelocity;
55  volumetricFlowRate 0.2;
56  value uniform (0 0 0);
57  }
58  \endverbatim
59 
60  Example of the boundary condition specification for a mass flow rate:
61  \verbatim
62  <patchName>
63  {
64  type flowRateOutletVelocity;
65  massFlowRate 0.2;
66  rhoOutlet 1.0;
67  value uniform (0 0 0);
68  }
69  \endverbatim
70 
71  The c volumetricFlowRate or \c massFlowRate entry is a \c Function1 of
72  time, see Foam::Function1s.
73 
74  Note:
75  - \c rhoOutlet is required for the case of a mass flow rate, where the
76  density field is not available at start-up
77  - The value is positive out of the domain (as an outlet)
78  - May not work correctly for transonic outlets
79  - Strange behaviour with potentialFoam since the U equation is not solved
80 
81 See also
82  Foam::fixedValueFvPatchField
83  Foam::Function1s
84  Foam::flowRateInletVelocityFvPatchVectorField
85 
86 SourceFiles
87  flowRateOutletVelocityFvPatchVectorField.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef flowRateOutletVelocityFvPatchVectorField_H
92 #define flowRateOutletVelocityFvPatchVectorField_H
93 
95 #include "Function1.H"
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 namespace Foam
100 {
101 
102 /*---------------------------------------------------------------------------*\
103  Class flowRateOutletVelocityFvPatchVectorField Declaration
104 \*---------------------------------------------------------------------------*/
105 
106 class flowRateOutletVelocityFvPatchVectorField
107 :
108  public fixedValueFvPatchVectorField
109 {
110  // Private Data
111 
112  //- Outlet integral flow rate
113  autoPtr<Function1<scalar>> flowRate_;
114 
115  //- Is the flow-rate volumetric?
116  bool volumetric_;
117 
118  //- Name of the density field used to normalise the mass flux
119  word rhoName_;
120 
121  //- Rho initialisation value (for start; if value not supplied)
122  scalar rhoOutlet_;
123 
124 
125  // Private Member Functions
126 
127  //- Update the patch values given the appropriate density type and value
128  template<class RhoType>
129  void updateValues(const RhoType& rho);
130 
131 
132 public:
133 
134  //- Runtime type information
135  TypeName("flowRateOutletVelocity");
136 
137 
138  // Constructors
139 
140  //- Construct from patch, internal field and dictionary
142  (
143  const fvPatch&,
145  const dictionary&
146  );
147 
148  //- Construct by mapping given
149  // flowRateOutletVelocityFvPatchVectorField
150  // onto a new patch
152  (
154  const fvPatch&,
156  const fieldMapper&
157  );
158 
159  //- Disallow copy without setting internal field reference
161  (
163  ) = delete;
164 
165  //- Copy constructor setting internal field reference
167  (
170  );
171 
172  //- Construct and return a clone setting internal field reference
174  (
176  ) const
177  {
179  (
181  );
182  }
183 
184 
185  // Member Functions
186 
187  //- Update the coefficients associated with the patch field
188  virtual void updateCoeffs();
189 
190  //- Write
191  virtual void write(Ostream&) const;
192 };
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Velocity outlet boundary condition which corrects the extrapolated velocity to match the specified fl...
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
TypeName("flowRateOutletVelocity")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
flowRateOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.