BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / applications / solvers / multiphase / interPhaseChangeFoam / phaseChangeTwoPhaseMixtures / Merkle / Merkle.C
blob87c261da9b86bf2838e7f8742f5509b62431ee03
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 \*---------------------------------------------------------------------------*/
26 #include "Merkle.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 namespace Foam
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()))
61     correct();
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> >
73     (
74         mcCoeff_*max(p - pSat(), p0_),
75         mvCoeff_*min(p - pSat(), p0_)
76     );
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> >
86     (
87         mcCoeff_*(1.0 - limitedAlpha1)*pos(p - pSat()),
88         (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
89     );
93 void Foam::phaseChangeTwoPhaseMixtures::Merkle::correct()
97 bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read()
99     if (phaseChangeTwoPhaseMixture::read())
100     {
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());
111         return true;
112     }
113     else
114     {
115         return false;
116     }
120 // ************************************************************************* //