multiphaseMixture.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::multiphaseMixture
28 
29 Description
30  Incompressible multi-phase mixture with built in solution for the
31  phase fractions with interface compression for interface-capturing.
32 
33  Derived from transportModel so that it can be unused in conjunction with
34  the incompressible turbulence models.
35 
36  Surface tension and contact-angle is handled for the interface
37  between each phase-pair.
38 
39 SourceFiles
40  multiphaseMixture.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef multiphaseMixture_H
45 #define multiphaseMixture_H
46 
48 #include "IOdictionary.H"
49 #include "phase.H"
50 #include "PtrDictionary.H"
51 #include "volFields.H"
52 #include "surfaceFields.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class multiphaseMixture Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 :
65  public IOdictionary,
66  public transportModel
67 {
68 public:
69 
70  class interfacePair
71  :
72  public Pair<word>
73  {
74  public:
75 
76  struct hash
77  {
78  label operator()(const interfacePair& key) const
79  {
80  return word::hash()(key.first()) + word::hash()(key.second());
81  }
82  };
83 
84 
85  // Constructors
86 
87  interfacePair() {} // = default
88 
89  interfacePair(const word& alpha1Name, const word& alpha2Name)
90  :
91  Pair<word>(alpha1Name, alpha2Name)
92  {}
93 
94  interfacePair(const phase& alpha1, const phase& alpha2)
95  :
97  {}
98 
99 
100  // Friend Operators
101 
102  friend bool operator==
103  (
104  const interfacePair& a,
105  const interfacePair& b
106  )
107  {
108  return
109  (
110  ((a.first() == b.first()) && (a.second() == b.second()))
111  || ((a.first() == b.second()) && (a.second() == b.first()))
112  );
113  }
114 
115  friend bool operator!=
116  (
117  const interfacePair& a,
118  const interfacePair& b
119  )
120  {
121  return (!(a == b));
122  }
123  };
124 
125 
126 private:
127 
128  // Private data
129 
130  //- Dictionary of phases
131  PtrDictionary<phase> phases_;
132 
133  const fvMesh& mesh_;
134  const volVectorField& U_;
135  const surfaceScalarField& phi_;
136 
137  surfaceScalarField rhoPhi_;
138  volScalarField alphas_;
139 
140  volScalarField nu_;
141 
143  sigmaTable;
144 
145  sigmaTable sigmas_;
146  dimensionSet dimSigma_;
147 
148  //- Stabilisation for normalisation of the interface normal
149  const dimensionedScalar deltaN_;
150 
151 
152  // Private member functions
153 
154  void calcAlphas();
155 
156  void solveAlphas(const scalar cAlpha);
157 
159  (
160  const volScalarField& alpha1,
161  const volScalarField& alpha2
162  ) const;
163 
165  (
166  const volScalarField& alpha1,
167  const volScalarField& alpha2
168  ) const;
169 
170  void correctContactAngle
171  (
172  const phase& alpha1,
173  const phase& alpha2,
174  surfaceVectorField::Boundary& nHatb
175  ) const;
176 
177  tmp<volScalarField> K(const phase& alpha1, const phase& alpha2) const;
178 
179 
180 public:
181 
182  // Constructors
183 
184  //- Construct from components
186  (
187  const volVectorField& U,
188  const surfaceScalarField& phi
189  );
190 
191 
192  //- Destructor
193  virtual ~multiphaseMixture() = default;
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  }
215 
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 transportProperties dictionary
258  bool read();
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #endif
269 
270 // ************************************************************************* //
Foam::Pair::second
const T & second() const noexcept
Return second element, which is also the last element.
Definition: PairI.H:122
Foam::multiphaseMixture::rhoPhi
const surfaceScalarField & rhoPhi() const
Definition: multiphaseMixture.H:215
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::multiphaseMixture::interfacePair::interfacePair
interfacePair()
Definition: multiphaseMixture.H:86
Foam::phase
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:54
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
alpha2
const volScalarField & alpha2
Definition: setRegionFluidFields.H:9
Foam::PtrDictionary
Template dictionary class which manages the storage associated with it.
Definition: PtrDictionary.H:55
Foam::multiphaseMixture::multiphaseMixture
multiphaseMixture(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Foam::multiphaseMixture::correct
void correct()
Correct the mixture properties.
PtrDictionary.H
Foam::multiphaseMixture
Incompressible multi-phase mixture with built in solution for the phase fractions with interface comp...
Definition: multiphaseMixture.H:62
Foam::multiphaseMixture::nu
tmp< volScalarField > nu() const
Return the kinematic laminar viscosity.
surfaceFields.H
Foam::surfaceFields.
alpha1
const volScalarField & alpha1
Definition: setRegionFluidFields.H:8
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:82
Foam::multiphaseMixture::interfacePair
Definition: multiphaseMixture.H:69
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
Foam::multiphaseMixture::~multiphaseMixture
virtual ~multiphaseMixture()=default
Destructor.
Foam::multiphaseMixture::U
const volVectorField & U() const
Return the velocity.
Definition: multiphaseMixture.H:204
Foam::multiphaseMixture::phi
const surfaceScalarField & phi() const
Return the volumetric flux.
Definition: multiphaseMixture.H:210
phase.H
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::multiphaseMixture::nuf
tmp< surfaceScalarField > nuf() const
Return the face-interpolated dynamic laminar viscosity.
Foam::string::hash
Hashing function for string and derived string classes.
Definition: string.H:151
Foam::multiphaseMixture::surfaceTensionForce
tmp< surfaceScalarField > surfaceTensionForce() const
Foam::multiphaseMixture::read
bool read()
Read base transportProperties dictionary.
transportModel.H
Foam::multiphaseMixture::phases
const PtrDictionary< phase > & phases() const
Return the phases.
Definition: multiphaseMixture.H:198
Foam::multiphaseMixture::solve
void solve()
Solve for the mixture phase-fractions.
Foam::dimensioned< scalar >
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::multiphaseMixture::rho
tmp< volScalarField > rho() const
Return the mixture density.
Foam::transportModel
Base-class for all transport models used by the incompressible turbulence models.
Definition: transportModel.H:53
Foam::HashTable< scalar, interfacePair, interfacePair::hash >
IOdictionary.H
Foam::multiphaseMixture::mu
tmp< volScalarField > mu() const
Return the dynamic laminar viscosity.
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:54
Foam::multiphaseMixture::interfacePair::hash
Definition: multiphaseMixture.H:75
Foam::multiphaseMixture::nearInterface
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
Foam::multiphaseMixture::interfacePair::hash::operator()
label operator()(const interfacePair &key) const
Definition: multiphaseMixture.H:77
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::multiphaseMixture::interfacePair::interfacePair
interfacePair(const word &alpha1Name, const word &alpha2Name)
Definition: multiphaseMixture.H:88
Foam::multiphaseMixture::interfacePair::interfacePair
interfacePair(const phase &alpha1, const phase &alpha2)
Definition: multiphaseMixture.H:93
Foam::multiphaseMixture::muf
tmp< surfaceScalarField > muf() const
Return the face-interpolated dynamic laminar viscosity.