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-2020 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 the name of the thermo physics
117  virtual word thermoName() const;
118 
119  //- Return true if the equation of state is incompressible
120  // i.e. rho != f(p)
121  virtual bool incompressible() const;
122 
123  //- Return true if the equation of state is isochoric
124  // i.e. rho = const
125  virtual bool isochoric() const;
126 
127 
128  // Access to thermodynamic state variables
129 
130  //- Enthalpy/Internal energy [J/kg]
131  // Non-const access allowed for transport equations
132  virtual volScalarField& he()
133  {
135  return thermo1_->he();
136  }
137 
138  //- Enthalpy/Internal energy [J/kg]
139  virtual const volScalarField& he() const
140  {
142  return thermo1_->he();
143  }
144 
145  //- Enthalpy/Internal energy
146  // for given pressure and temperature [J/kg]
147  virtual tmp<volScalarField> he
148  (
149  const volScalarField& p,
150  const volScalarField& T
151  ) const;
152 
153  //- Enthalpy/Internal energy for cell-set [J/kg]
154  virtual tmp<scalarField> he
155  (
156  const scalarField& T,
157  const labelList& cells
158  ) const;
159 
160  //- Enthalpy/Internal energy for patch [J/kg]
161  virtual tmp<scalarField> he
162  (
163  const scalarField& T,
164  const label patchi
165  ) const;
166 
167  //- Sensible enthalpy [J/kg]
168  virtual tmp<volScalarField> hs() const;
169 
170  //- Sensible enthalpy
171  // for given pressure and temperature [J/kg]
172  virtual tmp<volScalarField> hs
173  (
174  const volScalarField& p,
175  const volScalarField& T
176  ) const;
177 
178  //- Sensible enthalpy for cell-set [J/kg]
179  virtual tmp<scalarField> hs
180  (
181  const scalarField& T,
182  const labelList& cells
183  ) const;
184 
185  //- Sensible enthalpy for patch [J/kg]
186  virtual tmp<scalarField> hs
187  (
188  const scalarField& T,
189  const label patchi
190  ) const;
191 
192  //- Absolute enthalpy [J/kg]
193  virtual tmp<volScalarField> ha() const;
194 
195  //- Absolute enthalpy
196  // for given pressure and temperature [J/kg]
197  virtual tmp<volScalarField> ha
198  (
199  const volScalarField& p,
200  const volScalarField& T
201  ) const;
202 
203  //- Absolute enthalpy for cell-set [J/kg]
204  virtual tmp<scalarField> ha
205  (
206  const scalarField& T,
207  const labelList& cells
208  ) const;
209 
210  //- Absolute enthalpy for patch [J/kg]
211  virtual tmp<scalarField> ha
212  (
213  const scalarField& T,
214  const label patchi
215  ) const;
216 
217  //- Enthalpy of formation [J/kg]
218  virtual tmp<volScalarField> hc() const;
219 
220  //- Temperature from enthalpy/internal energy for cell-set
221  virtual tmp<scalarField> THE
222  (
223  const scalarField& h,
224  const scalarField& T0, // starting temperature
225  const labelList& cells
226  ) const;
227 
228  //- Temperature from enthalpy/internal energy for patch
229  virtual tmp<scalarField> THE
230  (
231  const scalarField& h,
232  const scalarField& T0, // starting temperature
233  const label patchi
234  ) const;
235 
236 
237  // Fields derived from thermodynamic state variables
238 
239  //- Heat capacity at constant pressure [J/kg/K]
240  virtual tmp<volScalarField> Cp() const;
241 
242  //- Heat capacity at constant pressure for patch [J/kg/K]
243  virtual tmp<scalarField> Cp
244  (
245  const scalarField& T,
246  const label patchi
247  ) const;
248 
249  //- Heat capacity at constant volume [J/kg/K]
250  virtual tmp<volScalarField> Cv() const;
251 
252  //- Heat capacity at constant volume for patch [J/kg/K]
253  virtual tmp<scalarField> Cv
254  (
255  const scalarField& T,
256  const label patchi
257  ) const;
258 
259  //- Gamma = Cp/Cv []
260  virtual tmp<volScalarField> gamma() const;
261 
262  //- Gamma = Cp/Cv for patch []
263  virtual tmp<scalarField> gamma
264  (
265  const scalarField& T,
266  const label patchi
267  ) const;
268 
269  //- Heat capacity at constant pressure/volume [J/kg/K]
270  virtual tmp<volScalarField> Cpv() const;
271 
272  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
273  virtual tmp<scalarField> Cpv
274  (
275  const scalarField& T,
276  const label patchi
277  ) const;
278 
279  //- Heat capacity ratio []
280  virtual tmp<volScalarField> CpByCpv() const;
281 
282  //- Heat capacity ratio for patch []
283  virtual tmp<scalarField> CpByCpv
284  (
285  const scalarField& T,
286  const label patchi
287  ) const;
288 
289  //- Molecular weight [kg/kmol]
290  virtual tmp<volScalarField> W() const;
291 
292  //- Molecular weight for patch [kg/kmol]
293  virtual tmp<scalarField> W(const label patchi) const;
294 
295 
296  // Fields derived from transport state variables
297 
298  //- Kinematic viscosity of mixture [m^2/s]
299  virtual tmp<volScalarField> nu() const;
300 
301  //- Kinematic viscosity of mixture for patch [m^2/s]
302  virtual tmp<scalarField> nu(const label patchi) const;
303 
304  //- Thermal diffusivity for temperature of mixture [W/m/K]
305  virtual tmp<volScalarField> kappa() const;
306 
307  //- Thermal diffusivity of mixture for patch [W/m/K]
308  virtual tmp<scalarField> kappa
309  (
310  const label patchi
311  ) const;
312 
313  //- Thermal diffusivity for energy of mixture [kg/m/s]
314  virtual tmp<volScalarField> alphahe() const;
315 
316  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
317  virtual tmp<scalarField> alphahe(const label patchi) const;
318 
319  //- Effective thermal diffusivity of mixture [W/m/K]
321  (
322  const volScalarField& alphat
323  ) const;
324 
325  //- Effective thermal diffusivity of mixture for patch [W/m/K]
326  virtual tmp<scalarField> kappaEff
327  (
328  const scalarField& alphat,
329  const label patchi
330  ) const;
331 
332  //- Effective thermal diffusivity of mixture [W/m/K]
334  (
335  const volScalarField& alphat
336  ) const;
337 
338  //- Effective thermal diffusivity of mixture for patch [W/m/K]
339  virtual tmp<scalarField> alphaEff
340  (
341  const scalarField& alphat,
342  const label patchi
343  ) const;
344 
345 
346  // IO
347 
348  //- Read base transportProperties dictionary
349  virtual bool read();
350 };
351 
352 
353 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354 
355 } // End namespace Foam
356 
357 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358 
359 #endif
360 
361 // ************************************************************************* //
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].
virtual volScalarField & p()
Pressure [Pa].
Definition: fluidThermo.C:79
virtual tmp< volScalarField > hs() const
Sensible enthalpy [J/kg].
virtual const volScalarField & T() const
Temperature [K].
Definition: basicThermo.C:482
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
virtual void correctThermo()
Correct the thermodynamics of each phase.
virtual bool read()
Read base transportProperties dictionary.
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
phi
Definition: pEqn.H:104
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 tmp< volScalarField > W() const
Molecular weight [kg/kmol].
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].
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].
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.
const dimensionedScalar & h
Planck constant.
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
virtual tmp< scalarField > THE(const scalarField &h, const scalarField &T0, const labelList &cells) const
Temperature from enthalpy/internal energy for cell-set.
const rhoThermo & thermo1() const
Namespace for OpenFOAM.
scalar T0
Definition: createFields.H:22