Merkle.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "Merkle.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace phaseChangeTwoPhaseMixtures
37 {
38  defineTypeNameAndDebug(Merkle, 0);
39  addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components);
40 }
41 }
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 (
47  const volVectorField& U,
48  const surfaceScalarField& phi
49 )
50 :
51  phaseChangeTwoPhaseMixture(typeName, U, phi),
52 
53  UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_),
54  tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_),
55  Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
56  Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
57 
58  p0_(pSat().dimensions(), Zero),
59 
60  mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
61  mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
62 {
63  correct();
64 }
65 
66 
67 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68 
71 {
72  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
73 
74  return Pair<tmp<volScalarField>>
75  (
76  mcCoeff_*max(p - pSat(), p0_),
77  mvCoeff_*min(p - pSat(), p0_)
78  );
79 }
80 
83 {
84  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
85  volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
86 
87  return Pair<tmp<volScalarField>>
88  (
89  mcCoeff_*(1.0 - limitedAlpha1)*pos0(p - pSat()),
90  (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
91  );
92 }
93 
94 
96 {}
97 
98 
100 {
102  {
103  phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
104 
105  phaseChangeTwoPhaseMixtureCoeffs_.readEntry("UInf", UInf_);
106  phaseChangeTwoPhaseMixtureCoeffs_.readEntry("tInf", tInf_);
107  phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cc", Cc_);
108  phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cv", Cv_);
109 
110  mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
111  mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2());
112 
113  return true;
114  }
115 
116  return false;
117 }
118 
119 
120 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::phaseChangeTwoPhaseMixtures::Merkle::correct
virtual void correct()
Foam::Zero
static constexpr const zero Zero
Definition: zero.H:131
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
Merkle(const volVectorField &U, const surfaceScalarField &phi)
Foam::pos0
dimensionedScalar pos0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:181
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal
virtual Pair< tmp< volScalarField > > mDotAlphal() const
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Definition: hashSets.C:26
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Merkle.H
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP
virtual Pair< tmp< volScalarField > > mDotP() const
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
rho2
volScalarField & rho2
Definition: setRegionFluidFields.H:30
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:53
Foam::phaseChangeTwoPhaseMixture::read
virtual bool read()=0
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Definition: hashSets.C:40
rho1
volScalarField & rho1
Definition: setRegionFluidFields.H:27
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Definition: atmBoundaryLayer.C:26
Foam::phaseChangeTwoPhaseMixtures::Kunz::correct
virtual void correct()
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:58
U
U
Definition: pEqn.H:72
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:44
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:50
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:50
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Definition: POSIX.C:717
Foam::phaseChangeTwoPhaseMixtures::Merkle::read
virtual bool read()
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::neg
dimensionedScalar neg(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:192
Foam::dimless
const dimensionSet dimless
Definition: dimensionSets.C:182