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-2025 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 rhoFluidThermo-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 "rhoFluidThermo.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<rhoFluidThermo> thermo1_;
71 
72  //- Thermo-package of phase 2
73  autoPtr<rhoFluidThermo> thermo2_;
74 
75  //- Mixture density
76  volScalarField rho_;
77 
78  //- Mixture viscosity
79  volScalarField nu_;
80 
81 
82 public:
83 
84  //- Runtime type information
85  TypeName("compressibleTwoPhaseVoFMixture");
86 
87 
88  // Constructors
89 
90  //- Construct from a mesh
92 
93 
94  //- Destructor
96 
97 
98  // Member Functions
99 
100  //- Return true to solve for total internal energy
101  // return false to solve for internal energy
102  bool totalInternalEnergy() const
103  {
104  return totalInternalEnergy_;
105  }
106 
107  //- Return pressure [Pa]
108  volScalarField& p()
109  {
110  return p_;
111  }
112 
113  //- Return mixture temperature [K]
114  volScalarField& T()
115  {
116  return T_;
117  }
118 
119  //- Return mixture temperature [K]
120  const volScalarField& T() const
121  {
122  return T_;
123  }
124 
125  //- Return the thermo for phase 1
126  const rhoFluidThermo& thermo1() const
127  {
128  return thermo1_();
129  }
130 
131  //- Return the thermo for phase 2
132  const rhoFluidThermo& thermo2() const
133  {
134  return thermo2_();
135  }
136 
137  //- Return the thermo for phase 1
139  {
140  return thermo1_();
141  }
142 
143  //- Return the thermo for phase 2
145  {
146  return thermo2_();
147  }
148 
149  //- Return the density of phase 1
150  const volScalarField& rho1() const
151  {
152  return thermo1_->rho();
153  }
154 
155  //- Return the density of phase 2
156  const volScalarField& rho2() const
157  {
158  return thermo2_->rho();
159  }
160 
161  //- The fluid is incompressible if both phases are incompressible
162  bool incompressible() const
163  {
164  return
165  thermo1_->incompressible()
166  && thermo2_->incompressible();
167  }
168 
169  //- Return mixture density [kg/m^3]
170  virtual const volScalarField& rho() const
171  {
172  return rho_;
173  }
174 
175  //- Return the mixture compressibility/density
176  virtual tmp<volScalarField> psiByRho() const;
177 
178  //- Correct the thermodynamics of each phase
179  virtual void correctThermo();
180 
181  //- Update mixture properties
182  virtual void correct();
183 
184  //- Kinematic viscosity of mixture [m^2/s]
185  virtual tmp<volScalarField> nu() const
186  {
187  return nu_;
188  }
189 
190  //- Kinematic viscosity of mixture for patch [m^2/s]
191  virtual tmp<scalarField> nu(const label patchi) const
192  {
193  return nu_.boundaryField()[patchi];
194  }
195 
196 
197  // IO
198 
199  //- Read base phaseProperties dictionary
200  virtual bool read();
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
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 rhoFluidThermo-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 rhoFluidThermo & thermo1() const
Return the thermo for phase 1.
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
virtual tmp< volScalarField > psiByRho() const
Return the mixture compressibility/density.
virtual const volScalarField & rho() const
Return mixture density [kg/m^3].
const rhoFluidThermo & thermo2() const
Return the thermo for phase 2.
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:96
Base-class for fluid thermodynamic properties based on density.
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