multiphaseVoFMixture.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 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::multiphaseVoFMixture
26 
27 Description
28  Multiphase VoF mixture with support for interface properties
29 
30  Surface tension and contact-angle is handled for the interface
31  between each phase-pair.
32 
33 SourceFiles
34  multiphaseVoFMixture.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef multiphaseVoFMixture_H
39 #define multiphaseVoFMixture_H
40 
41 #include "VoFMixture.H"
42 #include "IOdictionary.H"
43 #include "PtrListDictionary.H"
44 #include "VoFphase.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class multiphaseVoFMixture Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public VoFMixture,
58  public IOdictionary
59 {
60 public:
61 
62  class interfacePair
63  :
64  public Pair<word>
65  {
66  public:
67 
68  class hash
69  :
70  public Hash<interfacePair>
71  {
72  public:
73 
74  hash()
75  {}
76 
77  label operator()(const interfacePair& key) const
78  {
79  return word::hash()(key.first()) + word::hash()(key.second());
80  }
81  };
82 
83 
84  // Constructors
85 
87  {}
88 
89  interfacePair(const word& alpha1Name, const word& alpha2Name)
90  :
91  Pair<word>(alpha1Name, alpha2Name)
92  {}
93 
94  interfacePair(const VoFphase& alpha1, const VoFphase& alpha2)
95  :
96  Pair<word>(alpha1.name(), alpha2.name())
97  {}
98 
99 
100  // Friend Operators
101 
102  friend bool operator==
103  (
104  const interfacePair& a,
105  const interfacePair& b
106  )
107  {
108  return
109  (
110  ((a.first() == b.first()) && (a.second() == b.second()))
111  || ((a.first() == b.second()) && (a.second() == b.first()))
112  );
113  }
114 
115  friend bool operator!=
116  (
117  const interfacePair& a,
118  const interfacePair& b
119  )
120  {
121  return (!(a == b));
122  }
123  };
124 
125 
126 protected:
127 
128  // Protected Data
129 
130  //- Dictionary of phases
132 
133  const fvMesh& mesh_;
134 
136 
138  sigmaTable;
139 
142 
143  //- Stabilisation for normalisation of the interface normal
145 
146 
147  // Private Member Functions
148 
149  void calcAlphas();
150 
152  (
153  const volScalarField& alpha1,
154  const volScalarField& alpha2
155  ) const;
156 
158  (
159  const VoFphase& alpha1,
160  const VoFphase& alpha2,
161  const volVectorField& U
162  ) const;
163 
164 
165 public:
166 
167  TypeName("multiphaseVoFMixture");
168 
169 
170  // Constructors
171 
172  //- Construct from fvMesh
174  (
175  const fvMesh& mesh,
176  const VoFphase::iNew&
177  );
178 
179 
180  //- Destructor
181  virtual ~multiphaseVoFMixture()
182  {}
183 
184 
185  // Member Functions
186 
187  //- Return the phases
189  {
190  return phases_;
191  }
192 
194  (
195  const volScalarField& alpha1,
196  const volScalarField& alpha2
197  ) const;
198 
200  (
201  const volVectorField& U
202  ) const;
203 
204  //- Indicator of the proximity of the interface
205  // Field values are 1 near and 0 away for the interface.
207 
208  //- Read base phaseProperties dictionary
209  bool read();
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
Hashing function class.
Definition: FixedList.H:97
Generic GeometricField class.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:65
const Type & second() const
Return second.
Definition: Pair.H:110
const Type & first() const
Return first.
Definition: Pair.H:98
Template dictionary class which manages the storage associated with it.
Two-phase VoF mixture.
Definition: VoFMixture.H:52
Return a pointer to a new VoFphase.
Definition: VoFphase.H:77
Single incompressible VoFphase derived from the phase-fraction. Used as part of the multiPhaseMixture...
Definition: VoFphase.H:53
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
Dimension set for the base types.
Definition: dimensionSet.H:125
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
label operator()(const interfacePair &key) const
Multiphase VoF mixture with support for interface properties.
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
tmp< volScalarField > K(const VoFphase &alpha1, const VoFphase &alpha2, const volVectorField &U) const
tmp< surfaceScalarField > surfaceTensionForce(const volVectorField &U) const
const dimensionedScalar deltaN_
Stabilisation for normalisation of the interface normal.
HashTable< scalar, interfacePair, interfacePair::hash > sigmaTable
TypeName("multiphaseVoFMixture")
PtrListDictionary< VoFphase > & phases()
Return the phases.
virtual ~multiphaseVoFMixture()
Destructor.
PtrListDictionary< VoFphase > phases_
Dictionary of phases.
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
multiphaseVoFMixture(const fvMesh &mesh, const VoFphase::iNew &)
Construct from fvMesh.
bool read()
Read base phaseProperties dictionary.
Hashing function class, shared by all the derived classes.
Definition: string.H:93
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
volScalarField & b
Definition: createFields.H:25
U
Definition: pEqn.H:72
Namespace for OpenFOAM.
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