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-2021 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 public:
72 
73  //- Name pair for the interface
74  class interfacePair
75  :
76  public Pair<word>
77  {
78  public:
79 
80  // Ordered hashing (alias)
81  using hash = Pair<word>::hasher;
82 
83  // Unordered hashing (alias)
85 
86 
87  // Constructors
88 
89  interfacePair() = default;
90 
91  interfacePair(const word& alpha1Name, const word& alpha2Name)
92  :
93  Pair<word>(alpha1Name, alpha2Name)
94  {}
95 
97  :
99  {}
100 
101 
102  // Friend Operators
103 
104  friend bool operator==
105  (
106  const interfacePair& a,
107  const interfacePair& b
108  )
109  {
110  return (0 != Pair<word>::compare(a, b));
111  }
112 
113  friend bool operator!=
114  (
115  const interfacePair& a,
116  const interfacePair& b
117  )
118  {
119  return (!(a == b));
120  }
121  };
122 
123 
126 
129 
130 
131 private:
132 
133  // Private data
134 
135  //- Dictionary of phases
137 
138  const fvMesh& mesh_;
139  const surfaceScalarField& phi_;
140 
141  volScalarField alphas_;
142 
145 
148 
149  scalarCoeffSymmTable sigmas_;
150  dimensionSet dimSigma_;
151 
152  scalarCoeffSymmTable cAlphas_;
153 
154  scalarCoeffTable Cvms_;
155 
158 
159  dragModelTable dragModels_;
160 
161  //- Stabilisation for normalisation of the interface normal
162  const dimensionedScalar deltaN_;
163 
164 
165  // Private member functions
166 
167  void calcAlphas();
168 
169  void solveAlphas();
170 
172  (
173  const volScalarField& alpha1,
174  const volScalarField& alpha2
175  ) const;
176 
178  (
179  const volScalarField& alpha1,
180  const volScalarField& alpha2
181  ) const;
182 
183  void correctContactAngle
184  (
185  const phaseModel& alpha1,
186  const phaseModel& alpha2,
187  surfaceVectorField::Boundary& nHatb
188  ) const;
189 
191  (
192  const phaseModel& alpha1,
193  const phaseModel& alpha2
194  ) const;
195 
196 
197 public:
198 
199  // Constructors
200 
201  //- Construct from components
203  (
204  const volVectorField& U,
205  const surfaceScalarField& phi
206  );
207 
208 
209  //- Destructor
210  virtual ~multiphaseSystem() = default;
211 
212 
213  // Member Functions
214 
215  //- Return the phases
216  const PtrDictionary<phaseModel>& phases() const
217  {
218  return phases_;
219  }
220 
221  //- Return the phases
223  {
224  return phases_;
225  }
226 
227  //- Return the mixture density
228  tmp<volScalarField> rho() const;
229 
230  //- Return the mixture density for patch
231  tmp<scalarField> rho(const label patchi) const;
232 
233  //- Return the mixture laminar viscosity
234  tmp<volScalarField> nu() const;
235 
236  //- Return the laminar viscosity for patch
237  tmp<scalarField> nu(const label patchi) const;
238 
239  //- Return the virtual-mass coefficient for the given phase
240  tmp<volScalarField> Cvm(const phaseModel& phase) const;
241 
242  //- Return the virtual-mass source for the given phase
243  tmp<volVectorField> Svm(const phaseModel& phase) const;
244 
245  //- Return the table of drag models
246  const dragModelTable& dragModels() const
247  {
248  return dragModels_;
249  }
250 
251  //- Return the drag coefficients for all of the interfaces
253 
254  //- Return the sum of the drag coefficients for the given phase
256  (
257  const phaseModel& phase,
259  ) const;
260 
262 
263  //- Indicator of the proximity of the interface
264  // Field values are 1 near and 0 away for the interface.
266 
267  //- Solve for the mixture phase-fractions
268  void solve();
269 
270  //- Dummy correct
271  void correct()
272  {}
273 
274  //- Read base transportProperties dictionary
275  bool read();
276 };
277 
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 } // End namespace Foam
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 #endif
286 
287 // ************************************************************************* //
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:65
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
Name pair for the interface.
Definition: multiphaseSystem.H:73
PtrDictionary.H
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:90
Foam::multiphaseSystem::dragModelTable
HashPtrTable< dragModel, interfacePair, interfacePair::symmHash > dragModelTable
Definition: multiphaseSystem.H:124
surfaceFields.H
Foam::surfaceFields.
alpha1
const volScalarField & alpha1
Definition: setRegionFluidFields.H:8
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
Foam::multiphaseSystem::correct
void correct()
Dummy correct.
Definition: multiphaseSystem.H:270
Foam::multiphaseSystem::surfaceTension
tmp< surfaceScalarField > surfaceTension(const phaseModel &phase) const
Definition: multiphaseSystem.C:743
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:85
Foam::multiphaseSystem::interfacePair::interfacePair
interfacePair(const phaseModel &alpha1, const phaseModel &alpha2)
Definition: multiphaseSystem.H:95
Foam::multiphaseSystem::dragCoeffFields
HashPtrTable< volScalarField, interfacePair, interfacePair::symmHash > dragCoeffFields
Definition: multiphaseSystem.H:127
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::multiphaseSystem::dragCoeffs
autoPtr< dragCoeffFields > dragCoeffs() const
Return the drag coefficients for all of the interfaces.
Definition: multiphaseSystem.C:642
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:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::multiphaseSystem::phases
const PtrDictionary< phaseModel > & phases() const
Return the phases.
Definition: multiphaseSystem.H:215
Foam::transportModel
Base-class for all transport models used by the incompressible turbulence models.
Definition: transportModel.H:53
Foam::HashTable< scalar, interfacePair, interfacePair::symmHash >
Foam::multiphaseSystem::interfacePair::hash
Pair< word >::hasher hash
Definition: multiphaseSystem.H:80
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::multiphaseSystem::interfacePair::symmHash
Pair< word >::symmHasher symmHash
Definition: multiphaseSystem.H:83
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:221
Foam::HashPtrTable< dragModel, interfacePair, interfacePair::symmHash >
Foam::multiphaseSystem::interfacePair::interfacePair
interfacePair()=default
HashPtrTable.H
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:245
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::multiphaseSystem
multiphaseSystem(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: multiphaseSystem.C:361