1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "SchnerrSauer.H"
27 #include "mathematicalConstants.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 namespace phaseChangeTwoPhaseMixtures
36 defineTypeNameAndDebug(SchnerrSauer, 0);
37 addToRunTimeSelectionTable
39 phaseChangeTwoPhaseMixture,
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
51 const volVectorField& U,
52 const surfaceScalarField& phi,
53 const word& alpha1Name
56 phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
58 n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
59 dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
60 Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
61 Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
63 p0_("0", pSat().dimensions(), 0.0)
69 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
71 Foam::tmp<Foam::volScalarField>
72 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
74 const volScalarField& limitedAlpha1
79 ((4*constant::mathematical::pi*n_)/3)
80 *limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
86 Foam::dimensionedScalar
87 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
89 dimensionedScalar Vnuc = n_*constant::mathematical::pi*pow3(dNuc_)/6;
90 return Vnuc/(1 + Vnuc);
94 Foam::tmp<Foam::volScalarField>
95 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
97 const volScalarField& p
100 volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
103 limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
107 (3*rho1()*rho2())*sqrt(2/(3*rho1()))
108 *rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
112 Foam::Pair<Foam::tmp<Foam::volScalarField> >
113 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
115 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
116 volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
118 volScalarField pCoeff(this->pCoeff(p));
120 return Pair<tmp<volScalarField> >
122 Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
124 Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_)
129 Foam::Pair<Foam::tmp<Foam::volScalarField> >
130 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
132 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
133 volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
135 volScalarField apCoeff(limitedAlpha1*pCoeff(p));
137 return Pair<tmp<volScalarField> >
139 Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff,
141 (-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff
146 void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct()
150 bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
152 if (phaseChangeTwoPhaseMixture::read())
154 phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
156 phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
157 phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
158 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
159 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
170 // ************************************************************************* //