1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 \*---------------------------------------------------------------------------*/
30 #include "threePhaseMixture.H"
31 #include "addToRunTimeSelectionTable.H"
32 #include "surfaceFields.H"
35 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
37 //- Calculate and return the laminar viscosity
38 void Foam::threePhaseMixture::calcNu()
40 // Average kinematic viscosity calculated from dynamic viscosity
41 nu_ = mu()/(alpha1_*rho1_ + alpha2_*rho2_ + alpha3_*rho3_);
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 Foam::threePhaseMixture::threePhaseMixture
49 const volVectorField& U,
50 const surfaceScalarField& phi
53 transportModel(U, phi),
55 phase1Name_("phase1"),
56 phase2Name_("phase2"),
57 phase3Name_("phase3"),
90 rho1_(nuModel1_->viscosityProperties().lookup("rho")),
91 rho2_(nuModel2_->viscosityProperties().lookup("rho")),
92 rho3_(nuModel3_->viscosityProperties().lookup("rho")),
97 alpha1_(U_.db().lookupObject<const volScalarField> ("alpha1")),
98 alpha2_(U_.db().lookupObject<const volScalarField> ("alpha2")),
99 alpha3_(U_.db().lookupObject<const volScalarField> ("alpha3")),
106 U_.time().timeName(),
110 dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0),
111 calculatedFvPatchScalarField::typeName
118 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
120 Foam::tmp<Foam::volScalarField> Foam::threePhaseMixture::mu() const
122 return tmp<volScalarField>
127 alpha1_*rho1_*nuModel1_->nu()
128 + alpha2_*rho2_*nuModel2_->nu()
129 + alpha3_*rho3_*nuModel3_->nu()
135 Foam::tmp<Foam::surfaceScalarField> Foam::threePhaseMixture::muf() const
137 surfaceScalarField alpha1f = fvc::interpolate(alpha1_);
138 surfaceScalarField alpha2f = fvc::interpolate(alpha2_);
139 surfaceScalarField alpha3f = fvc::interpolate(alpha3_);
141 return tmp<surfaceScalarField>
143 new surfaceScalarField
146 alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
147 + alpha2f*rho2_*fvc::interpolate(nuModel2_->nu())
148 + alpha3f*rho3_*fvc::interpolate(nuModel3_->nu())
154 Foam::tmp<Foam::surfaceScalarField> Foam::threePhaseMixture::nuf() const
156 surfaceScalarField alpha1f = fvc::interpolate(alpha1_);
157 surfaceScalarField alpha2f = fvc::interpolate(alpha2_);
158 surfaceScalarField alpha3f = fvc::interpolate(alpha3_);
160 return tmp<surfaceScalarField>
162 new surfaceScalarField
166 alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
167 + alpha2f*rho2_*fvc::interpolate(nuModel2_->nu())
168 + alpha3f*rho3_*fvc::interpolate(nuModel3_->nu())
169 )/(alpha1f*rho1_ + alpha2f*rho2_ + alpha3f*rho3_)
175 bool Foam::threePhaseMixture::read()
177 if (transportModel::read())
181 nuModel1_().read(*this)
182 && nuModel2_().read(*this)
183 && nuModel3_().read(*this)
186 nuModel1_->viscosityProperties().lookup("rho") >> rho1_;
187 nuModel2_->viscosityProperties().lookup("rho") >> rho2_;
188 nuModel3_->viscosityProperties().lookup("rho") >> rho3_;
204 // ************************************************************************* //