Removed unneeded lib dependency from mdInitialise
[foam-extend-3.2.git] / applications / solvers / multiphase / interMixingFoam / incompressibleThreePhaseMixture / threePhaseMixture.C
blob42c7769bc3247c4356d5050b17fb9cd89db03996
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     threePhaseMixture
28 \*---------------------------------------------------------------------------*/
30 #include "threePhaseMixture.H"
31 #include "addToRunTimeSelectionTable.H"
32 #include "surfaceFields.H"
33 #include "fvc.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"),
59     nuModel1_
60     (
61         viscosityModel::New
62         (
63             "nu1",
64             subDict(phase1Name_),
65             U,
66             phi
67         )
68     ),
69     nuModel2_
70     (
71         viscosityModel::New
72         (
73             "nu2",
74             subDict(phase2Name_),
75             U,
76             phi
77         )
78     ),
79     nuModel3_
80     (
81         viscosityModel::New
82         (
83             "nu3",
84             subDict(phase2Name_),
85             U,
86             phi
87         )
88     ),
90     rho1_(nuModel1_->viscosityProperties().lookup("rho")),
91     rho2_(nuModel2_->viscosityProperties().lookup("rho")),
92     rho3_(nuModel3_->viscosityProperties().lookup("rho")),
94     U_(U),
95     phi_(phi),
97     alpha1_(U_.db().lookupObject<const volScalarField> ("alpha1")),
98     alpha2_(U_.db().lookupObject<const volScalarField> ("alpha2")),
99     alpha3_(U_.db().lookupObject<const volScalarField> ("alpha3")),
101     nu_
102     (
103         IOobject
104         (
105             "nu",
106             U_.time().timeName(),
107             U_.db()
108         ),
109         U_.mesh(),
110         dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0),
111         calculatedFvPatchScalarField::typeName
112     )
114     calcNu();
118 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
120 Foam::tmp<Foam::volScalarField> Foam::threePhaseMixture::mu() const
122     return tmp<volScalarField>
123     (
124         new volScalarField
125         (
126             "mu",
127             alpha1_*rho1_*nuModel1_->nu()
128           + alpha2_*rho2_*nuModel2_->nu()
129           + alpha3_*rho3_*nuModel3_->nu()
130         )
131     );
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>
142     (
143         new surfaceScalarField
144         (
145             "mu",
146             alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
147           + alpha2f*rho2_*fvc::interpolate(nuModel2_->nu())
148           + alpha3f*rho3_*fvc::interpolate(nuModel3_->nu())
149         )
150     );
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>
161     (
162         new surfaceScalarField
163         (
164             "nu",
165             (
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_)
170         )
171     );
175 bool Foam::threePhaseMixture::read()
177     if (transportModel::read())
178     {
179         if
180         (
181             nuModel1_().read(*this)
182          && nuModel2_().read(*this)
183          && nuModel3_().read(*this)
184         )
185         {
186             nuModel1_->viscosityProperties().lookup("rho") >> rho1_;
187             nuModel2_->viscosityProperties().lookup("rho") >> rho2_;
188             nuModel3_->viscosityProperties().lookup("rho") >> rho3_;
190             return true;
191         }
192         else
193         {
194             return false;
195         }
196     }
197     else
198     {
199         return false;
200     }
204 // ************************************************************************* //