FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "SchnerrSauer.H"
00027 #include <OpenFOAM/mathematicalConstants.H>
00028 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 namespace phaseChangeTwoPhaseMixtures
00035 {
00036     defineTypeNameAndDebug(SchnerrSauer, 0);
00037     addToRunTimeSelectionTable
00038     (
00039         phaseChangeTwoPhaseMixture,
00040         SchnerrSauer,
00041         components
00042     );
00043 }
00044 }
00045 
00046 
00047 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00048 
00049 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
00050 (
00051     const volVectorField& U,
00052     const surfaceScalarField& phi,
00053     const word& alpha1Name
00054 )
00055 :
00056     phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
00057 
00058     n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
00059     dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
00060     Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
00061     Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
00062 
00063     p0_("0", pSat().dimensions(), 0.0)
00064 {
00065     correct();
00066 }
00067 
00068 
00069 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00070 
00071 Foam::tmp<Foam::volScalarField>
00072 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
00073 (
00074     const volScalarField& limitedAlpha1
00075 ) const
00076 {
00077     return pow
00078     (
00079         ((4*mathematicalConstant::pi*n_)/3)
00080        *limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
00081         1.0/3.0
00082     );
00083 }
00084 
00085 
00086 Foam::dimensionedScalar
00087 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
00088 {
00089     dimensionedScalar Vnuc = n_*mathematicalConstant::pi*pow3(dNuc_)/6;
00090     return Vnuc/(1 + Vnuc);
00091 }
00092 
00093 
00094 Foam::tmp<Foam::volScalarField>
00095 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
00096 (
00097     const volScalarField& p
00098 ) const
00099 {
00100     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00101     volScalarField rho =
00102         (limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2());
00103 
00104     return
00105         (3*rho1()*rho2())*sqrt(2/(3*rho1()))
00106        *rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
00107 }
00108 
00109 
00110 Foam::Pair<Foam::tmp<Foam::volScalarField> >
00111 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
00112 {
00113     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
00114     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00115 
00116     volScalarField pCoeff = this->pCoeff(p);
00117 
00118     return Pair<tmp<volScalarField> >
00119     (
00120         Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
00121 
00122         Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_)
00123     );
00124 }
00125 
00126 
00127 Foam::Pair<Foam::tmp<Foam::volScalarField> >
00128 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
00129 {
00130     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
00131     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00132 
00133     volScalarField apCoeff = limitedAlpha1*pCoeff(p);
00134 
00135     return Pair<tmp<volScalarField> >
00136     (
00137         Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff,
00138 
00139         (-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff
00140     );
00141 }
00142 
00143 
00144 void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct()
00145 {}
00146 
00147 
00148 bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
00149 {
00150     if (phaseChangeTwoPhaseMixture::read())
00151     {
00152         phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
00153 
00154         phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
00155         phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
00156         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
00157         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
00158 
00159         return true;
00160     }
00161     else
00162     {
00163         return false;
00164     }
00165 }
00166 
00167 
00168 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines