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