totalPressureFvPatchScalarField.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) 2011-2020 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::totalPressureFvPatchScalarField
26 
27 Description
28  This boundary condition provides a total pressure condition. Four
29  variants are possible:
30 
31  1. incompressible subsonic:
32  \f[
33  p_p = p_0 - 0.5 |U|^2
34  \f]
35  where
36  \vartable
37  p_p | incompressible pressure at patch [m^2/s^2]
38  p_0 | incompressible total pressure [m^2/s^2]
39  U | velocity [m/s]
40  \endvartable
41 
42  2. compressible subsonic:
43  \f[
44  p_p = p_0 - 0.5 \rho |U|^2
45  \f]
46  where
47  \vartable
48  p_p | pressure at patch [Pa]
49  p_0 | total pressure [Pa]
50  \rho | density [kg/m^3]
51  U | velocity [m/s]
52  \endvartable
53 
54  3. compressible transonic (\f$\gamma = 1\f$):
55  \f[
56  p_p = \frac{p_0}{1 + 0.5 \psi |U|^2}
57  \f]
58  where
59  \vartable
60  p_p | pressure at patch [Pa]
61  p_0 | total pressure [Pa]
62  \psi | compressibility [m^2/s^2]
63  U | velocity [m/s]
64  \endvartable
65 
66  4. compressible supersonic (\f$\gamma > 1\f$):
67  \f[
68  p_p = \frac{p_0}{(1 + 0.5 \psi G |U|^2)^{\frac{1}{G}}}
69  \f]
70  where
71  \vartable
72  p_p | pressure at patch [Pa]
73  p_0 | total pressure [Pa]
74  \psi | compressibility [m^2/s^2]
75  G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$ []
76  \gamma | ratio of specific heats (Cp/Cv) []
77  U | velocity [m/s]
78  \endvartable
79 
80  The modes of operation are set by the dimensions of the pressure field
81  to which this boundary condition is applied, the \c psi entry and the value
82  of \c gamma:
83  \table
84  Mode | dimensions | psi | gamma
85  incompressible subsonic | p/rho | |
86  compressible subsonic | p | none |
87  compressible transonic | p | psi | 1
88  compressible supersonic | p | psi | > 1
89  \endtable
90 
91 Usage
92  \table
93  Property | Description | Required | Default value
94  U | Velocity field name | no | U
95  phi | Flux field name | no | phi
96  rho | Density field name | no | rho
97  psi | Compressibility field name | no | none
98  gamma | (Cp/Cv) | no | 1
99  p0 | Total pressure | yes |
100  \endtable
101 
102  Example of the boundary condition specification:
103  \verbatim
104  <patchName>
105  {
106  type totalPressure;
107  p0 uniform 1e5;
108  }
109  \endverbatim
110 
111 See also
112  Foam::dynamicPressureFvPatchScalarField
113  Foam::fixedValueFvPatchField
114 
115 SourceFiles
116  totalPressureFvPatchScalarField.C
117 
118 \*---------------------------------------------------------------------------*/
119 
120 #ifndef totalPressureFvPatchScalarField_H
121 #define totalPressureFvPatchScalarField_H
122 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 namespace Foam
128 {
129 
130 /*---------------------------------------------------------------------------*\
131  Class totalPressureFvPatchScalarField Declaration
132 \*---------------------------------------------------------------------------*/
133 
134 class totalPressureFvPatchScalarField
135 :
136  public dynamicPressureFvPatchScalarField
137 {
138 protected:
139 
140  // Protected Data
141 
142  //- Name of the velocity field
143  const word UName_;
144 
145  //- Name of the flux field
146  const word phiName_;
147 
148 
149 public:
150 
151  //- Runtime type information
152  TypeName("totalPressure");
153 
154 
155  // Constructors
156 
157  //- Construct from patch and internal field
159  (
160  const fvPatch&,
161  const DimensionedField<scalar, volMesh>&
162  );
163 
164  //- Construct from patch, internal field and dictionary
166  (
167  const fvPatch&,
168  const DimensionedField<scalar, volMesh>&,
169  const dictionary&
170  );
171 
172  //- Construct by mapping given totalPressureFvPatchScalarField
173  // onto a new patch
175  (
177  const fvPatch&,
178  const DimensionedField<scalar, volMesh>&,
179  const fvPatchFieldMapper&
180  );
181 
182  //- Copy constructor
184  (
186  );
187 
188  //- Construct and return a clone
189  virtual tmp<fvPatchScalarField> clone() const
190  {
191  return tmp<fvPatchScalarField>
192  (
194  );
195  }
196 
197  //- Copy constructor setting internal field reference
199  (
201  const DimensionedField<scalar, volMesh>&
202  );
203 
204  //- Construct and return a clone setting internal field reference
205  virtual tmp<fvPatchScalarField> clone
206  (
207  const DimensionedField<scalar, volMesh>& iF
208  ) const
209  {
210  return tmp<fvPatchScalarField>
211  (
212  new totalPressureFvPatchScalarField(*this, iF)
213  );
214  }
215 
216 
217  // Member Functions
218 
219  // Evaluation functions
220 
221  //- Update the coefficients associated with the patch field
222  // using the given patch total pressure and velocity fields
223  void updateCoeffs
224  (
225  const scalarField& p0p,
226  const vectorField& Up
227  );
228 
229  //- Update the coefficients associated with the patch field
230  virtual void updateCoeffs();
231 
232 
233  //- Write
234  virtual void write(Ostream&) const;
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void write(Ostream &) const
Write.
TypeName("totalPressure")
Runtime type information.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
totalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Field< vector > vectorField
Specialisation of Field<T> for vector.
const word UName_
Name of the velocity field.
Namespace for OpenFOAM.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.