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