plenumPressureFvPatchScalarField.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 | Copyright (C) 2016 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::plenumPressureFvPatchScalarField
26 
27 Group
28  grpInletBoundaryConditions
29 
30 Description
31  This boundary condition provides a plenum pressure inlet condition. This
32  condition creates a zero-dimensional model of an enclosed volume of gas
33  upstream of the inlet. The pressure that the boundary condition exerts on
34  the inlet boundary is dependent on the thermodynamic state of the upstream
35  volume. The upstream plenum density and temperature are time-stepped along
36  with the rest of the simulation, and momentum is neglected. The plenum is
37  supplied with a user specified mass flow and temperature.
38 
39  The result is a boundary condition which blends between a pressure inlet
40  condition condition and a fixed mass flow. The smaller the plenum
41  volume, the quicker the pressure responds to a deviation from the supply
42  mass flow, and the closer the model approximates a fixed mass flow. As
43  the plenum size increases, the model becomes more similar to a specified
44  pressure.
45 
46  The expansion from the plenum to the inlet boundary is controlled by an
47  area ratio and a discharge coefficient. The area ratio can be used to
48  represent further acceleration between a sub-grid blockage such as fins.
49  The discharge coefficient represents a fractional deviation from an
50  ideal expansion process.
51 
52  This condition is useful for simulating unsteady internal flow problems
53  for which both a mass flow boundary is unrealistic, and a pressure
54  boundary is susceptible to flow reversal. It was developed for use in
55  simulating confined combustion.
56 
57  Reference:
58  \verbatim
59  Bainbridge, W. (2013).
60  The Numerical Simulation of Oscillations in Gas Turbine Combustion
61  Chambers,
62  PhD Thesis,
63  Chapter 4, Section 4.3.1.2, 77-80.
64  \endverbatim
65 
66 Usage
67  \table
68  Property | Description | Required | Default value
69  gamma | ratio of specific heats | yes | none
70  R | specific gas constant | yes | none
71  supplyMassFlowRate | flow rate into the plenum | yes | none
72  supplyTotalTemperature | temperature into the plenum | yes | none
73  plenumVolume | plenum volume | yes | none
74  plenumDensity | plenum density | yes | none
75  plenumTemperature | plenum temperature | yes | none
76  U | velocity field name | no | U
77  phi | flux field name | no | phi
78  rho | inlet density | no | none
79  inletAreaRatio | inlet open fraction | yes | none
80  inletDischargeCoefficient | inlet loss coefficient | yes | none
81  timeScale | relaxation time scale | yes | none
82  \endtable
83 
84  Example of the boundary condition specification:
85  \verbatim
86  <patchName>
87  {
88  type plenumPressure;
89  gamma 1.4;
90  R 287.04;
91  supplyMassFlowRate 0.0001;
92  supplyTotalTemperature 300;
93  plenumVolume 0.000125;
94  plenumDensity 1.1613;
95  plenumTemperature 300;
96  inletAreaRatio 1.0;
97  inletDischargeCoefficient 0.8;
98  timeScale 1e-4;
99  value uniform 1e5;
100  }
101  \endverbatim
102 
103 SourceFiles
104  plenumPressureFvPatchScalarField.C
105 
106 \*---------------------------------------------------------------------------*/
107 
108 #ifndef plenumPressureFvPatchScalarField_H
109 #define plenumPressureFvPatchScalarField_H
110 
111 #include "fixedValueFvPatchFields.H"
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 namespace Foam
116 {
117 
118 /*---------------------------------------------------------------------------*\
119  Class plenumPressureFvPatch Declaration
120 \*---------------------------------------------------------------------------*/
121 
122 class plenumPressureFvPatchScalarField
123 :
124  public fixedValueFvPatchScalarField
125 {
126  // Private data
127 
128  //- Ratio of specific heats
129  scalar gamma_;
130 
131  //- Specific gas constant
132  scalar R_;
133 
134  //- Mass flow rate supplied to the plenum
135  scalar supplyMassFlowRate_;
136 
137  //- Total temperature of the gas supplied to the plenum
138  scalar supplyTotalTemperature_;
139 
140  //- The volume of the plenum
141  scalar plenumVolume_;
142 
143  //- The mean density of the gas in the plenum
144  scalar plenumDensity_;
145 
146  //- The old-time mean density of the gas in the plenum
147  scalar plenumDensityOld_;
148 
149  //- The mean temperature of the gas in the plenum
150  scalar plenumTemperature_;
151 
152  //- The mean old-time temperature of the gas in the plenum
153  scalar plenumTemperatureOld_;
154 
155  //- The constant density used when phi is volumetric
156  scalar rho_;
157 
158  //- Whether or not the constant density has been specified
159  bool hasRho_;
160 
161  //- The ratio of open area to total area at the inlet
162  // Allows a grid or mesh to be represented
163  scalar inletAreaRatio_;
164 
165  //- The discharge coefficient at the inlet
166  scalar inletDischargeCoefficient_;
167 
168  //- The time scale over which changes in pressure are smoothed
169  scalar timeScale_;
170 
171  //- The time index used for updating
172  label timeIndex_;
173 
174  //- The name of the flux field
175  word phiName_;
176 
177  //- The name of the velocity field
178  word UName_;
179 
180 
181 public:
182 
183  //- Runtime type information
184  TypeName("plenumPressure");
185 
186 
187  // Constructors
188 
189  //- Construct from patch and internal field
191  (
192  const fvPatch&,
194  );
195 
196  //- Construct from patch, internal field and dictionary
198  (
199  const fvPatch&,
201  const dictionary&
202  );
203 
204  //- Construct by mapping given plenumPressureFvPatchScalarField
205  // onto a new patch
207  (
209  const fvPatch&,
211  const fvPatchFieldMapper&
212  );
213 
214  //- Construct as copy
216  (
218  );
219 
220  //- Construct and return a clone
221  virtual tmp<fvPatchScalarField> clone() const
222  {
224  (
226  );
227  }
228 
229  //- Construct as copy setting internal field reference
231  (
234  );
235 
236  //- Construct and return a clone setting internal field reference
238  (
240  ) const
241  {
243  (
244  new plenumPressureFvPatchScalarField(*this, iF)
245  );
246  }
247 
248 
249  // Member functions
250 
251  // Evaluation functions
252 
253  //- Update the coefficients associated with the patch field
254  virtual void updateCoeffs();
255 
256 
257  //- Write
258  virtual void write(Ostream&) const;
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #endif
269 
270 // ************************************************************************* //
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
TypeName("plenumPressure")
Runtime type information.
This boundary condition provides a plenum pressure inlet condition. This condition creates a zero-dim...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Foam::fvPatchFieldMapper.
plenumPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:54
Namespace for OpenFOAM.