incompressibleMultiphaseVoFMixture.C
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-2025 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 \*---------------------------------------------------------------------------*/
25 
27 #include "surfaceInterpolate.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34 }
35 
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const fvMesh& mesh
42 )
43 :
45 
46  phases_(multiphaseVoFMixture::phases().convert<incompressibleVoFphase>()),
47 
48  rho_
49  (
50  IOobject
51  (
52  "rho",
53  mesh.time().name(),
54  mesh,
55  IOobject::NO_READ,
56  IOobject::AUTO_WRITE
57  ),
58  mesh,
59  dimensionedScalar("rho", dimDensity, 0)
60  ),
61 
62  nu_
63  (
64  IOobject
65  (
66  "nu",
67  mesh.time().name(),
68  mesh
69  ),
70  mesh,
72  calculatedFvPatchScalarField::typeName
73  )
74 {
75  correct();
76 }
77 
78 
79 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
80 
82 {
83  forAll(phases_, phasei)
84  {
85  phases_[phasei].correct();
86  }
87 
88  rho_ = phases_[0]*phases_[0].rho();
89  volScalarField mu(rho_*phases_[0].nu());
90 
91  for (label phasei=1; phasei<phases_.size(); phasei++)
92  {
93  const volScalarField alphaRho(phases_[phasei]*phases_[phasei].rho());
94  rho_ += alphaRho;
95  mu += alphaRho*phases_[phasei].nu();
96  }
97 
98  // Update the mixture kinematic viscosity
99  nu_ = mu/rho_;
100 
101  calcAlphas();
102 }
103 
104 
106 {
107  if (regIOobject::read())
108  {
109  lookup("sigmas") >> sigmas_;
110  return true;
111  }
112  else
113  {
114  return false;
115  }
116 }
117 
118 
119 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Incompressible multiphase mixture for interface-capturing simulations.
virtual void correct()
Correct the mixture properties.
incompressibleMultiphaseVoFMixture(const fvMesh &mesh)
Construct from components.
virtual bool read()
Read base phaseProperties dictionary.
Single incompressible phase derived from the VoFphase.
Multiphase VoF mixture with support for interface properties.
virtual bool read()
Read object.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const dimensionedScalar mu
Atomic mass unit.
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
const dimensionSet dimKinematicViscosity
const dimensionSet dimDensity
defineTypeNameAndDebug(combustionModel, 0)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.