multiphaseMixture.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) 2011-2022 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::multiphaseMixture
26 
27 Description
28  Incompressible multi-phase mixture with built in solution for the
29  phase fractions with interface compression for interface-capturing.
30 
31  Derived from viscosity so that it can be used in conjunction
32  with the incompressible turbulence models.
33 
34  Surface tension and contact-angle is handled for the interface
35  between each phase-pair.
36 
37 SourceFiles
38  multiphaseMixture.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef multiphaseMixture_H
43 #define multiphaseMixture_H
44 
45 #include "viscosity.H"
46 #include "IOdictionary.H"
47 #include "phase.H"
48 #include "PtrDictionary.H"
49 #include "volFields.H"
50 #include "surfaceFields.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class multiphaseMixture Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
63  public IOdictionary,
64  public viscosity
65 {
66 public:
67 
68  class interfacePair
69  :
70  public Pair<word>
71  {
72  public:
73 
74  class hash
75  :
76  public Hash<interfacePair>
77  {
78  public:
79 
80  hash()
81  {}
82 
83  label operator()(const interfacePair& key) const
84  {
85  return word::hash()(key.first()) + word::hash()(key.second());
86  }
87  };
88 
89 
90  // Constructors
91 
93  {}
94 
95  interfacePair(const word& alpha1Name, const word& alpha2Name)
96  :
97  Pair<word>(alpha1Name, alpha2Name)
98  {}
99 
100  interfacePair(const phase& alpha1, const phase& alpha2)
101  :
102  Pair<word>(alpha1.name(), alpha2.name())
103  {}
104 
105 
106  // Friend Operators
107 
108  friend bool operator==
109  (
110  const interfacePair& a,
111  const interfacePair& b
112  )
113  {
114  return
115  (
116  ((a.first() == b.first()) && (a.second() == b.second()))
117  || ((a.first() == b.second()) && (a.second() == b.first()))
118  );
119  }
120 
121  friend bool operator!=
122  (
123  const interfacePair& a,
124  const interfacePair& b
125  )
126  {
127  return (!(a == b));
128  }
129  };
130 
131 
132 private:
133 
134  // Private Data
135 
136  //- Dictionary of phases
137  PtrDictionary<phase> phases_;
138 
139  const fvMesh& mesh_;
140  const volVectorField& U_;
141  const surfaceScalarField& phi_;
142 
143  surfaceScalarField rhoPhi_;
144  volScalarField alphas_;
145 
146  volScalarField nu_;
147 
149  sigmaTable;
150 
151  sigmaTable sigmas_;
152  dimensionSet dimSigma_;
153 
154  //- Stabilisation for normalisation of the interface normal
155  const dimensionedScalar deltaN_;
156 
157 
158  // Private Member Functions
159 
160  void calcAlphas();
161 
162  void solveAlphas(const scalar cAlpha);
163 
165  (
166  const volScalarField& alpha1,
167  const volScalarField& alpha2
168  ) const;
169 
171  (
172  const volScalarField& alpha1,
173  const volScalarField& alpha2
174  ) const;
175 
176  tmp<volScalarField> K(const phase& alpha1, const phase& alpha2) const;
177 
178 
179 public:
180 
181  // Constructors
182 
183  //- Construct from components
185  (
186  const volVectorField& U,
187  const surfaceScalarField& phi
188  );
189 
190 
191  //- Destructor
192  virtual ~multiphaseMixture()
193  {}
194 
195 
196  // Member Functions
197 
198  //- Return the phases
199  const PtrDictionary<phase>& phases() const
200  {
201  return phases_;
202  }
203 
204  //- Return the velocity
205  const volVectorField& U() const
206  {
207  return U_;
208  }
209 
210  //- Return the volumetric flux
211  const surfaceScalarField& phi() const
212  {
213  return phi_;
214  }
216  const surfaceScalarField& rhoPhi() const
217  {
218  return rhoPhi_;
219  }
220 
221  //- Return the mixture density
222  tmp<volScalarField> rho() const;
223 
224  //- Return the mixture density for patch
225  tmp<scalarField> rho(const label patchi) const;
226 
227  //- Return the dynamic laminar viscosity
228  tmp<volScalarField> mu() const;
229 
230  //- Return the dynamic laminar viscosity for patch
231  tmp<scalarField> mu(const label patchi) const;
232 
233  //- Return the face-interpolated dynamic laminar viscosity
235 
236  //- Return the kinematic laminar viscosity
237  tmp<volScalarField> nu() const;
238 
239  //- Return the laminar viscosity for patch
240  tmp<scalarField> nu(const label patchi) const;
241 
242  //- Return the face-interpolated dynamic laminar viscosity
244 
246 
247  //- Indicator of the proximity of the interface
248  // Field values are 1 near and 0 away for the interface.
250 
251  //- Solve for the mixture phase-fractions
252  void solve();
253 
254  //- Correct the mixture properties
255  void correct();
256 
257  //- Read base phaseProperties dictionary
258  bool read();
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #endif
269 
270 // ************************************************************************* //
Template dictionary class which manages the storage associated with it.
Definition: PtrDictionary.H:53
Foam::surfaceFields.
Hashing function class, shared by all the derived classes.
Definition: string.H:92
tmp< surfaceScalarField > muf() const
Return the face-interpolated dynamic laminar viscosity.
const surfaceScalarField & phi() const
Return the volumetric flux.
Incompressible multi-phase mixture with built in solution for the phase fractions with interface comp...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
Definition: createFields.H:27
volScalarField & alpha1(mixture.alpha1())
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
const PtrDictionary< phase > & phases() const
Return the phases.
virtual ~multiphaseMixture()
Destructor.
CGAL::Exact_predicates_exact_constructions_kernel K
multiphaseMixture(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
alpha2
Definition: alphaEqn.H:115
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
tmp< volScalarField > rho() const
Return the mixture density.
Dimension set for the base types.
Definition: dimensionSet.H:121
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:109
bool read()
Read base phaseProperties dictionary.
A class for handling words, derived from string.
Definition: word.H:59
void correct()
Correct the mixture properties.
tmp< volScalarField > nu() const
Return the kinematic laminar viscosity.
tmp< volScalarField > mu() const
Return the dynamic laminar viscosity.
Abstract base class for all fluid physical properties.
Definition: viscosity.H:49
void solve()
Solve for the mixture phase-fractions.
const Type & second() const
Return second.
Definition: Pair.H:110
tmp< surfaceScalarField > nuf() const
Return the face-interpolated dynamic laminar viscosity.
label patchi
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
Definition: Hash.H:52
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:52
const volVectorField & U() const
Return the velocity.
label operator()(const interfacePair &key) const
A class for managing temporary objects.
Definition: PtrList.H:53
const Type & first() const
Return first.
Definition: Pair.H:98
const surfaceScalarField & rhoPhi() const
Namespace for OpenFOAM.
tmp< surfaceScalarField > surfaceTensionForce() const