This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C

169 lines
4.8 KiB
C++
Raw Normal View History

/*---------------------------------------------------------------------------*\
========= |
2013-12-11 16:09:41 +00:00
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
2013-12-11 16:09:41 +00:00
This file is part of foam-extend.
2013-12-11 16:09:41 +00:00
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
2013-12-11 16:09:41 +00:00
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
2013-12-11 16:09:41 +00:00
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
2013-12-11 16:09:41 +00:00
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;
}
}
// ************************************************************************* //