compressibleTwoPhaseVoFMixture.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-2023 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::compressibleTwoPhaseVoFMixture
26 
27 Description
28  Class to represent a mixture of two rhoThermo-based phases
29 
30 SourceFiles
31  compressibleTwoPhaseVoFMixture.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef compressibleTwoPhaseVoFMixture_H
36 #define compressibleTwoPhaseVoFMixture_H
37 
38 #include "twoPhaseVoFMixture.H"
39 #include "compressibleTwoPhases.H"
40 #include "rhoThermo.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class compressibleTwoPhaseVoFMixture Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public twoPhaseVoFMixture,
54  virtual public compressibleTwoPhases,
55  public viscosity
56 {
57  // Private Data
58 
59  //- Switch to choose between solving for internal energy
60  // or total internal energy which is the default
61  Switch totalInternalEnergy_;
62 
63  //- Pressure
64  volScalarField p_;
65 
66  //- Mixture temperature
67  volScalarField T_;
68 
69  //- Thermo-package of phase 1
70  autoPtr<rhoThermo> thermo1_;
71 
72  //- Thermo-package of phase 2
73  autoPtr<rhoThermo> thermo2_;
74 
75  //- Mixture density
76  volScalarField rho_;
77 
78  //- Mass-fraction of phase 1
79  volScalarField Alpha1_;
80 
81  //- Mass-fraction of phase 2
82  volScalarField Alpha2_;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("compressibleTwoPhaseVoFMixture");
89 
90 
91  // Constructors
92 
93  //- Construct from a mesh
95 
96 
97  //- Destructor
99 
100 
101  // Member Functions
102 
103  //- Return true to solve for total internal energy
104  // return false to solve for internal energy
105  bool totalInternalEnergy() const
106  {
107  return totalInternalEnergy_;
108  }
109 
110  //- Return pressure [Pa]
111  volScalarField& p()
112  {
113  return p_;
114  }
115 
116  //- Return mixture temperature [K]
117  volScalarField& T()
118  {
119  return T_;
120  }
121 
122  //- Return mixture temperature [K]
123  const volScalarField& T() const
124  {
125  return T_;
126  }
127 
128  //- Return the thermo for phase 1
129  const rhoThermo& thermo1() const
130  {
131  return thermo1_();
132  }
133 
134  //- Return the thermo for phase 2
135  const rhoThermo& thermo2() const
136  {
137  return thermo2_();
138  }
139 
140  //- Return the thermo for phase 1
141  rhoThermo& thermo1()
142  {
143  return thermo1_();
144  }
145 
146  //- Return the thermo for phase 2
147  rhoThermo& thermo2()
148  {
149  return thermo2_();
150  }
151 
152  //- Return the density of phase 1
153  const volScalarField& rho1() const
154  {
155  return thermo1_->rho();
156  }
157 
158  //- Return the density of phase 2
159  const volScalarField& rho2() const
160  {
161  return thermo2_->rho();
162  }
163 
164  //- The fluid is incompressible if both phases are incompressible
165  bool incompressible() const
166  {
167  return
168  thermo1_->incompressible()
169  && thermo2_->incompressible();
170  }
171 
172  //- Return mixture density [kg/m^3]
173  virtual const volScalarField& rho() const
174  {
175  return rho_;
176  }
177 
178  //- Return the mixture compressibility/density
179  virtual tmp<volScalarField> psiByRho() const;
180 
181  //- Correct the thermodynamics of each phase
182  virtual void correctThermo();
183 
184  //- Update mixture properties
185  virtual void correct();
186 
187  //- Kinematic viscosity of mixture [m^2/s]
188  virtual tmp<volScalarField> nu() const;
189 
190  //- Kinematic viscosity of mixture for patch [m^2/s]
191  virtual tmp<scalarField> nu(const label patchi) const;
192 
193 
194  // IO
195 
196  //- Read base phaseProperties dictionary
197  virtual bool read();
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Generic GeometricField class.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Class to represent a mixture of two rhoThermo-based phases.
virtual void correctThermo()
Correct the thermodynamics of each phase.
virtual void correct()
Update mixture properties.
compressibleTwoPhaseVoFMixture(const fvMesh &mesh)
Construct from a mesh.
volScalarField & p()
Return pressure [Pa].
const rhoThermo & thermo1() const
Return the thermo for phase 1.
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
const rhoThermo & thermo2() const
Return the thermo for phase 2.
virtual tmp< volScalarField > psiByRho() const
Return the mixture compressibility/density.
virtual const volScalarField & rho() const
Return mixture density [kg/m^3].
volScalarField & T()
Return mixture temperature [K].
TypeName("compressibleTwoPhaseVoFMixture")
Runtime type information.
const volScalarField & rho1() const
Return the density of phase 1.
const volScalarField & rho2() const
Return the density of phase 2.
virtual bool read()
Read base phaseProperties dictionary.
bool totalInternalEnergy() const
Return true to solve for total internal energy.
bool incompressible() const
The fluid is incompressible if both phases are incompressible.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Base-class for fluid thermodynamic properties based on density.
Definition: rhoThermo.H:55
A class for managing temporary objects.
Definition: tmp.H:55
Class to represent a VoF mixture.
const fvMesh & mesh() const
Access the mesh.
Definition: twoPhases.H:71
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
label patchi
Namespace for OpenFOAM.
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