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

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