1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
27 \*---------------------------------------------------------------------------*/
29 #include "threePhaseMixture.H"
30 #include "addToRunTimeSelectionTable.H"
31 #include "surfaceFields.H"
34 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
36 //- Calculate and return the laminar viscosity
37 void Foam::threePhaseMixture::calcNu()
39 // Average kinematic viscosity calculated from dynamic viscosity
40 nu_ = mu()/(alpha1_*rho1_ + alpha2_*rho2_ + alpha3_*rho3_);
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 Foam::threePhaseMixture::threePhaseMixture
48 const volVectorField& U,
49 const surfaceScalarField& phi
52 transportModel(U, phi),
54 phase1Name_("phase1"),
55 phase2Name_("phase2"),
56 phase3Name_("phase3"),
89 rho1_(nuModel1_->viscosityProperties().lookup("rho")),
90 rho2_(nuModel2_->viscosityProperties().lookup("rho")),
91 rho3_(nuModel3_->viscosityProperties().lookup("rho")),
96 alpha1_(U_.db().lookupObject<const volScalarField> ("alpha1")),
97 alpha2_(U_.db().lookupObject<const volScalarField> ("alpha2")),
98 alpha3_(U_.db().lookupObject<const volScalarField> ("alpha3")),
105 U_.time().timeName(),
109 dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0),
110 calculatedFvPatchScalarField::typeName
117 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
119 Foam::tmp<Foam::volScalarField> Foam::threePhaseMixture::mu() const
121 return tmp<volScalarField>
126 alpha1_*rho1_*nuModel1_->nu()
127 + alpha2_*rho2_*nuModel2_->nu()
128 + alpha3_*rho3_*nuModel3_->nu()
134 Foam::tmp<Foam::surfaceScalarField> Foam::threePhaseMixture::muf() const
136 surfaceScalarField alpha1f = fvc::interpolate(alpha1_);
137 surfaceScalarField alpha2f = fvc::interpolate(alpha2_);
138 surfaceScalarField alpha3f = fvc::interpolate(alpha3_);
140 return tmp<surfaceScalarField>
142 new surfaceScalarField
145 alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
146 + alpha2f*rho2_*fvc::interpolate(nuModel2_->nu())
147 + alpha3f*rho3_*fvc::interpolate(nuModel3_->nu())
153 Foam::tmp<Foam::surfaceScalarField> Foam::threePhaseMixture::nuf() const
155 surfaceScalarField alpha1f = fvc::interpolate(alpha1_);
156 surfaceScalarField alpha2f = fvc::interpolate(alpha2_);
157 surfaceScalarField alpha3f = fvc::interpolate(alpha3_);
159 return tmp<surfaceScalarField>
161 new surfaceScalarField
165 alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
166 + alpha2f*rho2_*fvc::interpolate(nuModel2_->nu())
167 + alpha3f*rho3_*fvc::interpolate(nuModel3_->nu())
168 )/(alpha1f*rho1_ + alpha2f*rho2_ + alpha3f*rho3_)
174 bool Foam::threePhaseMixture::read()
176 if (transportModel::read())
180 nuModel1_().read(*this)
181 && nuModel2_().read(*this)
182 && nuModel3_().read(*this)
185 nuModel1_->viscosityProperties().lookup("rho") >> rho1_;
186 nuModel2_->viscosityProperties().lookup("rho") >> rho2_;
187 nuModel3_->viscosityProperties().lookup("rho") >> rho3_;
203 // ************************************************************************* //