1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 namespace phaseChangeTwoPhaseMixtures
35 defineTypeNameAndDebug(Merkle, 0);
36 addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components);
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
44 const volVectorField& U,
45 const surfaceScalarField& phi,
46 const word& alpha1Name
49 phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
51 UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
52 tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
53 Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
54 Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
56 p0_("0", pSat().dimensions(), 0.0),
58 mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
59 mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
67 Foam::Pair<Foam::tmp<Foam::volScalarField> >
68 Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const
70 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
72 return Pair<tmp<volScalarField> >
74 mcCoeff_*max(p - pSat(), p0_),
75 mvCoeff_*min(p - pSat(), p0_)
79 Foam::Pair<Foam::tmp<Foam::volScalarField> >
80 Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const
82 const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
83 volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
85 return Pair<tmp<volScalarField> >
87 mcCoeff_*(1.0 - limitedAlpha1)*pos(p - pSat()),
88 (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
93 void Foam::phaseChangeTwoPhaseMixtures::Merkle::correct()
97 bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read()
99 if (phaseChangeTwoPhaseMixture::read())
101 phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
103 phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
104 phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
105 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
106 phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
108 mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
109 mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2());
120 // ************************************************************************* //