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