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 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 (
40  const fvMesh& mesh
41 )
42 :
44 
46 
47  rho_
48  (
49  IOobject
50  (
51  "rho",
52  mesh.time().name(),
53  mesh,
54  IOobject::NO_READ,
55  IOobject::AUTO_WRITE
56  ),
57  mesh,
58  dimensionedScalar("rho", dimDensity, 0)
59  ),
60 
61  nu_
62  (
63  IOobject
64  (
65  "nu",
66  mesh.time().name(),
67  mesh
68  ),
69  mesh,
71  calculatedFvPatchScalarField::typeName
72  )
73 {
74  correct();
75 }
76 
77 
78 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
79 
81 {
82  forAll(phases_, phasei)
83  {
84  phases_[phasei].correct();
85  }
86 
87  rho_ = phases_[0]*phases_[0].rho();
88  volScalarField mu(rho_*phases_[0].nu());
89 
90  for (label phasei=1; phasei<phases_.size(); phasei++)
91  {
92  const volScalarField alphaRho(phases_[phasei]*phases_[phasei].rho());
93  rho_ += alphaRho;
94  mu += alphaRho*phases_[phasei].nu();
95  }
96 
97  // Update the mixture kinematic viscosity
98  nu_ = mu/rho_;
99 
100  calcAlphas();
101 }
102 
103 
105 {
107  {
108  bool result = true;
109 
110  forAll(phases_, phasei)
111  {
112  result = phases_[phasei].read() && result;
113  }
114 
115  return result;
116  }
117  else
118  {
119  return false;
120  }
121 }
122 
123 
124 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
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:98
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.
bool read()
Read base phaseProperties dictionary.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
rho
Definition: pEqn.H:1
const dimensionedScalar mu
Atomic mass unit.
const dimensionSet time
Namespace for OpenFOAM.
const dimensionSet & dimKinematicViscosity
Definition: dimensions.C:171
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 & dimDensity
Definition: dimensions.C:158
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
void convert(UList< Type > &l, const Args &... args)
Apply a conversion to a UList by applying to each element individually.
Definition: UList.H:421