Merkle.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "Merkle.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace phaseChangeTwoPhaseMixtures
34 {
35  defineTypeNameAndDebug(Merkle, 0);
36  addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components);
37 }
38 }
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const volVectorField& U,
45  const surfaceScalarField& phi
46 )
47 :
48  phaseChangeTwoPhaseMixture(typeName, U, phi),
49 
50  UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_),
51  tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_),
52  Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
53  Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
54 
55  p0_("0", pSat().dimensions(), 0.0),
56 
57  mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
58  mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
59 {
60  correct();
61 }
62 
63 
64 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
65 
68 {
69  const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
70 
71  return Pair<tmp<volScalarField>>
72  (
73  mcCoeff_*max(p - pSat(), p0_),
74  mvCoeff_*min(p - pSat(), p0_)
75  );
76 }
77 
78 
81 {
82  const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
83  volScalarField limitedAlpha1(min(max(alpha1(), scalar(0)), scalar(1)));
84 
85  return Pair<tmp<volScalarField>>
86  (
87  mcCoeff_*(1.0 - limitedAlpha1)*pos0(p - pSat()),
88  (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
89  );
90 }
91 
92 
94 {
96 }
97 
98 
100 {
102  {
104 
105  phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
106  phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
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  else
116  {
117  return false;
118  }
119 }
120 
121 
122 // ************************************************************************* //
const dimensionedScalar & rho2() const
Return const-access to phase2 density.
virtual bool read()=0
Read the transportProperties dictionary and update.
surfaceScalarField & phi
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual void correct()=0
Correct the phaseChange model.
virtual Pair< tmp< volScalarField > > mDotP() const
Return the mass condensation and vaporisation rates as coefficients.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Merkle(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
dimensionedScalar neg(const dimensionedScalar &ds)
Macros for easy insertion into run-time selection tables.
const volScalarField & alpha1() const
Return the phase-fraction of phase 1.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
virtual void correct()
Correct the Merkle phaseChange model.
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:766
const dimensionedScalar & pSat() const
Return const-access to the saturation vapour pressure.
dimensionedScalar pos0(const dimensionedScalar &ds)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual bool read()
Read the transportProperties dictionary and update.
U
Definition: pEqn.H:72
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
const dimensionedScalar & rho2
Definition: createFields.H:44
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
virtual void correct()
Correct the Kunz phaseChange model.
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:354
const dimensionedScalar & rho1
Definition: createFields.H:43
virtual Pair< tmp< volScalarField > > mDotAlphal() const
Return the mass condensation and vaporisation rates as a.
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:583
const dimensionedScalar & rho1() const
Return const-access to phase1 density.
const dimensionSet dimVelocity