Removed unnecessary return statement
[foam-extend-3.2.git] / applications / solvers / multiphase / interMixingFoam / incompressibleThreePhaseMixture / threePhaseMixture.C
blob6ce3e530a3fb5b5fc66ba8c96c1bf075d16ba927
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Class
25     threePhaseMixture
27 \*---------------------------------------------------------------------------*/
29 #include "threePhaseMixture.H"
30 #include "addToRunTimeSelectionTable.H"
31 #include "surfaceFields.H"
32 #include "fvc.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"),
58     nuModel1_
59     (
60         viscosityModel::New
61         (
62             "nu1",
63             subDict(phase1Name_),
64             U,
65             phi
66         )
67     ),
68     nuModel2_
69     (
70         viscosityModel::New
71         (
72             "nu2",
73             subDict(phase2Name_),
74             U,
75             phi
76         )
77     ),
78     nuModel3_
79     (
80         viscosityModel::New
81         (
82             "nu3",
83             subDict(phase2Name_),
84             U,
85             phi
86         )
87     ),
89     rho1_(nuModel1_->viscosityProperties().lookup("rho")),
90     rho2_(nuModel2_->viscosityProperties().lookup("rho")),
91     rho3_(nuModel3_->viscosityProperties().lookup("rho")),
93     U_(U),
94     phi_(phi),
96     alpha1_(U_.db().lookupObject<const volScalarField> ("alpha1")),
97     alpha2_(U_.db().lookupObject<const volScalarField> ("alpha2")),
98     alpha3_(U_.db().lookupObject<const volScalarField> ("alpha3")),
100     nu_
101     (
102         IOobject
103         (
104             "nu",
105             U_.time().timeName(),
106             U_.db()
107         ),
108         U_.mesh(),
109         dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0),
110         calculatedFvPatchScalarField::typeName
111     )
113     calcNu();
117 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
119 Foam::tmp<Foam::volScalarField> Foam::threePhaseMixture::mu() const
121     return tmp<volScalarField>
122     (
123         new volScalarField
124         (
125             "mu",
126             alpha1_*rho1_*nuModel1_->nu()
127           + alpha2_*rho2_*nuModel2_->nu()
128           + alpha3_*rho3_*nuModel3_->nu()
129         )
130     );
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>
141     (
142         new surfaceScalarField
143         (
144             "mu",
145             alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
146           + alpha2f*rho2_*fvc::interpolate(nuModel2_->nu())
147           + alpha3f*rho3_*fvc::interpolate(nuModel3_->nu())
148         )
149     );
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>
160     (
161         new surfaceScalarField
162         (
163             "nu",
164             (
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_)
169         )
170     );
174 bool Foam::threePhaseMixture::read()
176     if (transportModel::read())
177     {
178         if
179         (
180             nuModel1_().read(*this)
181          && nuModel2_().read(*this)
182          && nuModel3_().read(*this)
183         )
184         {
185             nuModel1_->viscosityProperties().lookup("rho") >> rho1_;
186             nuModel2_->viscosityProperties().lookup("rho") >> rho2_;
187             nuModel3_->viscosityProperties().lookup("rho") >> rho3_;
189             return true;
190         }
191         else
192         {
193             return false;
194         }
195     }
196     else
197     {
198         return false;
199     }
203 // ************************************************************************* //