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) 2013-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::multiphaseSystem
28 
29 Description
30  Class which solves the volume fraction equations for two phases.
31 
32 SourceFiles
33  multiphaseSystem.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef multiphaseSystem_H
38 #define multiphaseSystem_H
39 
40 #include "phaseSystem.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward Declarations
48 class dragModel;
49 class virtualMassModel;
50 
51 /*---------------------------------------------------------------------------*\
52  Class multiphaseSystem Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class multiphaseSystem
56 :
57  public phaseSystem
58 {
59  // Private Typedefs
60 
61  typedef HashTable<scalar, phasePairKey, phasePairKey::hash>
62  cAlphaTable;
63 
64 
65  // Private Data
66 
67  //- The indexed phase-fraction field;
68  // E.g., 1 for water, 2 for air, 3 for oil, etc...
69  volScalarField alphas_;
70 
71  //-
72  cAlphaTable cAlphas_;
73 
74  //- Stabilisation for normalisation of the interface normal
75  const dimensionedScalar deltaN_;
76 
77 
78  // Private Member Functions
79 
80  void calcAlphas();
81 
82  void solveAlphas();
83 
84  tmp<surfaceVectorField> nHatfv
85  (
86  const volScalarField& alpha1,
87  const volScalarField& alpha2
88  ) const;
89 
90  tmp<surfaceScalarField> nHatf
91  (
92  const volScalarField& alpha1,
93  const volScalarField& alpha2
94  ) const;
95 
96  void correctContactAngle
97  (
98  const phaseModel& alpha1,
99  const phaseModel& alpha2,
100  surfaceVectorField::Boundary& nHatb
101  ) const;
102 
103  tmp<volScalarField> K
104  (
105  const phaseModel& alpha1,
106  const phaseModel& alpha2
107  ) const;
108 
109  //- Return the drag coefficient for phase pair
110  virtual tmp<volScalarField> Kd(const phasePairKey& key) const = 0;
111 
112  //- Return the virtual mass coefficient for phase pair
113  virtual tmp<volScalarField> Vm(const phasePairKey& key) const = 0;
114 
115 
116 protected:
117 
118  // Protected data
119 
120  //- Flag to indicate that returned lists of fields are "complete"; i.e.,
121  // that an absence of force is returned as a constructed list of zeros,
122  // rather than a null pointer
123  static const bool fillFields_ = false;
124 
125 
126 public:
127 
128  //- Runtime type information
129  TypeName("multiphaseSystem");
130 
131  // Declare runtime construction
132 
134  (
135  autoPtr,
137  dictionary,
138  (
139  const fvMesh& mesh
140  ),
141  (mesh)
142  );
143 
144 
145  // Constructors
146 
147  //- Construct from fvMesh
148  explicit multiphaseSystem(const fvMesh& mesh);
149 
150 
151  //- Destructor
152  virtual ~multiphaseSystem() = default;
153 
154 
155  // Selectors
156 
158  (
159  const fvMesh& mesh
160  );
161 
162 
163  // Member Functions
164 
165  using phaseSystem::sigma;
166  using phaseSystem::dmdts;
167 
168  //- Return the surface tension force
170 
171  //- Indicator of the proximity of the interface
172  // Field values are 1 near and 0 away for the interface.
174 
175  //- Solve for the phase fractions
176  virtual void solve();
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
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::multiphaseSystem::solve
void solve()
Solve for the mixture phase-fractions.
Definition: multiphaseSystem.C:821
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
Foam::phaseSystem::sigma
tmp< volScalarField > sigma(const phasePairKey &key) const
Return the surface tension coefficient for a pair.
Definition: phaseSystem.C:319
alpha2
const volScalarField & alpha2
Definition: setRegionFluidFields.H:9
Foam::dictionary::dictionary
dictionary()
Default construct, a top-level empty dictionary.
Definition: dictionary.C:75
Foam::glTF::key
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:108
Foam::multiphaseSystem
Incompressible multi-phase mixture with built in solution for the phase fractions with interface comp...
Definition: multiphaseSystem.H:65
Foam::multiphaseSystem::phase
const phaseModel & phase(const label i) const
Constant access phase model i.
Definition: multiphaseSystem.C:446
alpha1
const volScalarField & alpha1
Definition: setRegionFluidFields.H:8
Foam::multiphaseSystem::surfaceTension
tmp< surfaceScalarField > surfaceTension(const phaseModel &phase) const
Definition: multiphaseSystem.C:743
Foam::phaseSystem::dmdts
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
Definition: phaseSystem.C:351
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::multiphaseSystem::fillFields_
static const bool fillFields_
Flag to indicate that returned lists of fields are "complete"; i.e.,.
Definition: multiphaseSystem.H:122
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
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::New
static autoPtr< multiphaseSystem > New(const fvMesh &mesh)
Definition: multiphaseSystemNew.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::multiphaseSystem::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, multiphaseSystem, dictionary,(const fvMesh &mesh),(mesh))
Foam::multiphaseSystem::TypeName
TypeName("multiphaseSystem")
Runtime type information.
Foam::multiphaseSystem::multiphaseSystem
multiphaseSystem(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: multiphaseSystem.C:361