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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::twoPhaseMixtureThermo
28 
29 Description
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 "psiThermo.H"
43 #include "twoPhaseMixture.H"
44 #include "interfaceProperties.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class twoPhaseMixtureThermo Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public psiThermo,
58  public twoPhaseMixture,
59  public interfaceProperties
60 {
61  // Private data
62 
63  //- Thermo-package of phase 1
64  autoPtr<rhoThermo> thermo1_;
65 
66  //- Thermo-package of phase 2
67  autoPtr<rhoThermo> thermo2_;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("twoPhaseMixtureThermo");
74 
75 
76  // Constructors
77 
78  //- Construct from components
80  (
81  const volVectorField& U,
82  const surfaceScalarField& phi
83  );
84 
85 
86  //- Destructor
87  virtual ~twoPhaseMixtureThermo();
88 
89 
90  // Member Functions
91 
92  const rhoThermo& thermo1() const
93  {
94  return *thermo1_;
95  }
96 
97  const rhoThermo& thermo2() const
98  {
99  return *thermo2_;
100  }
101 
102  rhoThermo& thermo1()
103  {
104  return *thermo1_;
105  }
106 
107  rhoThermo& thermo2()
108  {
109  return *thermo2_;
110  }
111 
112  //- Correct the thermodynamics of each phase
113  virtual void correctThermo();
114 
115  //- Update mixture properties
116  virtual void correct();
117 
118  //- Return the name of the thermo physics
119  virtual word thermoName() const;
120 
121  //- Return true if the equation of state is incompressible
122  // i.e. rho != f(p)
123  virtual bool incompressible() const;
124 
125  //- Return true if the equation of state is isochoric
126  // i.e. rho = const
127  virtual bool isochoric() const;
128 
129 
130  // Access to thermodynamic state variables
131 
132  //- Enthalpy/Internal energy [J/kg]
133  // Non-const access allowed for transport equations
134  virtual volScalarField& he()
135  {
137  return thermo1_->he();
138  }
139 
140  //- Enthalpy/Internal energy [J/kg]
141  virtual const volScalarField& he() const
142  {
144  return thermo1_->he();
145  }
146 
147  //- Enthalpy/Internal energy
148  // for given pressure and temperature [J/kg]
149  virtual tmp<volScalarField> he
150  (
151  const volScalarField& p,
152  const volScalarField& T
153  ) const;
154 
155  //- Enthalpy/Internal energy for cell-set [J/kg]
156  virtual tmp<scalarField> he
157  (
158  const scalarField& p,
159  const scalarField& T,
160  const labelList& cells
161  ) const;
162 
163  //- Enthalpy/Internal energy for patch [J/kg]
164  virtual tmp<scalarField> he
165  (
166  const scalarField& p,
167  const scalarField& T,
168  const label patchi
169  ) const;
170 
171  //- Chemical enthalpy [J/kg]
172  virtual tmp<volScalarField> hc() const;
173 
174  //- Temperature from enthalpy/internal energy for cell-set
175  virtual tmp<scalarField> THE
176  (
177  const scalarField& h,
178  const scalarField& p,
179  const scalarField& T0, // starting temperature
180  const labelList& cells
181  ) const;
182 
183  //- Temperature from enthalpy/internal energy for patch
184  virtual tmp<scalarField> THE
185  (
186  const scalarField& h,
187  const scalarField& p,
188  const scalarField& T0, // starting temperature
189  const label patchi
190  ) const;
191 
192 
193  // Fields derived from thermodynamic state variables
194 
195  //- Heat capacity at constant pressure [J/kg/K]
196  virtual tmp<volScalarField> Cp() const;
197 
198  //- Heat capacity at constant pressure for patch [J/kg/K]
199  virtual tmp<scalarField> Cp
200  (
201  const scalarField& p,
202  const scalarField& T,
203  const label patchi
204  ) const;
205 
206  //- Heat capacity at constant volume [J/kg/K]
207  virtual tmp<volScalarField> Cv() const;
208 
209  //- Heat capacity at constant volume for patch [J/kg/K]
210  virtual tmp<scalarField> Cv
211  (
212  const scalarField& p,
213  const scalarField& T,
214  const label patchi
215  ) const;
216 
217  //- Gamma = Cp/Cv []
218  virtual tmp<volScalarField> gamma() const;
219 
220  //- Gamma = Cp/Cv for patch []
221  virtual tmp<scalarField> gamma
222  (
223  const scalarField& p,
224  const scalarField& T,
225  const label patchi
226  ) const;
227 
228  //- Heat capacity at constant pressure/volume [J/kg/K]
229  virtual tmp<volScalarField> Cpv() const;
230 
231  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
232  virtual tmp<scalarField> Cpv
233  (
234  const scalarField& p,
235  const scalarField& T,
236  const label patchi
237  ) const;
238 
239  //- Heat capacity ratio []
240  virtual tmp<volScalarField> CpByCpv() const;
241 
242  //- Heat capacity ratio for patch []
243  virtual tmp<scalarField> CpByCpv
244  (
245  const scalarField& p,
246  const scalarField& T,
247  const label patchi
248  ) const;
249 
250  //- Molecular weight [kg/kmol]
251  virtual tmp<volScalarField> W() const;
252 
253 
254  // Fields derived from transport state variables
255 
256  //- Kinematic viscosity of mixture [m^2/s]
257  virtual tmp<volScalarField> nu() const;
258 
259  //- Kinematic viscosity of mixture for patch [m^2/s]
260  virtual tmp<scalarField> nu(const label patchi) const;
261 
262  //- Thermal diffusivity for temperature of mixture [J/m/s/K]
263  virtual tmp<volScalarField> kappa() const;
264 
265  //- Thermal diffusivity of mixture for patch [J/m/s/K]
266  virtual tmp<scalarField> kappa
267  (
268  const label patchi
269  ) const;
270 
271 
272  //- Thermal diffusivity for energy of mixture [kg/m/s]
273  virtual tmp<volScalarField> alphahe() const;
274 
275  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
276  virtual tmp<scalarField> alphahe(const label patchi) const;
277 
278  //- Effective thermal diffusivity of mixture [J/m/s/K]
280  (
281  const volScalarField& alphat
282  ) const;
283 
284  //- Effective thermal diffusivity of mixture for patch [J/m/s/K]
285  virtual tmp<scalarField> kappaEff
286  (
287  const scalarField& alphat,
288  const label patchi
289  ) const;
290 
291  //- Effective thermal diffusivity of mixture [J/m/s/K]
293  (
294  const volScalarField& alphat
295  ) const;
296 
297  //- Effective thermal diffusivity of mixture for patch [J/m/s/K]
298  virtual tmp<scalarField> alphaEff
299  (
300  const scalarField& alphat,
301  const label patchi
302  ) const;
303 
304 
305  // IO
306 
307  //- Read base transportProperties dictionary
308  virtual bool read();
309 };
310 
311 
312 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 
314 } // End namespace Foam
315 
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 
318 #endif
319 
320 // ************************************************************************* //
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:96
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::basicThermo::p
virtual volScalarField & p()
Pressure [Pa].
Definition: basicThermo.C:512
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:101
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:445
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:133
Foam::twoPhaseMixtureThermo::thermo2
rhoThermo & thermo2()
Definition: twoPhaseMixtureThermo.H:106
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:54
psiThermo.H
Foam::twoPhaseMixtureThermo::thermo1
const rhoThermo & thermo1() const
Definition: twoPhaseMixtureThermo.H:91
Foam::basicThermo::T
virtual const volScalarField & T() const
Temperature [K].
Definition: basicThermo.C:524
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::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:140
Foam::twoPhaseMixtureThermo::nu
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].