incompressibleDriftFluxMixture.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) 2014-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 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34 }
35 
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const fvMesh& mesh
42 )
43 :
44  twoPhaseVoFMixture(mesh),
45 
46  nucModel_(viscosityModel::New(mesh, phase2Name())),
47  muModel_(mixtureViscosityModel::New(*this)),
48 
49  rhod_("rho", dimDensity, muModel_()),
50  rhoc_("rho", dimDensity, nucModel_()),
51 
52  alphaMax_(lookupOrDefault("alphaMax", 1.0)),
53 
54  rho_
55  (
56  IOobject
57  (
58  "rho",
59  mesh.time().name(),
60  mesh,
61  IOobject::NO_READ,
62  IOobject::NO_WRITE
63  ),
64  mesh,
65  dimensionedScalar("rho", dimDensity, 0)
66  ),
67 
68  nu_
69  (
70  IOobject
71  (
72  "nu",
73  mesh.time().name(),
74  mesh
75  ),
76  mesh,
78  calculatedFvPatchScalarField::typeName
79  ),
80 
81  Uptr_(nullptr)
82 {}
83 
84 
85 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
86 
88 {
89  rho_ = alpha1()*rhod_ + alpha2()*rhoc_;
90  nu_ = muModel_->mu(rhoc_*nucModel_->nu(), *Uptr_)/rho_;
91 }
92 
93 
96 {
97  Uptr_ = &U;
98  correct();
99  return *this;
100 }
101 
102 
104 {
105  if (twoPhaseMixture::read())
106  {
107  if (muModel_->read() || nucModel_->read())
108  {
109  nucModel_->lookup("rho") >> rhoc_;
110  muModel_->lookup("rho") >> rhod_;
111 
112  alphaMax_ = muModel_->lookupOrDefault("alphaMax", 1.0);
113 
114  return true;
115  }
116  else
117  {
118  return false;
119  }
120  }
121  else
122  {
123  return false;
124  }
125 }
126 
127 
128 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
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:101
Class to represent a mixture of two constant density phases.
incompressibleDriftFluxMixture(const fvMesh &mesh)
Construct from a mesh.
virtual void correct()
Correct the density and mixture viscosity.
incompressibleDriftFluxMixture & initialise(const volVectorField &U)
Correct the laminar viscosity.
virtual bool read()
Read base phaseProperties dictionary.
An abstract base class for incompressible mixtureViscosityModels.
virtual bool read()=0
Read base phaseProperties dictionary.
Class to represent a VoF mixture.
An abstract base class for Newtonian viscosity models.
U
Definition: pEqn.H:72
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp, const SuType &Su)
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
Namespace for OpenFOAM.
const dimensionSet dimViscosity
const dimensionSet dimDensity
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47