Kunz.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 "Kunz.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_*rhov()/tInf_),
58  mvCoeff_(Cv_*rhov()/(0.5*rhol()*sqr(UInf_)*tInf_))
59 {
60  correct();
61 }
62 
63 
64 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
65 
68 {
70  phases_.mesh().lookupObject<volScalarField>("p");
71 
72  const volScalarField::Internal limitedAlphal
73  (
74  min(max(alphal(), scalar(0)), scalar(1))
75  );
76 
78  (
79  mcCoeff_*sqr(limitedAlphal)
80  *max(p - pSat(), p0_)/max(p - pSat(), 0.01*pSat()),
81  -mvCoeff_*min(p - pSat(), p0_)
82  );
83 }
84 
85 
88 {
90  phases_.mesh().lookupObject<volScalarField>("p");
91 
92  const volScalarField::Internal limitedAlphal
93  (
94  min(max(alphal(), scalar(0)), scalar(1))
95  );
96 
98  (
99  mcCoeff_*sqr(limitedAlphal)*(1.0 - limitedAlphal)
100  *pos0(p - pSat())/max(p - pSat(), 0.01*pSat()),
101  (-mvCoeff_)*limitedAlphal*neg(p - pSat())
102  );
103 }
104 
105 
107 {}
108 
109 
111 {
113  {
114  dict.lookup("UInf") >> UInf_;
115  dict.lookup("tInf") >> tInf_;
116  dict.lookup("Cv") >> Cv_;
117  dict.lookup("Cc") >> Cc_;
118 
119  mcCoeff_ = Cc_*rhov()/tInf_;
120  mvCoeff_ = Cv_*rhov()/(0.5*rhol()*sqr(UInf_)*tInf_);
121 
122  return true;
123  }
124  else
125  {
126  return false;
127  }
128 }
129 
130 
131 // ************************************************************************* //
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.
Kunz cavitation model.
Definition: Kunz.H:128
virtual void correct()
Correct the Kunz phaseChange model.
Definition: Kunz.C:106
Kunz(const dictionary &dict, const incompressibleTwoPhases &phases)
Construct for phases.
Definition: Kunz.C:43
virtual bool read(const dictionary &dict)
Read the dictionary and update.
Definition: Kunz.C:110
virtual Pair< tmp< volScalarField::Internal > > mDotcvAlpha() const
Return the mass condensation and vaporisation rates as a.
Definition: Kunz.C:67
virtual Pair< tmp< volScalarField::Internal > > mDotcvP() const
Return the mass condensation and vaporisation rates as coefficients.
Definition: Kunz.C:87
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