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 | Copyright (C) 2011-2014 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 transportModel so that it can be unsed in conjunction with
32  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 
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 transportModel
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
138 
139  const fvMesh& mesh_;
141  const surfaceScalarField& phi_;
142 
145 
147 
149  sigmaTable;
150 
153 
154  //- Stabilisation for normalisation of the interface normal
156 
157  //- Conversion factor for degrees into radians
158  static const scalar convertToRad;
159 
160 
161  // Private member functions
162 
163  void calcAlphas();
164 
165  void solveAlphas(const scalar cAlpha);
166 
168  (
169  const volScalarField& alpha1,
170  const volScalarField& alpha2
171  ) const;
172 
174  (
175  const volScalarField& alpha1,
176  const volScalarField& alpha2
177  ) const;
178 
180  (
181  const phase& alpha1,
182  const phase& alpha2,
184  ) const;
185 
186  tmp<volScalarField> K(const phase& alpha1, const phase& alpha2) const;
187 
188 
189 public:
190 
191  // Constructors
192 
193  //- Construct from components
195  (
196  const volVectorField& U,
197  const surfaceScalarField& phi
198  );
199 
200 
201  //- Destructor
202  virtual ~multiphaseMixture()
203  {}
204 
205 
206  // Member Functions
207 
208  //- Return the phases
209  const PtrDictionary<phase>& phases() const
210  {
211  return phases_;
212  }
213 
214  //- Return the velocity
215  const volVectorField& U() const
216  {
217  return U_;
218  }
219 
220  //- Return the volumetric flux
221  const surfaceScalarField& phi() const
222  {
223  return phi_;
224  }
225 
226  const surfaceScalarField& rhoPhi() const
227  {
228  return rhoPhi_;
229  }
230 
231  //- Return the mixture density
232  tmp<volScalarField> rho() const;
233 
234  //- Return the mixture density for patch
235  tmp<scalarField> rho(const label patchi) const;
236 
237  //- Return the dynamic laminar viscosity
238  tmp<volScalarField> mu() const;
239 
240  //- Return the dynamic laminar viscosity for patch
241  tmp<scalarField> mu(const label patchi) const;
242 
243  //- Return the face-interpolated dynamic laminar viscosity
245 
246  //- Return the kinematic laminar viscosity
247  tmp<volScalarField> nu() const;
248 
249  //- Return the laminar viscosity for patch
250  tmp<scalarField> nu(const label patchi) const;
251 
252  //- Return the face-interpolated dynamic laminar viscosity
254 
256 
257  //- Indicator of the proximity of the interface
258  // Field values are 1 near and 0 away for the interface.
260 
261  //- Solve for the mixture phase-fractions
262  void solve();
263 
264  //- Correct the mixture properties
265  void correct();
266 
267  //- Read base transportProperties dictionary
268  bool read();
269 };
270 
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 } // End namespace Foam
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #endif
279 
280 // ************************************************************************* //
Foam::multiphaseMixture::rhoPhi
const surfaceScalarField & rhoPhi() const
Definition: multiphaseMixture.H:225
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::multiphaseMixture::convertToRad
static const scalar convertToRad
Conversion factor for degrees into radians.
Definition: multiphaseMixture.H:157
Foam::multiphaseMixture::calcAlphas
void calcAlphas()
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::multiphaseMixture::interfacePair::interfacePair
interfacePair()
Definition: multiphaseMixture.H:91
Foam::multiphaseMixture::sigmaTable
HashTable< scalar, interfacePair, interfacePair::hash > sigmaTable
Definition: multiphaseMixture.H:148
Foam::multiphaseMixture::dimSigma_
dimensionSet dimSigma_
Definition: multiphaseMixture.H:151
Foam::phase
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:52
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::multiphaseMixture::K
tmp< volScalarField > K(const phase &alpha1, const phase &alpha2) const
Foam::PtrDictionary
Template dictionary class which manages the storage associated with it.
Definition: PtrDictionary.H:53
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:60
Foam::Pair::first
const Type & first() const
Return first.
Definition: Pair.H:87
Foam::multiphaseMixture::nu
tmp< volScalarField > nu() const
Return the kinematic laminar viscosity.
surfaceFields.H
Foam::surfaceFields.
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:116
Foam::multiphaseMixture::phi_
const surfaceScalarField & phi_
Definition: multiphaseMixture.H:140
Foam::multiphaseMixture::interfacePair
Definition: multiphaseMixture.H:67
Foam::multiphaseMixture::mesh_
const fvMesh & mesh_
Definition: multiphaseMixture.H:138
Foam::multiphaseMixture::U
const volVectorField & U() const
Return the velocity.
Definition: multiphaseMixture.H:214
Foam::multiphaseMixture::phi
const surfaceScalarField & phi() const
Return the volumetric flux.
Definition: multiphaseMixture.H:220
Foam::Hash
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
Definition: Hash.H:56
Foam::label
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
phase.H
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:28
Foam::multiphaseMixture::nuf
tmp< surfaceScalarField > nuf() const
Return the face-interpolated dynamic laminar viscosity.
Foam::multiphaseMixture::nHatfv
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Foam::multiphaseMixture::deltaN_
const dimensionedScalar deltaN_
Stabilisation for normalisation of the interface normal.
Definition: multiphaseMixture.H:154
Foam::multiphaseMixture::sigmas_
sigmaTable sigmas_
Definition: multiphaseMixture.H:150
Foam::multiphaseMixture::interfacePair::hash
Definition: multiphaseMixture.H:73
Foam::multiphaseMixture::surfaceTensionForce
tmp< surfaceScalarField > surfaceTensionForce() const
Foam::Pair::second
const Type & second() const
Return second.
Definition: Pair.H:99
Foam::multiphaseMixture::read
bool read()
Read base transportProperties dictionary.
transportModel.H
Foam::multiphaseMixture::U_
const volVectorField & U_
Definition: multiphaseMixture.H:139
alpha2
alpha2
Definition: alphaEqn.H:112
Foam::multiphaseMixture::phases
const PtrDictionary< phase > & phases() const
Return the phases.
Definition: multiphaseMixture.H:208
Foam::multiphaseMixture::solve
void solve()
Solve for the mixture phase-fractions.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::multiphaseMixture::~multiphaseMixture
virtual ~multiphaseMixture()
Destructor.
Definition: multiphaseMixture.H:201
Foam::multiphaseMixture::rho
tmp< volScalarField > rho() const
Return the mixture density.
alpha1
volScalarField & alpha1
Definition: createFields.H:15
Foam::multiphaseMixture::interfacePair::hash::hash
hash()
Definition: multiphaseMixture.H:79
Foam::transportModel
Base-class for all transport models used by the incompressible turbulence models.
Definition: transportModel.H:51
Foam::HashTable< scalar, interfacePair, interfacePair::hash >
IOdictionary.H
Foam::string::hash
Hashing function class, shared by all the derived classes.
Definition: string.H:90
Foam::multiphaseMixture::mu
tmp< volScalarField > mu() const
Return the dynamic laminar viscosity.
Foam::IOdictionary::name
const word & name() const
Name function is needed to disambiguate those inherited.
Definition: IOdictionary.C:181
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
Foam::multiphaseMixture::solveAlphas
void solveAlphas(const scalar cAlpha)
patchi
label patchi
Definition: getPatchFieldScalar.H:1
Foam::multiphaseMixture::nearInterface
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::multiphaseMixture::nHatf
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Foam::multiphaseMixture::correctContactAngle
void correctContactAngle(const phase &alpha1, const phase &alpha2, surfaceVectorField::GeometricBoundaryField &nHatb) const
Foam::multiphaseMixture::interfacePair::interfacePair
interfacePair(const word &alpha1Name, const word &alpha2Name)
Definition: multiphaseMixture.H:94
Foam::multiphaseMixture::interfacePair::interfacePair
interfacePair(const phase &alpha1, const phase &alpha2)
Definition: multiphaseMixture.H:99
Foam::GeometricField::GeometricBoundaryField
Definition: GeometricField.H:105
Foam::multiphaseMixture::interfacePair::hash::operator()
label operator()(const interfacePair &key) const
Definition: multiphaseMixture.H:82
Foam::multiphaseMixture::rhoPhi_
surfaceScalarField rhoPhi_
Definition: multiphaseMixture.H:142
Foam::multiphaseMixture::nu_
volScalarField nu_
Definition: multiphaseMixture.H:145
Foam::multiphaseMixture::alphas_
volScalarField alphas_
Definition: multiphaseMixture.H:143
Foam::multiphaseMixture::phases_
PtrDictionary< phase > phases_
Dictionary of phases.
Definition: multiphaseMixture.H:136
Foam::multiphaseMixture::muf
tmp< surfaceScalarField > muf() const
Return the face-interpolated dynamic laminar viscosity.