totalPressureFvPatchScalarField.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) 2011-2016 OpenFOAM Foundation
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::totalPressureFvPatchScalarField
28
29Group
30 grpInletBoundaryConditions grpOutletBoundaryConditions
31
32Description
33 This boundary condition provides a total pressure condition. Four
34 variants are possible:
35
36 1. incompressible subsonic:
37 \f[
38 p_p = p_0 - 0.5 |U|^2
39 \f]
40 where
41 \vartable
42 p_p | incompressible pressure at patch [m2/s2]
43 p_0 | incompressible total pressure [m2/s2]
44 U | velocity
45 \endvartable
46
47 2. compressible subsonic:
48 \f[
49 p_p = p_0 - 0.5 \rho |U|^2
50 \f]
51 where
52 \vartable
53 p_p | pressure at patch [Pa]
54 p_0 | total pressure [Pa]
55 \rho | density [kg/m3]
56 U | velocity
57 \endvartable
58
59 3. compressible transonic (\f$\gamma = 1\f$):
60 \f[
61 p_p = \frac{p_0}{1 + 0.5 \psi |U|^2}
62 \f]
63 where
64 \vartable
65 p_p | pressure at patch [Pa]
66 p_0 | total pressure [Pa]
67 G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$
68 \endvartable
69
70 4. compressible supersonic (\f$\gamma > 1\f$):
71 \f[
72 p_p = \frac{p_0}{(1 + 0.5 \psi G |U|^2)^{\frac{1}{G}}}
73 \f]
74 where
75 \vartable
76 p_p | pressure at patch [Pa]
77 p_0 | total pressure [Pa]
78 \gamma | ratio of specific heats (Cp/Cv)
79 \psi | compressibility [m2/s2]
80 G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$
81 \endvartable
82
83 The modes of operation are set by the dimensions of the pressure field
84 to which this boundary condition is applied, the \c psi entry and the value
85 of \c gamma:
86 \table
87 Mode | dimensions | psi | gamma
88 incompressible subsonic | p/rho | |
89 compressible subsonic | p | none |
90 compressible transonic | p | psi | 1
91 compressible supersonic | p | psi | > 1
92 \endtable
93
94
95Usage
96 \table
97 Property | Description | Required | Default value
98 U | Velocity field name | no | U
99 phi | Flux field name | no | phi
100 rho | Density field name | no | rho
101 psi | Compressibility field name | no | none
102 gamma | (Cp/Cv) | no | 1
103 p0 | Total pressure | yes |
104 \endtable
105
106 Example of the boundary condition specification:
107 \verbatim
108 <patchName>
109 {
110 type totalPressure;
111 p0 uniform 1e5;
112 }
113 \endverbatim
114
115See also
116 Foam::fixedValueFvPatchField
117
118SourceFiles
119 totalPressureFvPatchScalarField.C
120
121\*---------------------------------------------------------------------------*/
122
123#ifndef totalPressureFvPatchScalarField_H
124#define totalPressureFvPatchScalarField_H
125
127
128// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129
130namespace Foam
131{
132
133/*---------------------------------------------------------------------------*\
134 Class totalPressureFvPatchScalarField Declaration
135\*---------------------------------------------------------------------------*/
136
137class totalPressureFvPatchScalarField
138:
139 public fixedValueFvPatchScalarField
140{
141 // Private data
142
143 //- Name of the velocity field
144 word UName_;
145
146 //- Name of the flux transporting the field
147 word phiName_;
148
149 //- Name of the density field used to normalise the mass flux
150 //- if necessary
151 word rhoName_;
152
153 //- Name of the compressibility field used to calculate the wave speed
154 word psiName_;
155
156 //- Heat capacity ratio
157 scalar gamma_;
158
159 //- Total pressure
160 scalarField p0_;
161
162
163public:
164
165 //- Runtime type information
166 TypeName("totalPressure");
167
168
169 // Constructors
170
171 //- Construct from patch and internal field
173 (
174 const fvPatch&,
175 const DimensionedField<scalar, volMesh>&
176 );
177
178 //- Construct from patch, internal field and dictionary
180 (
181 const fvPatch&,
182 const DimensionedField<scalar, volMesh>&,
183 const dictionary&
184 );
185
186 //- Construct by mapping given totalPressureFvPatchScalarField
187 // onto a new patch
189 (
190 const totalPressureFvPatchScalarField&,
191 const fvPatch&,
192 const DimensionedField<scalar, volMesh>&,
193 const fvPatchFieldMapper&
194 );
195
196 //- Construct as copy
198 (
199 const totalPressureFvPatchScalarField&
200 );
201
202 //- Construct and return a clone
203 virtual tmp<fvPatchScalarField> clone() const
204 {
205 return tmp<fvPatchScalarField>
206 (
208 );
209 }
210
211 //- Construct as copy setting internal field reference
213 (
214 const totalPressureFvPatchScalarField&,
215 const DimensionedField<scalar, volMesh>&
216 );
217
218 //- Construct and return a clone setting internal field reference
219 virtual tmp<fvPatchScalarField> clone
220 (
221 const DimensionedField<scalar, volMesh>& iF
222 ) const
223 {
224 return tmp<fvPatchScalarField>
225 (
227 );
228 }
229
230
231 // Member functions
232
233 // Access
234
235 //- Return the name of the velocity field
236 const word& UName() const
237 {
238 return UName_;
239 }
240
241 //- Return reference to the name of the velocity field
242 // to allow adjustment
243 word& UName()
244 {
245 return UName_;
246 }
247
248 //- Return the name of the flux field
249 const word& phiName() const
250 {
251 return phiName_;
252 }
253
254 //- Return reference to the name of the flux field
255 // to allow adjustment
257 {
258 return phiName_;
259 }
260
261 //- Return the name of the density field
262 const word& rhoName() const
263 {
264 return rhoName_;
265 }
266
267 //- Return reference to the name of the density field
268 // to allow adjustment
269 word& rhoName()
270 {
271 return rhoName_;
272 }
273
274 //- Return the name of the compressibility field
275 const word& psiName() const
276 {
277 return psiName_;
278 }
279
280 //- Return reference to the name of the compressibility field
281 // to allow adjustment
282 word& psiName()
283 {
284 return psiName_;
286
287 //- Return the heat capacity ratio
288 scalar gamma() const
289 {
290 return gamma_;
291 }
292
293 //- Return reference to the heat capacity ratio to allow adjustment
294 scalar& gamma()
295 {
296 return gamma_;
297 }
298
299 //- Return the total pressure
300 const scalarField& p0() const
301 {
302 return p0_;
303 }
304
305 //- Return reference to the total pressure to allow adjustment
306 scalarField& p0()
307 {
308 return p0_;
309 }
310
311
312 // Mapping functions
313
314 //- Map (and resize as needed) from self given a mapping object
315 virtual void autoMap
316 (
317 const fvPatchFieldMapper&
318 );
319
320 //- Reverse map the given fvPatchField onto this fvPatchField
321 virtual void rmap
323 const fvPatchScalarField&,
324 const labelList&
325 );
326
327
328 // Evaluation functions
329
330 //- Inherit updateCoeffs from fixedValueFvPatchScalarField
331 using fixedValueFvPatchScalarField::updateCoeffs;
332
333 //- Update the coefficients associated with the patch field
334 // using the given patch total pressure and velocity fields
335 virtual void updateCoeffs
336 (
337 const scalarField& p0p,
338 const vectorField& Up
339 );
340
341 //- Update the coefficients associated with the patch field
342 virtual void updateCoeffs();
343
344
345 //- Write
346 virtual void write(Ostream&) const;
347};
348
349
350// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
351
352} // End namespace Foam
353
354// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
356#endif
357
358// ************************************************************************* //
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 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
A class for managing temporary objects.
Definition: tmp.H:65
This boundary condition provides a total pressure condition. Four variants are possible:
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
const scalarField & p0() const
Return the total pressure.
scalar & gamma()
Return reference to the heat capacity ratio to allow adjustment.
const word & phiName() const
Return the name of the flux field.
const word & psiName() const
Return the name of the compressibility field.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
const word & rhoName() const
Return the name of the density field.
const word & UName() const
Return the name of the velocity field.
TypeName("totalPressure")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
totalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
scalar gamma() const
Return the heat capacity ratio.
scalarField & p0()
Return reference to the total pressure to allow adjustment.
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73