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 -------------------------------------------------------------------------------
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::outletMachNumberPressureFvPatchScalarField
28 
29 Group
30  grpOutletBoundaryConditions
31 
32 Description
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 
100 Usage
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 
127 SourceFiles
128  outletMachNumberPressureFvPatchScalarField.C
129 
130 \*---------------------------------------------------------------------------*/
131 
132 #ifndef outletMachNumberPressureFvPatchScalarField_H
133 #define outletMachNumberPressureFvPatchScalarField_H
134 
135 #include "fixedValueFvPatchFields.H"
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 namespace Foam
140 {
141 
142 /*---------------------------------------------------------------------------*\
143  Class outletMachNumberPressureFvPatchScalarField Declaration
144 \*---------------------------------------------------------------------------*/
145 
146 class outletMachNumberPressureFvPatchScalarField
147 :
148  public fixedValueFvPatchScalarField
149 {
150  typedef outletMachNumberPressureFvPatchScalarField this_bctype;
151  typedef fixedValueFvPatchScalarField parent_bctype;
152 
153  // Private data
154 
155  //- Mach number
156  scalar M_;
157 
158  //- Back pressure
159  scalar pBack_;
160 
161  //- Model constant
162  scalar c1_;
163 
164  //- Model constant area input
165  scalar A1_;
166 
167  //- The name of the flux field
168  word phiName_;
169 
170  //- The name of the rho field
171  word rhoName_;
172 
173  //- The name of the U field
174  word UName_;
175 
176  //- Choked
177  Switch choked_;
179  //- Relaxation factor
180  scalar relax_;
181 
182 
183 public:
184 
185  //- Runtime type information
186  TypeName("outletMachNumberPressure");
187 
188 
189  // Constructors
190 
191  //- Construct from patch and internal field
193  (
194  const fvPatch& p,
196  );
197 
198  //- Construct from patch, internal field and dictionary
200  (
201  const fvPatch& p,
203  const dictionary& dict
204  );
205 
206  //- Construct by mapping onto a new patch
208  (
210  const fvPatch& p,
212  const fvPatchFieldMapper& mapper
213  );
214 
215  //- Construct as copy setting internal field reference
217  (
220  );
221 
222  //- No copy without an internal field
224 
225  //- Clone with an internal field reference
227  (
229  ) const
230  {
231  return fvPatchField<scalar>::Clone(*this, iF);
232  }
233 
234 
235  // Member Functions
236 
237  //- Update the coefficients associated with the patch field
238  virtual void updateCoeffs();
239 
240  //- Write
241  virtual void write(Ostream& os) const;
242 
243 
244  // Member Operators
245 
246  //- Inherit assignment
247  using parent_bctype::operator=;
248 };
249 
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 } // End namespace Foam
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #endif
258 
259 // ************************************************************************* //
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:635
A FieldMapper for finite-volume patch fields.
This boundary condition maintains a certain subsonic Mach number at an outlet patch by dynamically ad...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
outletMachNumberPressureFvPatchScalarField(const fvPatch &p, const DimensionedField< scalar, volMesh > &iF)
Construct from patch and internal field.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
TypeName("outletMachNumberPressure")
Runtime type information.
Namespace for OpenFOAM.