All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2021 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 twoPhaseChangeModels
34 {
35  defineTypeNameAndDebug(Merkle, 0);
36  addToRunTimeSelectionTable(cavitationModel, Merkle, dictionary);
37 }
38 }
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const twoPhaseMixtureThermo& mixture
45 )
46 :
47  cavitationModel(typeName, mixture),
48 
49  UInf_("UInf", dimVelocity, twoPhaseChangeModelCoeffs_),
50  tInf_("tInf", dimTime, twoPhaseChangeModelCoeffs_),
51  Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
52  Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
53 
54  p0_("0", pSat().dimensions(), 0.0),
55 
56  mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_))
57 {
58  correct();
59 }
60 
61 
62 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
63 
66 {
67  const volScalarField::Internal& p =
69 
70  const volScalarField::Internal mvCoeff_
71  (
72  Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2())
73  );
74 
75  return Pair<tmp<volScalarField::Internal>>
76  (
77  mcCoeff_*max(p - pSat(), p0_),
78  mvCoeff_*min(p - pSat(), p0_)
79  );
80 }
81 
82 
85 {
86  const volScalarField::Internal& p =
88 
89  const volScalarField::Internal limitedAlpha1
90  (
91  min(max(mixture_.alpha1()(), scalar(0)), scalar(1))
92  );
93 
94  const volScalarField::Internal mvCoeff_
95  (
96  Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2())
97  );
98 
99  return Pair<tmp<volScalarField::Internal>>
100  (
101  mcCoeff_*(1.0 - limitedAlpha1)*pos0(p - pSat()),
102 
103  (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
104  );
105 }
106 
107 
109 {
111 }
112 
113 
115 {
116  if (cavitationModel::read())
117  {
119 
120  twoPhaseChangeModelCoeffs_.lookup("UInf") >> UInf_;
121  twoPhaseChangeModelCoeffs_.lookup("tInf") >> tInf_;
122  twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
123  twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
124 
125  return true;
126  }
127  else
128  {
129  return false;
130  }
131 }
132 
133 
134 // ************************************************************************* //
defineTypeNameAndDebug(cavitationModel, 0)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dictionary twoPhaseChangeModelCoeffs_
Model coefficient dictionary.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimless
const dimensionedScalar & pSat() const
Return const-access to the saturation vapour pressure.
DimensionedField< scalar, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
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:57
const dimensionSet dimTime
const volScalarField::Internal & rho1() const
Return the internal field of the density of phase 1.
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
virtual Pair< tmp< volScalarField > > mDotP() const
Return the mass condensation and vaporisation rates as coefficients.
Definition: Merkle.C:80
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:1040
virtual bool read()
Read the transportProperties dictionary and update.
Definition: Merkle.C:104
virtual void correct()=0
Correct the phaseChange model.
dimensionedScalar pos0(const dimensionedScalar &ds)
const dimensionSet dimVelocity
addToRunTimeSelectionTable(cavitationModel, Kunz, dictionary)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual Pair< tmp< volScalarField > > mDotAlphal() const
Return the mass condensation and vaporisation rates as a.
Definition: Merkle.C:66
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Merkle(const immiscibleIncompressibleTwoPhaseMixture &mixture)
Construct for mixture.
Definition: Merkle.C:43
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:312
const volScalarField::Internal & rho2() const
Return the internal field of the density of phase 2.
const immiscibleIncompressibleTwoPhaseMixture & mixture_
Reference to the two-phase mixture.
virtual void correct()
Correct the Merkle phaseChange model.
Definition: Merkle.C:98
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844
virtual bool read()
Read the transportProperties dictionary and update.