1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 namespace phaseChangeTwoPhaseMixtures
36 defineTypeNameAndDebug(Merkle, 0);
37 addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components);
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
45 const volVectorField& U,
46 const surfaceScalarField& phi,
47 const word& alpha1Name
50 phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
52 UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
53 tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
54 Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
55 Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
57 p0_("0", pSat().dimensions(), 0.0),
59 mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
60 mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
66 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68 Foam::Pair<Foam::tmp<Foam::volScalarField> >
69 Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const
71 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
73 return Pair<tmp<volScalarField> >
75 mcCoeff_*max(p - pSat(), p0_),
76 mvCoeff_*min(p - pSat(), p0_)
80 Foam::Pair<Foam::tmp<Foam::volScalarField> >
81 Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const
83 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
84 volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
86 return Pair<tmp<volScalarField> >
88 mcCoeff_*(1.0 - limitedAlpha1)*pos(p - pSat()),
89 (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
94 void Foam::phaseChangeTwoPhaseMixtures::Merkle::correct()
98 bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read()
100 if (phaseChangeTwoPhaseMixture::read())
102 phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
104 phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
105 phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
106 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
107 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
109 mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
110 mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2());
121 // ************************************************************************* //