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-2023 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 flowRate entry is a \c Function1 of time, see Foam::Function1s.
72 
73  Note:
74  - \c rhoOutlet is required for the case of a mass flow rate, where the
75  density field is not available at start-up
76  - The value is positive out of the domain (as an outlet)
77  - May not work correctly for transonic outlets
78  - Strange behaviour with potentialFoam since the U equation is not solved
79 
80 See also
81  Foam::fixedValueFvPatchField
82  Foam::Function1s
83  Foam::flowRateInletVelocityFvPatchVectorField
84 
85 SourceFiles
86  flowRateOutletVelocityFvPatchVectorField.C
87 
88 \*---------------------------------------------------------------------------*/
89 
90 #ifndef flowRateOutletVelocityFvPatchVectorField_H
91 #define flowRateOutletVelocityFvPatchVectorField_H
92 
94 #include "Function1.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class flowRateOutletVelocityFvPatchVectorField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class flowRateOutletVelocityFvPatchVectorField
106 :
107  public fixedValueFvPatchVectorField
108 {
109  // Private Data
110 
111  //- Outlet integral flow rate
112  autoPtr<Function1<scalar>> flowRate_;
113 
114  //- Is volumetric?
115  bool volumetric_;
116 
117  //- Name of the density field used to normalise the mass flux
118  word rhoName_;
119 
120  //- Rho initialisation value (for start; if value not supplied)
121  scalar rhoOutlet_;
122 
123 
124  // Private Member Functions
125 
126  //- Update the patch values given the appropriate density type and value
127  template<class RhoType>
128  void updateValues(const RhoType& rho);
129 
130 
131 public:
132 
133  //- Runtime type information
134  TypeName("flowRateOutletVelocity");
135 
136 
137  // Constructors
138 
139  //- Construct from patch, internal field and dictionary
141  (
142  const fvPatch&,
144  const dictionary&
145  );
146 
147  //- Construct by mapping given
148  // flowRateOutletVelocityFvPatchVectorField
149  // onto a new patch
151  (
153  const fvPatch&,
155  const fvPatchFieldMapper&
156  );
157 
158  //- Disallow copy without setting internal field reference
160  (
162  ) = delete;
163 
164  //- Copy constructor setting internal field reference
166  (
169  );
170 
171  //- Construct and return a clone setting internal field reference
173  (
175  ) const
176  {
178  (
180  );
181  }
182 
183 
184  // Member Functions
185 
186  //- Update the coefficients associated with the patch field
187  virtual void updateCoeffs();
188 
189  //- Write
190  virtual void write(Ostream&) const;
191 };
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #endif
201 
202 // ************************************************************************* //
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:160
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.
Foam::fvPatchFieldMapper.
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.