outletMachNumberPressureFvPatchScalarField.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) 2018 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::outletMachNumberPressureFvPatchScalarField
28
29Group
30 grpOutletBoundaryConditions
31
32Description
33 This boundary condition maintains a certain subsonic Mach number at an
34 outlet patch by dynamically adjusting the static outlet pressure. It makes
35 it possible, for example, to simulate the flow in a preturbine engine
36 exhaust manifold, without resolving details of the flow inside the turbine.
37 In general, the flow in a choked nozzle can be non-trivial and expensive
38 to simulate.
39
40 This formulation is derived from a simple model of the gas flow through
41 a nozzle with fixed geometry. The nozzle flow is assumed to be quasi-steady,
42 1D, isentropic and compressible.
43
44 This gives the following general relationship between pressure ratio and
45 Mach number in any cross section inside the nozzle:
46
47 \f[
48 \frac{p_{tot}}{p}=\left[ 1+ \frac{k-1}{2}\;M^2 \right]^{\frac{k}{k-1}}
49 \f]
50
51 where the constant ratio of heat capacities is \f$k=c_p/c_v\f$.
52 The Mach number in the cross section is \f$M=V/c\f$, where \f$c\f$ is
53 the speed of sound and V is the uniform velocity in the streamwise
54 direction.
55
56 Overall pressure difference across the nozzle is
57 \f[
58 r = pBack/p_{tot}
59 \f]
60
61 When \f$k=1.4\f$, the flow in the nozzle throat becomes choked when
62 \f$ r<0.5\f$ and non-choked otherwise. This implementation is not applicable
63 when \f$ r>=1 \f$ where backflow would occur.
64
65 The nozzle model assumption locks the relationship between nozzle cross
66 sectional areas and Mach numbers. For a choked flow it is only the Mach
67 number on the outlet patch, \f$M_{outlet}\f$, that needs to be stated in the
68 boundary dictionary.
69
70 Care should be taken however to ensure that the entries in the input
71 dictionary and the CFD geometry satisfy the following equation
72 \f[
73 c1\frac{A_{outlet}}{A_1}=\frac{1}{M_{outlet}}\left[\frac{1+\frac{k-1}{2}
74 M_{outlet}^2}{1+\frac{k-1}{2}}\right]^{\frac{k+1}{2(k-1)}}
75 \f]
76 where \f$c1\f$ compensate for non-uniform outlet profiles, \f$A_{outlet}\f$
77 is geometrical outlet patch area and \f$A_1\f$ is assumed nozzle throat
78 area.
79
80 In the non-choked case the outlet patch Mach number is calculated as
81 \f[
82 M_{outlet} =
83 \frac{A_1}
84 {c1\;A_{outlet}}
85 \sqrt{\frac{2}{k-1}\left[r^\frac{2}{k}-r^\frac{k+1}{k} \right]}
86 \f]
87
88 The accompanying boundary conditions for velocity should be
89 pressureInletOutletVelocity.
90
91 Author: Jens Dahl Kunoy
92
93 Reference:
94 \verbatim
95 Fox, R.W & McDonald, A. T. (1994).
96 Introduction to Fluid Mechanics (4ed SI).
97 Wiley
98 \endverbatim
99
100Usage
101
102 \table
103 Property | Description | Required | Default value
104 choked | Defines nozzle conditions| Yes | None
105 relax | underrelaxation of static pressure| Yes | 0
106 M | outlet Mach number | Yes (choked) | None
107 A1 | Nozzle throat area [m2] | Yes (non-choked) | 0
108 pBack | Pressure downstream of nozzle| Yes (non-choked) | None
109 c1 | Correction factor for non-uniform profiles
110 | No (non-choked) | 0.0
111 \endtable
112
113 Example of the boundary condition specification:
114 \verbatim
115 <patchName>
116 {
117 type outletMachNumberPressure;
118 pBack 101325;
119 c1 1;
120 A1 0.008;
121 relax 0.1;
122 choked false;
123 value uniform 200000;
124 }
125 \endverbatim
126
127SourceFiles
128 outletMachNumberPressureFvPatchScalarField.C
129
130\*---------------------------------------------------------------------------*/
131
132#ifndef outletMachNumberPressureFvPatchScalarField_H
133#define outletMachNumberPressureFvPatchScalarField_H
134
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139namespace Foam
140{
141
142/*---------------------------------------------------------------------------*\
143 Class outletMachNumberPressureFvPatchScalarField Declaration
144\*---------------------------------------------------------------------------*/
145
146class outletMachNumberPressureFvPatchScalarField
147:
148 public fixedValueFvPatchScalarField
149{
150 // Private data
151
152 //- Mach number
153 scalar M_;
154
155 //- Back pressure
156 scalar pBack_;
157
158 //- Model constant
159 scalar c1_;
160
161 //- Model constant area input
162 scalar A1_;
163
164 //- The name of the flux field
165 word phiName_;
166
167 //- The name of the rho field
168 word rhoName_;
169
170 //- The name of the U field
171 word UName_;
172
173 //- Choked
174 Switch choked_;
175
176 //- Relaxation factor
177 scalar relax_;
178
179
180public:
181
182 //- Runtime type information
183 TypeName("outletMachNumberPressure");
184
185
186 // Constructors
187
188 //- Construct from patch and internal field
190 (
191 const fvPatch& p,
193 );
194
195 //- Construct from patch, internal field and dictionary
197 (
198 const fvPatch& p,
200 const dictionary& dict
201 );
202
203 //- Construct by mapping given
204 //- outletMachNumberPressureFvPatchScalarField onto a new patch
206 (
208 const fvPatch& p,
210 const fvPatchFieldMapper& mapper
211 );
212
213 //- Construct as copy
215 (
217 );
218
219 //- Construct and return a clone
220 virtual tmp<fvPatchScalarField> clone() const
221 {
223 (
225 );
226 }
227
228 //- Construct as copy setting internal field reference
230 (
233 );
234
235 //- Construct and return a clone setting internal field reference
237 (
239 ) const
240 {
242 (
244 );
245 }
246
247
248 // Member Functions
249
250 //- Update the coefficients associated with the patch field
251 virtual void updateCoeffs();
252
253 //- Write
254 virtual void write(Ostream& os) const;
255};
257
258// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259
260} // End namespace Foam
261
262// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263
264#endif
265
266// ************************************************************************* //
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:62
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition maintains a certain subsonic Mach number at an outlet patch by dynamically ad...
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
TypeName("outletMachNumberPressure")
Runtime type information.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73