1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "SchnerrSauer.H"
28 #include "mathematicalConstants.H"
29 #include "addToRunTimeSelectionTable.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 namespace phaseChangeTwoPhaseMixtures
37 defineTypeNameAndDebug(SchnerrSauer, 0);
38 addToRunTimeSelectionTable
40 phaseChangeTwoPhaseMixture,
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
52 const volVectorField& U,
53 const surfaceScalarField& phi,
54 const word& alpha1Name
57 phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
59 n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
60 dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
61 Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
62 Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
64 p0_("0", pSat().dimensions(), 0.0)
70 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
72 Foam::tmp<Foam::volScalarField>
73 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
75 const volScalarField& limitedAlpha1
80 ((4*mathematicalConstant::pi*n_)/3)
81 *limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
87 Foam::dimensionedScalar
88 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
90 dimensionedScalar Vnuc = n_*mathematicalConstant::pi*pow3(dNuc_)/6;
91 return Vnuc/(1 + Vnuc);
95 Foam::tmp<Foam::volScalarField>
96 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
98 const volScalarField& p
101 volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
103 (limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2());
106 (3*rho1()*rho2())*sqrt(2/(3*rho1()))
107 *rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
111 Foam::Pair<Foam::tmp<Foam::volScalarField> >
112 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
114 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
115 volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
117 volScalarField pCoeff = this->pCoeff(p);
119 return Pair<tmp<volScalarField> >
121 Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
123 Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_)
128 Foam::Pair<Foam::tmp<Foam::volScalarField> >
129 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
131 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
132 volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
134 volScalarField apCoeff = limitedAlpha1*pCoeff(p);
136 return Pair<tmp<volScalarField> >
138 Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff,
140 (-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff
145 void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct()
149 bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
151 if (phaseChangeTwoPhaseMixture::read())
153 phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
155 phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
156 phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
157 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
158 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
169 // ************************************************************************* //