168 lines
4.8 KiB
C
168 lines
4.8 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | foam-extend: Open Source CFD
|
|
\\ / O peration | Version: 4.0
|
|
\\ / A nd | Web: http://www.foam-extend.org
|
|
\\/ M anipulation | For copyright notice see file Copyright
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of foam-extend.
|
|
|
|
foam-extend is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by the
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
option) any later version.
|
|
|
|
foam-extend is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#include "SchnerrSauer.H"
|
|
#include "mathematicalConstants.H"
|
|
#include "addToRunTimeSelectionTable.H"
|
|
|
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
|
|
namespace Foam
|
|
{
|
|
namespace phaseChangeTwoPhaseMixtures
|
|
{
|
|
defineTypeNameAndDebug(SchnerrSauer, 0);
|
|
addToRunTimeSelectionTable
|
|
(
|
|
phaseChangeTwoPhaseMixture,
|
|
SchnerrSauer,
|
|
components
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
|
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
|
|
(
|
|
const volVectorField& U,
|
|
const surfaceScalarField& phi,
|
|
const word& alpha1Name
|
|
)
|
|
:
|
|
phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
|
|
|
|
n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
|
|
dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
|
|
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
|
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
|
|
|
p0_("0", pSat().dimensions(), 0.0)
|
|
{
|
|
correct();
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
|
|
Foam::tmp<Foam::volScalarField>
|
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
|
|
(
|
|
const volScalarField& limitedAlpha1
|
|
) const
|
|
{
|
|
return pow
|
|
(
|
|
((4*mathematicalConstant::pi*n_)/3)
|
|
*limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
|
|
1.0/3.0
|
|
);
|
|
}
|
|
|
|
|
|
Foam::dimensionedScalar
|
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
|
|
{
|
|
dimensionedScalar Vnuc = n_*mathematicalConstant::pi*pow3(dNuc_)/6;
|
|
return Vnuc/(1 + Vnuc);
|
|
}
|
|
|
|
|
|
Foam::tmp<Foam::volScalarField>
|
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
|
|
(
|
|
const volScalarField& p
|
|
) const
|
|
{
|
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
|
volScalarField rho =
|
|
(limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2());
|
|
|
|
return
|
|
(3*rho1()*rho2())*sqrt(2/(3*rho1()))
|
|
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
|
|
}
|
|
|
|
|
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
|
|
{
|
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
|
|
|
volScalarField pCoeff = this->pCoeff(p);
|
|
|
|
return Pair<tmp<volScalarField> >
|
|
(
|
|
Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
|
|
|
|
Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_)
|
|
);
|
|
}
|
|
|
|
|
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
|
|
{
|
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
|
|
|
volScalarField apCoeff = limitedAlpha1*pCoeff(p);
|
|
|
|
return Pair<tmp<volScalarField> >
|
|
(
|
|
Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff,
|
|
|
|
(-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff
|
|
);
|
|
}
|
|
|
|
|
|
void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct()
|
|
{}
|
|
|
|
|
|
bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
|
|
{
|
|
if (phaseChangeTwoPhaseMixture::read())
|
|
{
|
|
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
|
|
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
|
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
|
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
|
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
|
|
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|