SchnerrSauer.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-2025 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 "SchnerrSauer.H"
27 #include "mathematicalConstants.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace compressible
35 {
36 namespace cavitationModels
37 {
40  (
44  );
45 }
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const dictionary& dict,
55  const compressibleTwoPhases& phases,
56  const label liquidIndex
57 )
58 :
59  cavitationModel(dict, phases, liquidIndex),
60 
61  n_("n", dimless/dimVolume, dict),
62  dNuc_("dNuc", dimLength, dict),
63  Cv_("Cv", dimless, dict),
64  Cc_("Cc", dimless, dict),
65 
66  p0_("0", dimPressure, 0.0)
67 {
68  correct();
69 }
70 
71 
72 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
73 
75 Foam::compressible::cavitationModels::SchnerrSauer::rRb
76 (
77  const volScalarField::Internal& limitedAlphal
78 ) const
79 {
80  return pow
81  (
83  *limitedAlphal/(1 + alphaNuc() - limitedAlphal),
84  1.0/3.0
85  );
86 }
87 
88 
90 Foam::compressible::cavitationModels::SchnerrSauer::alphaNuc() const
91 {
93  return Vnuc/(1 + Vnuc);
94 }
95 
96 
98 Foam::compressible::cavitationModels::SchnerrSauer::pCoeff
99 (
101  const volScalarField::Internal& pSat
102 ) const
103 {
104  const volScalarField::Internal limitedAlphal
105  (
106  min(max(alphal(), scalar(0)), scalar(1))
107  );
108 
110  (
111  limitedAlphal*rhol() + (1 - limitedAlphal)*rhov()
112  );
113 
114  return
115  (3*rhol()*rhov())*sqrt((2.0/3.0)/rhol())
116  *rRb(limitedAlphal)/(rho*sqrt(mag(p - pSat) + 0.01*pSat));
117 }
118 
119 
122 {
123  const volScalarField::Internal& p =
124  phases_.mesh().lookupObject<volScalarField>("p");
125 
126  const volScalarField::Internal limitedAlphal
127  (
128  min(max(alphal(), scalar(0)), scalar(1))
129  );
130 
131  const volScalarField::Internal pSatv(this->pSatv());
132  const volScalarField::Internal pSatl(this->pSatl());
133 
135  (
136  Cc_*limitedAlphal*pCoeff(p, pSatv)*max(p - pSatv, p0_),
137  -Cv_
138  *(1 + alphaNuc() - limitedAlphal)
139  *pCoeff(p, pSatl)
140  *min(p - pSatl, p0_)
141  );
142 }
143 
144 
147 {
148  const volScalarField::Internal& p =
149  phases_.mesh().lookupObject<volScalarField>("p");
150 
151  const volScalarField::Internal limitedAlphal
152  (
153  min(max(alphal(), scalar(0)), scalar(1))
154  );
155 
156  const volScalarField::Internal pSatv(this->pSatv());
157  const volScalarField::Internal pSatl(this->pSatl());
158 
160  (
161  Cc_*(1 - limitedAlphal)*pos0(p - pSatv)*limitedAlphal*pCoeff(p, pSatv),
162  -Cv_
163  *(1 + alphaNuc() - limitedAlphal)
164  *neg(p - pSatl)
165  *limitedAlphal
166  *pCoeff(p, pSatl)
167  );
168 }
169 
170 
172 {}
173 
174 
176 (
177  const dictionary& dict
178 )
179 {
181  {
182  dict.lookup("n") >> n_;
183  dict.lookup("dNuc") >> dNuc_;
184  dict.lookup("Cv") >> Cv_;
185  dict.lookup("Cc") >> Cc_;
186 
187  return true;
188  }
189  else
190  {
191  return false;
192  }
193 }
194 
195 
196 // ************************************************************************* //
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 <Type> with first() and second() elements.
Definition: Pair.H:66
virtual bool read(const dictionary &dict)=0
Read the dictionary and update.
virtual Pair< tmp< volScalarField::Internal > > mDotcvAlphal() const
Return the mass condensation and vaporisation rates as a.
Definition: SchnerrSauer.C:121
virtual void correct()
Correct the SchnerrSauer phaseChange model.
Definition: SchnerrSauer.C:171
virtual bool read(const dictionary &dict)
Read the dictionary and update.
Definition: SchnerrSauer.C:176
virtual Pair< tmp< volScalarField::Internal > > mDotcvP() const
Return the mass condensation and vaporisation rates as coefficients.
Definition: SchnerrSauer.C:146
SchnerrSauer(const dictionary &dict, const compressibleTwoPhases &phases, const label liquidIndex)
Construct for phases.
Definition: SchnerrSauer.C:53
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for managing temporary objects.
Definition: tmp.H:55
addToRunTimeSelectionTable(cavitationModel, Kunz, dictionary)
Namespace for OpenFOAM.
dimensionedScalar pos0(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dimensionSet dimPressure
const dimensionSet dimless
const dimensionSet dimLength
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
const dimensionSet dimVolume
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void pow3(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensionedScalar neg(const dimensionedScalar &ds)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dictionary dict
volScalarField & p