Removed unnecessary return statement
[foam-extend-3.2.git] / applications / solvers / multiphase / interPhaseChangeFoam / phaseChangeTwoPhaseMixtures / Kunz / Kunz.C
blob729381da1b4a7236cd927e9f3c7149477b60b330
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 \*---------------------------------------------------------------------------*/
26 #include "Kunz.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 namespace Foam
33 namespace phaseChangeTwoPhaseMixtures
35     defineTypeNameAndDebug(Kunz, 0);
36     addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Kunz, components);
40 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
42 Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz
44     const volVectorField& U,
45     const surfaceScalarField& phi,
46     const word& alpha1Name
49     phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
51     UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
52     tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
53     Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
54     Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
56     p0_("0", pSat().dimensions(), 0.0),
58     mcCoeff_(Cc_*rho2()/tInf_),
59     mvCoeff_(Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_))
61     correct();
65 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
67 Foam::Pair<Foam::tmp<Foam::volScalarField> >
68 Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const
70     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
71     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
73     return Pair<tmp<volScalarField> >
74     (
75         mcCoeff_*sqr(limitedAlpha1)
76        *max(p - pSat(), p0_)/max(p - pSat(), 0.01*pSat()),
78         mvCoeff_*min(p - pSat(), p0_)
79     );
82 Foam::Pair<Foam::tmp<Foam::volScalarField> >
83 Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const
85     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
86     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
88     return Pair<tmp<volScalarField> >
89     (
90         mcCoeff_*sqr(limitedAlpha1)*(1.0 - limitedAlpha1)
91        *pos(p - pSat())/max(p - pSat(), 0.01*pSat()),
93         (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
94     );
98 void Foam::phaseChangeTwoPhaseMixtures::Kunz::correct()
102 bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read()
104     if (phaseChangeTwoPhaseMixture::read())
105     {
106         phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
108         phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
109         phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
110         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
111         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
113         mcCoeff_ = Cc_*rho2()/tInf_;
114         mvCoeff_ = Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_);
116         return true;
117     }
118     else
119     {
120         return false;
121     }
125 // ************************************************************************* //