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

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