FreeFOAM The Cross-Platform CFD Toolkit
SchnerrSauer.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace phaseChangeTwoPhaseMixtures
35 {
36  defineTypeNameAndDebug(SchnerrSauer, 0);
38  (
39  phaseChangeTwoPhaseMixture,
40  SchnerrSauer,
41  components
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
50 (
51  const volVectorField& U,
52  const surfaceScalarField& phi,
53  const word& alpha1Name
54 )
55 :
56  phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
57 
58  n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
59  dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
60  Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
61  Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
62 
63  p0_("0", pSat().dimensions(), 0.0)
64 {
65  correct();
66 }
67 
68 
69 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
70 
72 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
73 (
74  const volScalarField& limitedAlpha1
75 ) const
76 {
77  return pow
78  (
79  ((4*mathematicalConstant::pi*n_)/3)
80  *limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
81  1.0/3.0
82  );
83 }
84 
85 
87 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
88 {
90  return Vnuc/(1 + Vnuc);
91 }
92 
93 
95 Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
96 (
97  const volScalarField& p
98 ) const
99 {
100  volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
102  (limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2());
103 
104  return
105  (3*rho1()*rho2())*sqrt(2/(3*rho1()))
106  *rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
107 }
108 
109 
112 {
113  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
114  volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
115 
116  volScalarField pCoeff = this->pCoeff(p);
117 
118  return Pair<tmp<volScalarField> >
119  (
120  Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
121 
122  Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_)
123  );
124 }
125 
126 
129 {
130  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
131  volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
132 
133  volScalarField apCoeff = limitedAlpha1*pCoeff(p);
134 
135  return Pair<tmp<volScalarField> >
136  (
137  Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff,
138 
139  (-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff
140  );
141 }
142 
143 
145 {}
146 
147 
149 {
151  {
152  phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
153 
154  phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
155  phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
156  phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
157  phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
158 
159  return true;
160  }
161  else
162  {
163  return false;
164  }
165 }
166 
167 
168 // ************************ vim: set sw=4 sts=4 et: ************************ //