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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::flowRateOutletVelocityFvPatchVectorField
28 
29 Group
30  grpOutletBoundaryConditions
31 
32 Description
33  Velocity outlet boundary condition which corrects the extrapolated velocity
34  to match the specified flow rate.
35 
36  For a mass-based flux:
37  - the flow rate should be provided in kg/s
38  - if \c rho is "none" the flow rate is in m^3/s
39  - otherwise \c rho should correspond to the name of the density field
40  - if the density field cannot be found in the database, the user must
41  specify the outlet density using the \c rhoOutlet entry
42 
43  For a volumetric-based flux:
44  - the flow rate is in m^3/s
45 
46 Usage
47  \table
48  Property | Description | Required | Default value
49  massFlowRate | mass flow rate [kg/s] | no |
50  volumetricFlowRate | volumetric flow rate [m^3/s]| no |
51  rho | density field name | no | rho
52  rhoOutlet | outlet density | no |
53  \endtable
54 
55  Example of the boundary condition specification for a volumetric flow rate:
56  \verbatim
57  <patchName>
58  {
59  type flowRateOutletVelocity;
60  volumetricFlowRate 0.2;
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 flowRateOutletVelocity;
70  massFlowRate 0.2;
71  rhoOutlet 1.0;
72  value uniform (0 0 0);
73  }
74  \endverbatim
75 
76  The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
77 
78 Note
79  - \c rhoOutlet is required for the case of a mass flow rate, where the
80  density field is not available at start-up
81  - The value is positive out of the domain (as an outlet)
82  - May not work correctly for transonic outlets
83  - Strange behaviour with potentialFoam since the U equation is not solved
84 
85 See also
86  Foam::fixedValueFvPatchField
87  Foam::Function1Types
88  Foam::flowRateInletVelocityFvPatchVectorField
89 
90 SourceFiles
91  flowRateOutletVelocityFvPatchVectorField.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef flowRateOutletVelocityFvPatchVectorField_H
96 #define flowRateOutletVelocityFvPatchVectorField_H
97 
99 #include "Function1.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 
106 /*---------------------------------------------------------------------------*\
107  Class flowRateOutletVelocityFvPatchVectorField Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 class flowRateOutletVelocityFvPatchVectorField
111 :
112  public fixedValueFvPatchVectorField
113 {
114  // Private Data
115 
116  //- Outlet integral flow rate
117  autoPtr<Function1<scalar>> flowRate_;
118 
119  //- Name of the density field used to normalize the mass flux
120  word rhoName_;
121 
122  //- Rho initialisation value (for start; if value not supplied)
123  scalar rhoOutlet_;
124 
125  //- Is volumetric?
126  bool volumetric_;
127 
128 
129  // Private Member Functions
131  //- Update the patch values given the appropriate density type and value
132  template<class RhoType>
133  void updateValues(const RhoType& rho);
134 
135 
136 public:
137 
138  //- Runtime type information
139  TypeName("flowRateOutletVelocity");
140 
141 
142  // Constructors
143 
144  //- Construct from patch and internal field
146  (
147  const fvPatch&,
149  );
150 
151  //- Construct from patch, internal field and dictionary
153  (
154  const fvPatch&,
156  const dictionary&
157  );
158 
159  //- Construct by mapping given
160  // flowRateOutletVelocityFvPatchVectorField
161  // onto a new patch
163  (
165  const fvPatch&,
167  const fvPatchFieldMapper&
168  );
169 
170  //- Construct as copy
172  (
174  );
175 
176  //- Construct as copy setting internal field reference
178  (
181  );
182 
183  //- Return a clone
184  virtual tmp<fvPatchField<vector>> clone() const
185  {
186  return fvPatchField<vector>::Clone(*this);
187  }
188 
189  //- Clone with an internal field reference
191  (
193  ) const
194  {
195  return fvPatchField<vector>::Clone(*this, iF);
196  }
197 
198 
199  // Member functions
200 
201  //- Update the coefficients associated with the patch field
202  virtual void updateCoeffs();
203 
204  //- Write
205  virtual void write(Ostream&) const;
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual tmp< fvPatchField< vector > > clone() const
Return a clone.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
A FieldMapper for finite-volume patch fields.
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: HashPtrTable.H:50
flowRateOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.