twoPhaseMixtureThermo.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) 2013-2017 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::twoPhaseMixtureThermo
29 
30 Description
31 
32 SourceFiles
33  twoPhaseMixtureThermoI.H
34  twoPhaseMixtureThermo.C
35  twoPhaseMixtureThermoIO.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef twoPhaseMixtureThermo_H
40 #define twoPhaseMixtureThermo_H
41 
42 #include "rhoThermo.H"
43 #include "psiThermo.H"
44 #include "twoPhaseMixture.H"
45 #include "interfaceProperties.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class twoPhaseMixtureThermo Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public psiThermo,
59  public twoPhaseMixture,
60  public interfaceProperties
61 {
62  // Private data
63 
64  //- Thermo-package of phase 1
65  autoPtr<rhoThermo> thermo1_;
66 
67  //- Thermo-package of phase 2
68  autoPtr<rhoThermo> thermo2_;
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("twoPhaseMixtureThermo");
75 
76 
77  // Constructors
78 
79  //- Construct from components
81  (
82  const volVectorField& U,
83  const surfaceScalarField& phi
84  );
85 
86 
87  //- Destructor
88  virtual ~twoPhaseMixtureThermo();
89 
90 
91  // Member Functions
92 
93  const rhoThermo& thermo1() const
94  {
95  return *thermo1_;
96  }
97 
98  const rhoThermo& thermo2() const
99  {
100  return *thermo2_;
101  }
102 
103  rhoThermo& thermo1()
104  {
105  return *thermo1_;
106  }
107 
108  rhoThermo& thermo2()
109  {
110  return *thermo2_;
111  }
112 
113  //- Correct the thermodynamics of each phase
114  virtual void correctThermo();
115 
116  //- Update mixture properties
117  virtual void correct();
118 
119  //- Return the name of the thermo physics
120  virtual word thermoName() const;
121 
122  //- Return true if the equation of state is incompressible
123  // i.e. rho != f(p)
124  virtual bool incompressible() const;
125 
126  //- Return true if the equation of state is isochoric
127  // i.e. rho = const
128  virtual bool isochoric() const;
129 
130 
131  // Access to thermodynamic state variables
132 
133  //- Enthalpy/Internal energy [J/kg]
134  // Non-const access allowed for transport equations
135  virtual volScalarField& he()
136  {
138  return thermo1_->he();
139  }
140 
141  //- Enthalpy/Internal energy [J/kg]
142  virtual const volScalarField& he() const
143  {
145  return thermo1_->he();
146  }
147 
148  //- Enthalpy/Internal energy
149  // for given pressure and temperature [J/kg]
150  virtual tmp<volScalarField> he
151  (
152  const volScalarField& p,
153  const volScalarField& T
154  ) const;
155 
156  //- Enthalpy/Internal energy for cell-set [J/kg]
157  virtual tmp<scalarField> he
158  (
159  const scalarField& p,
160  const scalarField& T,
161  const labelList& cells
162  ) const;
163 
164  //- Enthalpy/Internal energy for patch [J/kg]
165  virtual tmp<scalarField> he
166  (
167  const scalarField& p,
168  const scalarField& T,
169  const label patchi
170  ) const;
171 
172  //- Chemical enthalpy [J/kg]
173  virtual tmp<volScalarField> hc() const;
174 
175  //- Temperature from enthalpy/internal energy for cell-set
176  virtual tmp<scalarField> THE
177  (
178  const scalarField& h,
179  const scalarField& p,
180  const scalarField& T0, // starting temperature
181  const labelList& cells
182  ) const;
183 
184  //- Temperature from enthalpy/internal energy for patch
185  virtual tmp<scalarField> THE
186  (
187  const scalarField& h,
188  const scalarField& p,
189  const scalarField& T0, // starting temperature
190  const label patchi
191  ) const;
192 
193 
194  // Fields derived from thermodynamic state variables
195 
196  //- Heat capacity at constant pressure [J/kg/K]
197  virtual tmp<volScalarField> Cp() const;
198 
199  //- Heat capacity at constant pressure for patch [J/kg/K]
200  virtual tmp<scalarField> Cp
201  (
202  const scalarField& p,
203  const scalarField& T,
204  const label patchi
205  ) const;
206 
207  //- Heat capacity using pressure and temperature
209  (
210  const scalarField& p,
211  const scalarField& T,
212  const labelList& cells
213  ) const
214  {
216  return tmp<scalarField>::New(p);
217  }
218 
219  //- Heat capacity at constant volume [J/kg/K]
220  virtual tmp<volScalarField> Cv() const;
221 
222  //- Heat capacity at constant volume for patch [J/kg/K]
223  virtual tmp<scalarField> Cv
224  (
225  const scalarField& p,
226  const scalarField& T,
227  const label patchi
228  ) const;
229 
230  //- Density from pressure and temperature
232  (
233  const scalarField& p,
234  const scalarField& T,
235  const labelList& cells
236  ) const
237  {
239  return tmp<scalarField>::New(p);
240  }
241 
242  //- Gamma = Cp/Cv []
243  virtual tmp<volScalarField> gamma() const;
244 
245  //- Gamma = Cp/Cv for patch []
246  virtual tmp<scalarField> gamma
247  (
248  const scalarField& p,
249  const scalarField& T,
250  const label patchi
251  ) const;
252 
253  //- Heat capacity at constant pressure/volume [J/kg/K]
254  virtual tmp<volScalarField> Cpv() const;
255 
256  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
257  virtual tmp<scalarField> Cpv
258  (
259  const scalarField& p,
260  const scalarField& T,
261  const label patchi
262  ) const;
263 
264  //- Heat capacity ratio []
265  virtual tmp<volScalarField> CpByCpv() const;
266 
267  //- Heat capacity ratio for patch []
268  virtual tmp<scalarField> CpByCpv
269  (
270  const scalarField& p,
271  const scalarField& T,
272  const label patchi
273  ) const;
274 
275  //- Molecular weight [kg/kmol]
276  virtual tmp<volScalarField> W() const;
277 
278 
279  // Fields derived from transport state variables
280 
281  //- Kinematic viscosity of mixture [m^2/s]
282  virtual tmp<volScalarField> nu() const;
283 
284  //- Kinematic viscosity of mixture for patch [m^2/s]
285  virtual tmp<scalarField> nu(const label patchi) const;
286 
287  //- Thermal diffusivity for temperature of mixture [J/m/s/K]
288  virtual tmp<volScalarField> kappa() const;
289 
290  //- Thermal diffusivity of mixture for patch [J/m/s/K]
291  virtual tmp<scalarField> kappa
292  (
293  const label patchi
294  ) const;
295 
296 
297  //- Thermal diffusivity for energy of mixture [kg/m/s]
298  virtual tmp<volScalarField> alphahe() const;
299 
300  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
301  virtual tmp<scalarField> alphahe(const label patchi) const;
302 
303  //- Effective thermal diffusivity of mixture [J/m/s/K]
305  (
306  const volScalarField& alphat
307  ) const;
308 
309  //- Effective thermal diffusivity of mixture for patch [J/m/s/K]
310  virtual tmp<scalarField> kappaEff
311  (
312  const scalarField& alphat,
313  const label patchi
314  ) const;
315 
316  //- Effective thermal diffusivity of mixture [J/m/s/K]
318  (
319  const volScalarField& alphat
320  ) const;
321 
322  //- Effective thermal diffusivity of mixture for patch [J/m/s/K]
323  virtual tmp<scalarField> alphaEff
324  (
325  const scalarField& alphat,
326  const label patchi
327  ) const;
328 
329 
330  // IO
331 
332  //- Read base transportProperties dictionary
333  virtual bool read();
334 };
335 
336 
337 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
338 
339 } // End namespace Foam
340 
341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
342 
343 #endif
344 
345 // ************************************************************************* //
Foam::twoPhaseMixtureThermo::alphahe
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Foam::twoPhaseMixtureThermo::read
virtual bool read()
Read base transportProperties dictionary.
Foam::twoPhaseMixtureThermo::kappaEff
virtual tmp< volScalarField > kappaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [J/m/s/K].
Foam::twoPhaseMixtureThermo::thermo2
const rhoThermo & thermo2() const
Definition: twoPhaseMixtureThermo.H:97
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::basicThermo::p
virtual volScalarField & p()
Pressure [Pa].
Definition: basicThermo.C:602
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::twoPhaseMixtureThermo::Cv
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
Foam::twoPhaseMixtureThermo::gamma
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
Foam::twoPhaseMixtureThermo::TypeName
TypeName("twoPhaseMixtureThermo")
Runtime type information.
Foam::twoPhaseMixtureThermo::isochoric
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Foam::twoPhaseMixtureThermo::Cp
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
Foam::interfaceProperties
Contains the interface properties.
Definition: interfaceProperties.H:57
Foam::twoPhaseMixtureThermo::CpByCpv
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
rhoThermo.H
Foam::twoPhaseMixtureThermo::thermo1
rhoThermo & thermo1()
Definition: twoPhaseMixtureThermo.H:102
Foam::rhoThermo
Basic thermodynamic properties based on density.
Definition: rhoThermo.H:55
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::twoPhaseMixtureThermo::hc
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
Foam::twoPhaseMixtureThermo::correctThermo
virtual void correctThermo()
Correct the thermodynamics of each phase.
Foam::twoPhaseMixtureThermo::he
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
Definition: twoPhaseMixtureThermo.H:134
Foam::twoPhaseMixtureThermo::thermo2
rhoThermo & thermo2()
Definition: twoPhaseMixtureThermo.H:107
Foam::Field< scalar >
Foam::constant::universal::h
const dimensionedScalar h
Planck constant.
Definition: setRegionSolidFields.H:33
Foam::twoPhaseMixture
A two-phase mixture model.
Definition: twoPhaseMixture.H:50
Foam::psiThermo
Basic thermodynamic properties based on compressibility.
Definition: psiThermo.H:55
Foam::twoPhaseMixtureThermo::incompressible
virtual bool incompressible() const
Return true if the equation of state is incompressible.
interfaceProperties.H
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::twoPhaseMixtureThermo::Cpv
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Foam::twoPhaseMixtureThermo::kappa
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Foam::twoPhaseMixtureThermo::thermoName
virtual word thermoName() const
Return the name of the thermo physics.
Foam::twoPhaseMixtureThermo::correct
virtual void correct()
Update mixture properties.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
Foam::twoPhaseMixtureThermo
Definition: twoPhaseMixtureThermo.H:55
psiThermo.H
Foam::twoPhaseMixtureThermo::thermo1
const rhoThermo & thermo1() const
Definition: twoPhaseMixtureThermo.H:92
Foam::basicThermo::T
virtual const volScalarField & T() const
Temperature [K].
Definition: basicThermo.C:614
Foam::twoPhaseMixtureThermo::rhoEoS
virtual tmp< scalarField > rhoEoS(const scalarField &p, const scalarField &T, const labelList &cells) const
Density from pressure and temperature.
Definition: twoPhaseMixtureThermo.H:231
Foam::twoPhaseMixtureThermo::THE
virtual tmp< scalarField > THE(const scalarField &h, const scalarField &p, const scalarField &T0, const labelList &cells) const
Temperature from enthalpy/internal energy for cell-set.
Foam::List< label >
Foam::twoPhaseMixtureThermo::W
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Foam::twoPhaseMixtureThermo::~twoPhaseMixtureThermo
virtual ~twoPhaseMixtureThermo()
Destructor.
Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
twoPhaseMixtureThermo(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::twoPhaseMixtureThermo::alphaEff
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [J/m/s/K].
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::GeometricField< vector, fvPatchField, volMesh >
T0
scalar T0
Definition: createFields.H:22
twoPhaseMixture.H
Foam::twoPhaseMixtureThermo::he
virtual const volScalarField & he() const
Enthalpy/Internal energy [J/kg].
Definition: twoPhaseMixtureThermo.H:141
Foam::twoPhaseMixtureThermo::nu
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].