OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

SchnerrSauer.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "SchnerrSauer.H"
00028 #include "mathematicalConstants.H"
00029 #include "addToRunTimeSelectionTable.H"
00030 
00031 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 namespace phaseChangeTwoPhaseMixtures
00036 {
00037     defineTypeNameAndDebug(SchnerrSauer, 0);
00038     addToRunTimeSelectionTable
00039     (
00040         phaseChangeTwoPhaseMixture,
00041         SchnerrSauer,
00042         components
00043     );
00044 }
00045 }
00046 
00047 
00048 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00049 
00050 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
00051 (
00052     const volVectorField& U,
00053     const surfaceScalarField& phi,
00054     const word& alpha1Name
00055 )
00056 :
00057     phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
00058 
00059     n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
00060     dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
00061     Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
00062     Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
00063 
00064     p0_("0", pSat().dimensions(), 0.0)
00065 {
00066     correct();
00067 }
00068 
00069 
00070 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00071 
00072 Foam::tmp<Foam::volScalarField>
00073 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
00074 (
00075     const volScalarField& limitedAlpha1
00076 ) const
00077 {
00078     return pow
00079     (
00080         ((4*mathematicalConstant::pi*n_)/3)
00081        *limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
00082         1.0/3.0
00083     );
00084 }
00085 
00086 
00087 Foam::dimensionedScalar
00088 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
00089 {
00090     dimensionedScalar Vnuc = n_*mathematicalConstant::pi*pow3(dNuc_)/6;
00091     return Vnuc/(1 + Vnuc);
00092 }
00093 
00094 
00095 Foam::tmp<Foam::volScalarField>
00096 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
00097 (
00098     const volScalarField& p
00099 ) const
00100 {
00101     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00102     volScalarField rho =
00103         (limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2());
00104 
00105     return
00106         (3*rho1()*rho2())*sqrt(2/(3*rho1()))
00107        *rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
00108 }
00109 
00110 
00111 Foam::Pair<Foam::tmp<Foam::volScalarField> >
00112 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
00113 {
00114     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
00115     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00116 
00117     volScalarField pCoeff = this->pCoeff(p);
00118 
00119     return Pair<tmp<volScalarField> >
00120     (
00121         Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
00122 
00123         Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_)
00124     );
00125 }
00126 
00127 
00128 Foam::Pair<Foam::tmp<Foam::volScalarField> >
00129 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
00130 {
00131     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
00132     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00133 
00134     volScalarField apCoeff = limitedAlpha1*pCoeff(p);
00135 
00136     return Pair<tmp<volScalarField> >
00137     (
00138         Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff,
00139 
00140         (-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff
00141     );
00142 }
00143 
00144 
00145 void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct()
00146 {}
00147 
00148 
00149 bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
00150 {
00151     if (phaseChangeTwoPhaseMixture::read())
00152     {
00153         phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
00154 
00155         phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
00156         phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
00157         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
00158         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
00159 
00160         return true;
00161     }
00162     else
00163     {
00164         return false;
00165     }
00166 }
00167 
00168 
00169 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd