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  //- Is volumetric?
120  bool volumetric_;
121 
122  //- Name of the density field used to normalize the mass flux
123  word rhoName_;
124 
125  //- Rho initialisation value (for start; if value not supplied)
126  scalar rhoOutlet_;
127 
128 
129  // Private member functions
130 
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 and return a clone
177  virtual tmp<fvPatchVectorField> clone() const
178  {
180  (
182  );
183  }
184 
185  //- Construct as copy setting internal field reference
187  (
190  );
191 
192  //- Construct and return a clone setting internal field reference
194  (
196  ) const
197  {
199  (
201  );
202  }
203 
204 
205  // Member functions
206 
207  //- Update the coefficients associated with the patch field
208  virtual void updateCoeffs();
209 
210  //- Write
211  virtual void write(Ostream&) const;
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::flowRateOutletVelocityFvPatchVectorField
Velocity outlet boundary condition which corrects the extrapolated velocity to match the specified fl...
Definition: flowRateOutletVelocityFvPatchVectorField.H:134
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Function1.H
rho
rho
Definition: readInitialConditions.H:88
Foam::flowRateOutletVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: flowRateOutletVelocityFvPatchVectorField.H:201
Foam::flowRateOutletVelocityFvPatchVectorField::TypeName
TypeName("flowRateOutletVelocity")
Runtime type information.
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::flowRateOutletVelocityFvPatchVectorField::flowRateOutletVelocityFvPatchVectorField
flowRateOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: flowRateOutletVelocityFvPatchVectorField.C:38
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::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::flowRateOutletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: flowRateOutletVelocityFvPatchVectorField.C:187
Foam::flowRateOutletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: flowRateOutletVelocityFvPatchVectorField.C:227
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54