twoPhaseMixtureThermo.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) 2013-2021 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::twoPhaseMixtureThermo
26 
27 Description
28  Thermophysical properties class for a mixture of two rhoThermo including
29  interfaceProperties for VoF for use in compressibleInterFoam.
30 
31 SourceFiles
32  twoPhaseMixtureThermoI.H
33  twoPhaseMixtureThermo.C
34  twoPhaseMixtureThermoIO.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef twoPhaseMixtureThermo_H
39 #define twoPhaseMixtureThermo_H
40 
41 #include "rhoThermo.H"
42 #include "twoPhaseMixture.H"
43 #include "interfaceProperties.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class twoPhaseMixtureThermo Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public rhoThermo::composite,
57  public twoPhaseMixture,
58  public interfaceProperties
59 {
60  // Private Data
61 
62  //- Thermo-package of phase 1
63  autoPtr<rhoThermo> thermo1_;
64 
65  //- Thermo-package of phase 2
66  autoPtr<rhoThermo> thermo2_;
67 
68  //- Mass-fraction of phase 1
69  volScalarField Alpha1_;
70 
71  //- Mass-fraction of phase 2
72  volScalarField Alpha2_;
73 
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("twoPhaseMixtureThermo");
79 
80 
81  // Constructors
82 
83  //- Construct from components
85  (
86  const volVectorField& U,
87  const surfaceScalarField& phi
88  );
89 
90 
91  //- Destructor
92  virtual ~twoPhaseMixtureThermo();
93 
94 
95  // Member Functions
96 
97  //- Return the thermo for phase 1
98  const rhoThermo& thermo1() const
99  {
100  return thermo1_();
101  }
102 
103  //- Return the thermo for phase 2
104  const rhoThermo& thermo2() const
105  {
106  return thermo2_();
107  }
108 
109  //- Return the thermo for phase 1
110  rhoThermo& thermo1()
111  {
112  return thermo1_();
113  }
114 
115  //- Return the thermo for phase 2
116  rhoThermo& thermo2()
117  {
118  return thermo2_();
119  }
120 
121  //- Return the density of phase 1
122  const volScalarField& rho1() const
123  {
124  return thermo1_->rho();
125  }
126 
127  //- Return the density of phase 2
128  const volScalarField& rho2() const
129  {
130  return thermo2_->rho();
131  }
132 
133  //- Correct the thermodynamics of each phase
134  virtual void correctThermo();
135 
136  //- Update mixture properties
137  virtual void correct();
138 
139  //- Return the name of the thermo physics
140  virtual word thermoName() const;
141 
142  //- Return true if the equation of state is incompressible
143  // i.e. rho != f(p)
144  virtual bool incompressible() const;
145 
146  //- Return true if the equation of state is isochoric
147  // i.e. rho = const
148  virtual bool isochoric() const;
149 
150 
151  // Access to thermodynamic state variables
152 
153  //- Enthalpy/Internal energy [J/kg]
154  // Non-const access allowed for transport equations
155  virtual volScalarField& he()
156  {
158  return thermo1_->he();
159  }
160 
161  //- Enthalpy/Internal energy [J/kg]
162  virtual const volScalarField& he() const
163  {
165  return thermo1_->he();
166  }
167 
168  //- Enthalpy/Internal energy
169  // for given pressure and temperature [J/kg]
170  virtual tmp<volScalarField> he
171  (
172  const volScalarField& p,
173  const volScalarField& T
174  ) const;
175 
176  //- Enthalpy/Internal energy for cell-set [J/kg]
177  virtual tmp<scalarField> he
178  (
179  const scalarField& T,
180  const labelList& cells
181  ) const;
182 
183  //- Enthalpy/Internal energy for patch [J/kg]
184  virtual tmp<scalarField> he
185  (
186  const scalarField& T,
187  const label patchi
188  ) const;
189 
190  //- Sensible enthalpy [J/kg]
191  virtual tmp<volScalarField> hs() const;
192 
193  //- Sensible enthalpy
194  // for given pressure and temperature [J/kg]
195  virtual tmp<volScalarField> hs
196  (
197  const volScalarField& p,
198  const volScalarField& T
199  ) const;
200 
201  //- Sensible enthalpy for cell-set [J/kg]
202  virtual tmp<scalarField> hs
203  (
204  const scalarField& T,
205  const labelList& cells
206  ) const;
207 
208  //- Sensible enthalpy for patch [J/kg]
209  virtual tmp<scalarField> hs
210  (
211  const scalarField& T,
212  const label patchi
213  ) const;
214 
215  //- Absolute enthalpy [J/kg]
216  virtual tmp<volScalarField> ha() const;
217 
218  //- Absolute enthalpy
219  // for given pressure and temperature [J/kg]
220  virtual tmp<volScalarField> ha
221  (
222  const volScalarField& p,
223  const volScalarField& T
224  ) const;
225 
226  //- Absolute enthalpy for cell-set [J/kg]
227  virtual tmp<scalarField> ha
228  (
229  const scalarField& T,
230  const labelList& cells
231  ) const;
232 
233  //- Absolute enthalpy for patch [J/kg]
234  virtual tmp<scalarField> ha
235  (
236  const scalarField& T,
237  const label patchi
238  ) const;
239 
240  //- Enthalpy of formation [J/kg]
241  virtual tmp<volScalarField> hc() const;
242 
243  //- Temperature from enthalpy/internal energy
244  virtual tmp<volScalarField> THE
245  (
246  const volScalarField& h,
247  const volScalarField& p,
248  const volScalarField& T0 // starting temperature
249  ) const;
250 
251  //- Temperature from enthalpy/internal energy for cell-set
252  virtual tmp<scalarField> THE
253  (
254  const scalarField& h,
255  const scalarField& T0, // starting temperature
256  const labelList& cells
257  ) const;
258 
259  //- Temperature from enthalpy/internal energy for patch
260  virtual tmp<scalarField> THE
261  (
262  const scalarField& h,
263  const scalarField& T0, // starting temperature
264  const label patchi
265  ) const;
266 
267 
268  // Fields derived from thermodynamic state variables
269 
270  //- Heat capacity at constant pressure [J/kg/K]
271  virtual tmp<volScalarField> Cp() const;
272 
273  //- Heat capacity at constant pressure for patch [J/kg/K]
274  virtual tmp<scalarField> Cp
275  (
276  const scalarField& T,
277  const label patchi
278  ) const;
279 
280  //- Heat capacity at constant volume [J/kg/K]
281  virtual tmp<volScalarField> Cv() const;
282 
283  //- Heat capacity at constant volume for patch [J/kg/K]
284  virtual tmp<scalarField> Cv
285  (
286  const scalarField& T,
287  const label patchi
288  ) const;
289 
290  //- Gamma = Cp/Cv []
291  virtual tmp<volScalarField> gamma() const;
292 
293  //- Gamma = Cp/Cv for patch []
294  virtual tmp<scalarField> gamma
295  (
296  const scalarField& T,
297  const label patchi
298  ) const;
299 
300  //- Heat capacity at constant pressure/volume [J/kg/K]
301  virtual tmp<volScalarField> Cpv() const;
302 
303  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
304  virtual tmp<scalarField> Cpv
305  (
306  const scalarField& T,
307  const label patchi
308  ) const;
309 
310  //- Molecular weight [kg/kmol]
311  virtual tmp<volScalarField> W() const;
312 
313  //- Molecular weight for patch [kg/kmol]
314  virtual tmp<scalarField> W(const label patchi) const;
315 
316 
317  // Fields derived from transport state variables
318 
319  //- Kinematic viscosity of mixture [m^2/s]
320  virtual tmp<volScalarField> nu() const;
321 
322  //- Kinematic viscosity of mixture for patch [m^2/s]
323  virtual tmp<scalarField> nu(const label patchi) const;
324 
325  //- Thermal diffusivity for temperature of mixture [W/m/K]
326  virtual tmp<volScalarField> kappa() const;
327 
328  //- Thermal diffusivity of mixture for patch [W/m/K]
329  virtual tmp<scalarField> kappa
330  (
331  const label patchi
332  ) const;
333 
334  //- Thermal diffusivity for energy of mixture [kg/m/s]
335  virtual tmp<volScalarField> alphahe() const;
336 
337  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
338  virtual tmp<scalarField> alphahe(const label patchi) const;
339 
340  //- Effective thermal diffusivity of mixture [W/m/K]
342  (
343  const volScalarField& alphat
344  ) const;
345 
346  //- Effective thermal diffusivity of mixture for patch [W/m/K]
347  virtual tmp<scalarField> kappaEff
348  (
349  const scalarField& alphat,
350  const label patchi
351  ) const;
352 
353  //- Effective thermal diffusivity of mixture [W/m/K]
355  (
356  const volScalarField& alphat
357  ) const;
358 
359  //- Effective thermal diffusivity of mixture for patch [W/m/K]
360  virtual tmp<scalarField> alphaEff
361  (
362  const scalarField& alphat,
363  const label patchi
364  ) const;
365 
366 
367  // IO
368 
369  //- Read base transportProperties dictionary
370  virtual bool read();
371 };
372 
373 
374 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
375 
376 } // End namespace Foam
377 
378 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
379 
380 #endif
381 
382 // ************************************************************************* //
virtual tmp< volScalarField > Cp() const
Heat capacity at constant pressure [J/kg/K].
twoPhaseMixtureThermo(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual tmp< volScalarField > ha() const
Absolute enthalpy [J/kg].
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [W/m/K].
virtual tmp< volScalarField > hc() const
Enthalpy of formation [J/kg].
Thermophysical properties class for a mixture of two rhoThermo including interfaceProperties for VoF ...
virtual tmp< volScalarField > hs() const
Sensible enthalpy [J/kg].
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
virtual tmp< volScalarField > THE(const volScalarField &h, const volScalarField &p, const volScalarField &T0) const
Temperature from enthalpy/internal energy.
virtual void correctThermo()
Correct the thermodynamics of each phase.
virtual bool read()
Read base transportProperties dictionary.
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
const dimensionedScalar h
Planck constant.
virtual bool isochoric() const
Return true if the equation of state is isochoric.
virtual tmp< volScalarField > Cv() const
Heat capacity at constant volume [J/kg/K].
const cellShapeList & cells
A class for handling words, derived from string.
Definition: word.H:59
Contains the interface properties.
virtual const volScalarField & T() const
Temperature [K].
Definition: basicThermo.C:449
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
virtual ~twoPhaseMixtureThermo()
Destructor.
phi
Definition: correctPhi.H:3
const volScalarField & rho2() const
Return the density of phase 2.
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
virtual word thermoName() const
Return the name of the thermo physics.
label patchi
U
Definition: pEqn.H:72
virtual void correct()
Update mixture properties.
virtual bool incompressible() const
Return true if the equation of state is incompressible.
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [W/m/K].
virtual tmp< volScalarField > kappaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [W/m/K].
Base-class for fluid thermodynamic properties based on density.
Definition: rhoThermo.H:52
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
A two-phase mixture model.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
TypeName("twoPhaseMixtureThermo")
Runtime type information.
const rhoThermo & thermo2() const
Return the thermo for phase 2.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:370
virtual volScalarField & p()
Pressure [Pa].
Definition: fluidThermo.C:97
const rhoThermo & thermo1() const
Return the thermo for phase 1.
Namespace for OpenFOAM.
scalar T0
Definition: createFields.H:22
const volScalarField & rho1() const
Return the density of phase 1.