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