FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 
47 #include <OpenFOAM/PtrDictionary.H>
48 #include <finiteVolume/volFields.H>
51 
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class multiphaseMixture Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 :
64  public transportModel
65 {
66 public:
67 
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  //- The phase chosen as reference, the one which is derived from
140  // the others such thatr they sum to 1
141  phase& refPhase_;
142 
143  const fvMesh& mesh_;
144  const volVectorField& U_;
145  const surfaceScalarField& phi_;
146 
147  surfaceScalarField rhoPhi_;
148 
149  volScalarField alphas_;
150 
152  sigmaTable;
153 
154  sigmaTable sigmas_;
155  dimensionSet dimSigma_;
156 
157  //- Stabilisation for normalisation of the interface normal
158  const dimensionedScalar deltaN_;
159 
160  //- Conversion factor for degrees into radians
161  static const scalar convertToRad;
162 
163  //- Phase-fraction field table for multivariate discretisation
165 
166 
167  // Private member functions
168 
169  void calcAlphas();
170 
171  void solveAlphas
172  (
173  const label nAlphaCorr,
174  const bool cycleAlpha,
175  const scalar cAlpha
176  );
177 
179  (
180  const volScalarField& alpha1,
181  const volScalarField& alpha2
182  ) const;
183 
185  (
186  const volScalarField& alpha1,
187  const volScalarField& alpha2
188  ) const;
189 
190  void correctContactAngle
191  (
192  const phase& alpha1,
193  const phase& alpha2,
195  ) const;
196 
197  tmp<volScalarField> K(const phase& alpha1, const phase& alpha2) const;
198 
199 
200 public:
201 
202  // Constructors
203 
204  //- Construct from components
206  (
207  const volVectorField& U,
208  const surfaceScalarField& phi
209  );
210 
211 
212  // Destructor
213 
215  {}
216 
217 
218  // Member Functions
219 
220  //- Return the phases
222  {
223  return phases_;
224  }
225 
226  //- Return the velocity
227  const volVectorField& U() const
228  {
229  return U_;
230  }
231 
232  //- Return the volumetric flux
233  const surfaceScalarField& phi() const
234  {
235  return phi_;
236  }
237 
238  const surfaceScalarField& rhoPhi() const
239  {
240  return rhoPhi_;
241  }
242 
243  //- Return the mixture density
244  tmp<volScalarField> rho() const;
245 
246  //- Return the dynamic laminar viscosity
247  tmp<volScalarField> mu() const;
248 
249  //- Return the face-interpolated dynamic laminar viscosity
251 
252  //- Return the kinematic laminar viscosity
253  tmp<volScalarField> nu() const;
254 
255  //- Return the face-interpolated dynamic laminar viscosity
257 
259 
260  //- Indicator of the proximity of the interface
261  // Field values are 1 near and 0 away for the interface.
263 
264  //- Solve for the mixture phase-fractions
265  void solve();
266 
267  //- Correct the mixture properties
268  void correct();
269 
270  //- Read base transportProperties dictionary
271  bool read();
272 };
273 
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 } // End namespace Foam
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 #endif
282 
283 // ************************ vim: set sw=4 sts=4 et: ************************ //