incompressibleTwoPhaseVoFMixture.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) 2011-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 
45  nuModel1_(viscosityModel::New(mesh, phase1Name())),
46  nuModel2_(viscosityModel::New(mesh, phase2Name())),
47 
48  rho1_
49  (
50  IOobject
51  (
52  IOobject::groupName("rho", phase1Name()),
53  mesh.time().constant(),
54  mesh
55  ),
56  dimensionedScalar("rho", dimDensity, nuModel1_())
57  ),
58  rho2_
59  (
60  IOobject
61  (
62  IOobject::groupName("rho", phase2Name()),
63  mesh.time().constant(),
64  mesh
65  ),
66  dimensionedScalar("rho", dimDensity, nuModel2_())
67  ),
68 
69  rho_
70  (
71  IOobject
72  (
73  "rho",
74  mesh.time().name(),
75  mesh,
76  IOobject::NO_READ,
77  IOobject::AUTO_WRITE
78  ),
79  mesh,
80  dimensionedScalar("rho", dimDensity, 0)
81  ),
82 
83  nu_
84  (
85  IOobject
86  (
87  "nu",
88  mesh.time().name(),
89  mesh
90  ),
91  mesh,
93  calculatedFvPatchScalarField::typeName
94  )
95 {
96  correct();
97 }
98 
99 
100 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
101 
103 {
104  rho_ = alpha1()*rho1_ + alpha2()*rho2_;
105 
106  nuModel1_->correct();
107  nuModel2_->correct();
108 
109  const volScalarField limitedAlpha1
110  (
111  "limitedAlpha1",
112  min(max(alpha1(), scalar(0)), scalar(1))
113  );
114 
115  // Average kinematic viscosity calculated from dynamic viscosity
116  nu_ =
117  (
118  limitedAlpha1*rho1_*nuModel1_->nu()
119  + (scalar(1) - limitedAlpha1)*rho2_*nuModel2_->nu()
120  )/(limitedAlpha1*rho1_ + (scalar(1) - limitedAlpha1)*rho2_);
121 }
122 
123 
125 {
127  {
128  if (nuModel1_->read() && nuModel2_->read())
129  {
130  nuModel1_->lookup("rho") >> rho1_;
131  nuModel2_->lookup("rho") >> rho2_;
132 
133  return true;
134  }
135  else
136  {
137  return false;
138  }
139  }
140  else
141  {
142  return false;
143  }
144 }
145 
146 
147 // ************************************************************************* //
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
Class to represent a mixture of two constant density phases.
virtual void correct()
Correct the mixture density and laminar viscosity.
incompressibleTwoPhaseVoFMixture(const fvMesh &mesh)
Construct from a mesh.
virtual bool read()
Read base phaseProperties dictionary.
Class to represent a VoF mixture.
virtual bool read()=0
Read base phaseProperties dictionary.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
An abstract base class for Newtonian viscosity models.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const dimensionSet time
Namespace for OpenFOAM.
const dimensionSet & dimKinematicViscosity
Definition: dimensions.C:171
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
const dimensionSet & dimDensity
Definition: dimensions.C:158
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)