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

Kunz.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 "Kunz.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 
00029 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 namespace phaseChangeTwoPhaseMixtures
00034 {
00035     defineTypeNameAndDebug(Kunz, 0);
00036     addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Kunz, components);
00037 }
00038 }
00039 
00040 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00041 
00042 Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz
00043 (
00044     const volVectorField& U,
00045     const surfaceScalarField& phi,
00046     const word& alpha1Name
00047 )
00048 :
00049     phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
00050 
00051     UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
00052     tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
00053     Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
00054     Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
00055 
00056     p0_("0", pSat().dimensions(), 0.0),
00057 
00058     mcCoeff_(Cc_*rho2()/tInf_),
00059     mvCoeff_(Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_))
00060 {
00061     correct();
00062 }
00063 
00064 
00065 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00066 
00067 Foam::Pair<Foam::tmp<Foam::volScalarField> >
00068 Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const
00069 {
00070     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
00071     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00072 
00073     return Pair<tmp<volScalarField> >
00074     (
00075         mcCoeff_*sqr(limitedAlpha1)
00076        *max(p - pSat(), p0_)/max(p - pSat(), 0.01*pSat()),
00077 
00078         mvCoeff_*min(p - pSat(), p0_)
00079     );
00080 }
00081 
00082 Foam::Pair<Foam::tmp<Foam::volScalarField> >
00083 Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const
00084 {
00085     const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
00086     volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
00087 
00088     return Pair<tmp<volScalarField> >
00089     (
00090         mcCoeff_*sqr(limitedAlpha1)*(1.0 - limitedAlpha1)
00091        *pos(p - pSat())/max(p - pSat(), 0.01*pSat()),
00092 
00093         (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
00094     );
00095 }
00096 
00097 
00098 void Foam::phaseChangeTwoPhaseMixtures::Kunz::correct()
00099 {}
00100 
00101 
00102 bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read()
00103 {
00104     if (phaseChangeTwoPhaseMixture::read())
00105     {
00106         phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
00107 
00108         phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
00109         phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
00110         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
00111         phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
00112 
00113         mcCoeff_ = Cc_*rho2()/tInf_;
00114         mvCoeff_ = Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_);
00115 
00116         return true;
00117     }
00118     else
00119     {
00120         return false;
00121     }
00122 }
00123 
00124 
00125 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines