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-2023 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 cavitationModels
34 {
37 }
38 }
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const dictionary& dict,
45  const incompressibleTwoPhases& phases
46 )
47 :
48  cavitationModel(dict, phases),
49 
50  UInf_("UInf", dimVelocity, dict),
51  tInf_("tInf", dimTime, dict),
52  Cv_("Cv", dimless, dict),
53  Cc_("Cc", dimless, dict),
54 
55  p0_("0", pSat().dimensions(), 0.0),
56 
57  mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
58  mvCoeff_(Cv_*rhol()/(0.5*sqr(UInf_)*tInf_*rhov()))
59 {
60  correct();
61 }
62 
63 
64 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
65 
68 {
70  phases_.mesh().lookupObject<volScalarField>("p");
71 
73  (
74  mcCoeff_*max(p - pSat(), p0_),
75  -mvCoeff_*min(p - pSat(), p0_)
76  );
77 }
78 
79 
82 {
84  phases_.mesh().lookupObject<volScalarField>("p");
85 
86  const volScalarField::Internal limitedAlphal
87  (
88  min(max(alphal(), scalar(0)), scalar(1))
89  );
90 
92  (
93  mcCoeff_*(1.0 - limitedAlphal)*pos0(p - pSat()),
94  (-mvCoeff_)*limitedAlphal*neg(p - pSat())
95  );
96 }
97 
98 
100 {}
101 
102 
104 {
106  {
107  dict.lookup("UInf") >> UInf_;
108  dict.lookup("tInf") >> tInf_;
109  dict.lookup("Cv") >> Cv_;
110  dict.lookup("Cc") >> Cc_;
111 
112  mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
113  mvCoeff_ = Cv_*rhol()/(0.5*sqr(UInf_)*tInf_*rhov());
114 
115  return true;
116  }
117  else
118  {
119  return false;
120  }
121 }
122 
123 
124 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:65
Abstract base class for cavitation models.
virtual bool read(const dictionary &dict)=0
Read the dictionary and update.
Merkle cavitation model.
Definition: Merkle.H:121
Merkle(const dictionary &dict, const incompressibleTwoPhases &phases)
Construct for phases.
Definition: Merkle.C:43
virtual void correct()
Correct the Merkle phaseChange model.
Definition: Merkle.C:99
virtual bool read(const dictionary &dict)
Read the dictionary and update.
Definition: Merkle.C:103
virtual Pair< tmp< volScalarField::Internal > > mDotcvAlpha() const
Return the mass condensation and vaporisation rates as a.
Definition: Merkle.C:67
virtual Pair< tmp< volScalarField::Internal > > mDotcvP() const
Return the mass condensation and vaporisation rates as coefficients.
Definition: Merkle.C:81
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Interface to two constant density phases.
defineTypeNameAndDebug(Kunz, 0)
addToRunTimeSelectionTable(cavitationModel, Kunz, dictionary)
Namespace for OpenFOAM.
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Definition: dimensionSets.C:96
const dimensionSet dimless
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensionedScalar neg(const dimensionedScalar &ds)
const dimensionSet dimVelocity
dictionary dict
volScalarField & p