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 unsed 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  //- Conversion factor for degrees into radians
194  static const scalar convertToRad;
195 
196 
197  // Private member functions
198 
199  void calcAlphas();
200 
201  void solveAlphas();
202 
204  (
205  const volScalarField& alpha1,
206  const volScalarField& alpha2
207  ) const;
208 
210  (
211  const volScalarField& alpha1,
212  const volScalarField& alpha2
213  ) const;
214 
215  void correctContactAngle
216  (
217  const phaseModel& alpha1,
218  const phaseModel& alpha2,
219  surfaceVectorField::Boundary& nHatb
220  ) const;
221 
223  (
224  const phaseModel& alpha1,
225  const phaseModel& alpha2
226  ) const;
227 
228 
229 public:
230 
231  // Constructors
232 
233  //- Construct from components
235  (
236  const volVectorField& U,
237  const surfaceScalarField& phi
238  );
239 
240 
241  //- Destructor
242  virtual ~multiphaseSystem() = default;
243 
244 
245  // Member Functions
246 
247  //- Return the phases
248  const PtrDictionary<phaseModel>& phases() const
249  {
250  return phases_;
251  }
252 
253  //- Return the phases
255  {
256  return phases_;
257  }
258 
259  //- Return the mixture density
260  tmp<volScalarField> rho() const;
261 
262  //- Return the mixture density for patch
263  tmp<scalarField> rho(const label patchi) const;
264 
265  //- Return the mixture laminar viscosity
266  tmp<volScalarField> nu() const;
267 
268  //- Return the laminar viscosity for patch
269  tmp<scalarField> nu(const label patchi) const;
270 
271  //- Return the virtual-mass coefficient for the given phase
272  tmp<volScalarField> Cvm(const phaseModel& phase) const;
273 
274  //- Return the virtual-mass source for the given phase
275  tmp<volVectorField> Svm(const phaseModel& phase) const;
276 
277  //- Return the table of drag models
278  const dragModelTable& dragModels() const
279  {
280  return dragModels_;
281  }
282 
283  //- Return the drag coefficients for all of the interfaces
285 
286  //- Return the sum of the drag coefficients for the given phase
288  (
289  const phaseModel& phase,
291  ) const;
292 
294 
295  //- Indicator of the proximity of the interface
296  // Field values are 1 near and 0 away for the interface.
298 
299  //- Solve for the mixture phase-fractions
300  void solve();
301 
302  //- Dummy correct
303  void correct()
304  {}
305 
306  //- Read base transportProperties dictionary
307  bool read();
308 };
309 
310 
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 
313 } // End namespace Foam
314 
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 
317 #endif
318 
319 // ************************************************************************* //
Foam::Pair::second
const T & second() const noexcept
Return second element, which is also the last element.
Definition: PairI.H:122
volFields.H
Foam::phaseModel
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:57
Foam::multiphaseSystem::rho
tmp< volScalarField > rho() const
Return the mixture density.
Foam::multiphaseSystem::nearInterface
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
Definition: multiphaseSystem.C:597
Foam::multiphaseSystem::~multiphaseSystem
virtual ~multiphaseSystem()
Destructor.
Definition: multiphaseSystem.C:545
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::multiphaseSystem::solve
virtual void solve()
Solve for the phase fractions.
Definition: multiphaseSystem.C:622
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:59
Foam::multiphaseSystem::phases_
UPtrList< phaseModel > phases_
Unallocated phase list.
Definition: multiphaseSystem.H:69
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::dragCoeffs
autoPtr< dragCoeffFields > dragCoeffs() const
Return the drag coefficients for all of the interfaces.
Foam::multiphaseSystem::multiphaseSystem
multiphaseSystem(const fvMesh &mesh)
Construct from fvMesh.
Definition: multiphaseSystem.C:507
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
Foam::phaseSystem::phi
const surfaceScalarField & phi() const
Return the mixture flux.
Definition: phaseSystemI.H:113
surfaceFields.H
Foam::surfaceFields.
Foam::phaseSystem::U
tmp< volVectorField > U() const
Return the mixture velocity.
Definition: phaseSystem.C:270
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:302
Foam::multiphaseSystem::surfaceTension
tmp< surfaceScalarField > surfaceTension(const phaseModel &phase) const
Return the surface tension force.
Definition: multiphaseSystem.C:552
Foam::baseIOdictionary::name
const word & name() const
Name function is needed to disambiguate those inherited.
Definition: baseIOdictionary.C:88
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::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:62
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::interfacePair::interfacePair
interfacePair()
Definition: multiphaseSystem.H:112
transportModel.H
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:43
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::multiphaseSystem::phases
PtrDictionary< phaseModel > & phases()
Return the phases.
Definition: multiphaseSystem.H:253
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
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:54
Foam::multiphaseSystem::read
virtual bool read()
Read thermophysical properties dictionary.
Foam::HashPtrTable< dragModel, interfacePair, interfacePair::symmHash >
HashPtrTable.H
Foam::multiphaseSystem::interfacePair::hash::hash
hash()
Definition: multiphaseSystem.H:100
Foam::multiphaseSystem::phases
const PtrDictionary< phaseModel > & phases() const
Return the phases.
Definition: multiphaseSystem.H:247
Foam::multiphaseSystem::interfacePair::symmHash::operator()
label operator()(const interfacePair &key) const
Definition: multiphaseSystem.H:88
Foam::multiphaseSystem::dragModels
const dragModelTable & dragModels() const
Return the table of drag models.
Definition: multiphaseSystem.H:277
Foam::multiphaseSystem::Cvm
tmp< volScalarField > Cvm(const phaseModel &phase) const
Return the virtual-mass coefficient for the given phase.
Foam::multiphaseSystem::dragCoeff
tmp< volScalarField > dragCoeff(const phaseModel &phase, const dragCoeffFields &dragCoeffs) const
Return the sum of the drag coefficients for the given phase.
Foam::GeometricField< scalar, fvsPatchField, surfaceMesh >
Foam::multiphaseSystem::interfacePair::symmHash
Definition: multiphaseSystem.H:79
Foam::multiphaseSystem::nu
tmp< volScalarField > nu() const
Return the mixture laminar viscosity.
Foam::multiphaseSystem::phases
const UPtrList< phaseModel > & phases() const
Return phases.
Foam::multiphaseSystem::Svm
tmp< volVectorField > Svm(const phaseModel &phase) const
Return the virtual-mass source for the given phase.