multiphaseSystem.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  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::multiphaseSystem
29 
30 Description
31  Incompressible multi-phase mixture with built in solution for the
32  phase fractions with interface compression for interface-capturing.
33 
34  Derived from transportModel so that it can be unused in conjunction with
35  the incompressible turbulence models.
36 
37  Surface tension and contact-angle is handled for the interface
38  between each phase-pair.
39 
40 SourceFiles
41  multiphaseSystem.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef multiphaseSystem_H
46 #define multiphaseSystem_H
47 
49 #include "IOdictionary.H"
50 #include "phaseModel.H"
51 #include "PtrDictionary.H"
52 #include "volFields.H"
53 #include "surfaceFields.H"
54 #include "dragModel.H"
55 #include "HashPtrTable.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class multiphaseSystem Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class multiphaseSystem
67 :
68  public IOdictionary,
69  public transportModel
70 {
71 
72 public:
73 
74  class interfacePair
75  :
76  public Pair<word>
77  {
78  public:
79 
80  class symmHash
81  :
82  public Hash<interfacePair>
83  {
84  public:
85 
86  symmHash()
87  {}
88 
89  label operator()(const interfacePair& key) const
90  {
91  return word::hash()(key.first()) + word::hash()(key.second());
92  }
93  };
94 
95  class hash
96  :
97  public Hash<interfacePair>
98  {
99  public:
100 
101  hash()
102  {}
103 
104  label operator()(const interfacePair& key) const
105  {
106  return word::hash()(key.first(), word::hash()(key.second()));
107  }
108  };
109 
110 
111  // Constructors
112 
113  interfacePair()
114  {}
115 
116  interfacePair(const word& alpha1Name, const word& alpha2Name)
117  :
118  Pair<word>(alpha1Name, alpha2Name)
119  {}
120 
122  :
123  Pair<word>(alpha1.name(), alpha2.name())
124  {}
125 
126 
127  // Friend Operators
128 
129  friend bool operator==
130  (
131  const interfacePair& a,
132  const interfacePair& b
133  )
134  {
135  return
136  (
137  ((a.first() == b.first()) && (a.second() == b.second()))
138  || ((a.first() == b.second()) && (a.second() == b.first()))
139  );
140  }
141 
142  friend bool operator!=
143  (
144  const interfacePair& a,
145  const interfacePair& b
146  )
147  {
148  return (!(a == b));
149  }
150  };
151 
152 
155 
158 
159 
160 private:
161 
162  // Private data
163 
164  //- Dictionary of phases
166 
167  const fvMesh& mesh_;
168  const surfaceScalarField& phi_;
169 
170  volScalarField alphas_;
171 
174 
177 
178  scalarCoeffSymmTable sigmas_;
179  dimensionSet dimSigma_;
180 
181  scalarCoeffSymmTable cAlphas_;
182 
183  scalarCoeffTable Cvms_;
184 
187 
188  dragModelTable dragModels_;
189 
190  //- Stabilisation for normalisation of the interface normal
191  const dimensionedScalar deltaN_;
192 
193 
194  // Private member functions
195 
196  void calcAlphas();
197 
198  void solveAlphas();
199 
201  (
202  const volScalarField& alpha1,
203  const volScalarField& alpha2
204  ) const;
205 
207  (
208  const volScalarField& alpha1,
209  const volScalarField& alpha2
210  ) const;
211 
212  void correctContactAngle
213  (
214  const phaseModel& alpha1,
215  const phaseModel& alpha2,
216  surfaceVectorField::Boundary& nHatb
217  ) const;
218 
220  (
221  const phaseModel& alpha1,
222  const phaseModel& alpha2
223  ) const;
224 
225 
226 public:
227 
228  // Constructors
229 
230  //- Construct from components
232  (
233  const volVectorField& U,
234  const surfaceScalarField& phi
235  );
236 
237 
238  //- Destructor
239  virtual ~multiphaseSystem() = default;
240 
241 
242  // Member Functions
243 
244  //- Return the phases
245  const PtrDictionary<phaseModel>& phases() const
246  {
247  return phases_;
248  }
249 
250  //- Return the phases
252  {
253  return phases_;
254  }
255 
256  //- Return the mixture density
257  tmp<volScalarField> rho() const;
258 
259  //- Return the mixture density for patch
260  tmp<scalarField> rho(const label patchi) const;
261 
262  //- Return the mixture laminar viscosity
263  tmp<volScalarField> nu() const;
264 
265  //- Return the laminar viscosity for patch
266  tmp<scalarField> nu(const label patchi) const;
267 
268  //- Return the virtual-mass coefficient for the given phase
269  tmp<volScalarField> Cvm(const phaseModel& phase) const;
270 
271  //- Return the virtual-mass source for the given phase
272  tmp<volVectorField> Svm(const phaseModel& phase) const;
273 
274  //- Return the table of drag models
275  const dragModelTable& dragModels() const
276  {
277  return dragModels_;
278  }
279 
280  //- Return the drag coefficients for all of the interfaces
282 
283  //- Return the sum of the drag coefficients for the given phase
285  (
286  const phaseModel& phase,
288  ) const;
289 
291 
292  //- Indicator of the proximity of the interface
293  // Field values are 1 near and 0 away for the interface.
295 
296  //- Solve for the mixture phase-fractions
297  void solve();
298 
299  //- Dummy correct
300  void correct()
301  {}
302 
303  //- Read base transportProperties dictionary
304  bool read();
305 };
306 
307 
308 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309 
310 } // End namespace Foam
311 
312 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 
314 #endif
315 
316 // ************************************************************************* //
Foam::Pair::second
const T & second() const noexcept
Return second element, which is also the last element.
Definition: PairI.H:122
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::phaseModel
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:54
Foam::multiphaseSystem::nearInterface
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
Definition: multiphaseSystem.C:794
Foam::multiphaseSystem::~multiphaseSystem
virtual ~multiphaseSystem()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::multiphaseSystem::solve
void solve()
Solve for the mixture phase-fractions.
Definition: multiphaseSystem.C:821
Foam::multiphaseSystem::rho
tmp< volScalarField > rho() const
Return the mixture density.
Definition: multiphaseSystem.C:452
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::multiphaseSystem::interfacePair
Definition: multiphaseSystem.H:73
PtrDictionary.H
Foam::multiphaseSystem::interfacePair::symmHash::symmHash
symmHash()
Definition: multiphaseSystem.H:85
Foam::multiphaseSystem
Incompressible multi-phase mixture with built in solution for the phase fractions with interface comp...
Definition: multiphaseSystem.H:65
Foam::multiphaseSystem::interfacePair::interfacePair
interfacePair(const word &alpha1Name, const word &alpha2Name)
Definition: multiphaseSystem.H:115
Foam::multiphaseSystem::dragModelTable
HashPtrTable< dragModel, interfacePair, interfacePair::symmHash > dragModelTable
Definition: multiphaseSystem.H:153
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::multiphaseSystem::correct
void correct()
Dummy correct.
Definition: multiphaseSystem.H:299
Foam::multiphaseSystem::surfaceTension
tmp< surfaceScalarField > surfaceTension(const phaseModel &phase) const
Definition: multiphaseSystem.C:743
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:82
Foam::multiphaseSystem::interfacePair::interfacePair
interfacePair(const phaseModel &alpha1, const phaseModel &alpha2)
Definition: multiphaseSystem.H:120
Foam::multiphaseSystem::dragCoeffFields
HashPtrTable< volScalarField, interfacePair, interfacePair::symmHash > dragCoeffFields
Definition: multiphaseSystem.H:156
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
Foam::multiphaseSystem::interfacePair::hash
Definition: multiphaseSystem.H:94
Foam::Hash
Hash function class. The default definition is for primitives, non-primitives used to hash entries on...
Definition: Hash.H:55
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::multiphaseSystem::interfacePair::hash::operator()
label operator()(const interfacePair &key) const
Definition: multiphaseSystem.H:103
Foam::string::hash
Hashing function for string and derived string classes.
Definition: string.H:151
Foam::multiphaseSystem::dragCoeffs
autoPtr< dragCoeffFields > dragCoeffs() const
Return the drag coefficients for all of the interfaces.
Definition: multiphaseSystem.C:642
Foam::multiphaseSystem::interfacePair::interfacePair
interfacePair()
Definition: multiphaseSystem.H:112
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
transportModel.H
Foam::multiphaseSystem::read
bool read()
Read base transportProperties dictionary.
Definition: multiphaseSystem.C:916
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::multiphaseSystem::phases
const PtrDictionary< phaseModel > & phases() const
Return the phases.
Definition: multiphaseSystem.H:244
Foam::transportModel
Base-class for all transport models used by the incompressible turbulence models.
Definition: transportModel.H:53
Foam::HashTable< scalar, interfacePair, interfacePair::symmHash >
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:54
Foam::multiphaseSystem::phases
PtrDictionary< phaseModel > & phases()
Return the phases.
Definition: multiphaseSystem.H:250
Foam::HashPtrTable< dragModel, interfacePair, interfacePair::symmHash >
HashPtrTable.H
Foam::multiphaseSystem::interfacePair::hash::hash
hash()
Definition: multiphaseSystem.H:100
Foam::multiphaseSystem::interfacePair::symmHash::operator()
label operator()(const interfacePair &key) const
Definition: multiphaseSystem.H:88
Foam::multiphaseSystem::dragCoeff
tmp< volScalarField > dragCoeff(const phaseModel &phase, const dragCoeffFields &dragCoeffs) const
Return the sum of the drag coefficients for the given phase.
Definition: multiphaseSystem.C:694
Foam::multiphaseSystem::Svm
tmp< volVectorField > Svm(const phaseModel &phase) const
Return the virtual-mass source for the given phase.
Definition: multiphaseSystem.C:571
Foam::multiphaseSystem::dragModels
const dragModelTable & dragModels() const
Return the table of drag models.
Definition: multiphaseSystem.H:274
Foam::multiphaseSystem::nu
tmp< volScalarField > nu() const
Return the mixture laminar viscosity.
Definition: multiphaseSystem.C:485
Foam::multiphaseSystem::Cvm
tmp< volScalarField > Cvm(const phaseModel &phase) const
Return the virtual-mass coefficient for the given phase.
Definition: multiphaseSystem.C:523
Foam::GeometricField< scalar, fvsPatchField, surfaceMesh >
Foam::multiphaseSystem::interfacePair::symmHash
Definition: multiphaseSystem.H:79
Foam::multiphaseSystem::multiphaseSystem
multiphaseSystem(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: multiphaseSystem.C:361