FreeFOAM The Cross-Platform CFD Toolkit
Kunz.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 "Kunz.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace phaseChangeTwoPhaseMixtures
34 {
35  defineTypeNameAndDebug(Kunz, 0);
36  addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Kunz, components);
37 }
38 }
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const volVectorField& U,
45  const surfaceScalarField& phi,
46  const word& alpha1Name
47 )
48 :
49  phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
50 
51  UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
52  tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
53  Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
54  Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
55 
56  p0_("0", pSat().dimensions(), 0.0),
57 
58  mcCoeff_(Cc_*rho2()/tInf_),
59  mvCoeff_(Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_))
60 {
61  correct();
62 }
63 
64 
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66 
69 {
70  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
71  volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
72 
73  return Pair<tmp<volScalarField> >
74  (
75  mcCoeff_*sqr(limitedAlpha1)
76  *max(p - pSat(), p0_)/max(p - pSat(), 0.01*pSat()),
77 
78  mvCoeff_*min(p - pSat(), p0_)
79  );
80 }
81 
84 {
85  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
86  volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
87 
88  return Pair<tmp<volScalarField> >
89  (
90  mcCoeff_*sqr(limitedAlpha1)*(1.0 - limitedAlpha1)
91  *pos(p - pSat())/max(p - pSat(), 0.01*pSat()),
92 
93  (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
94  );
95 }
96 
97 
99 {}
100 
101 
103 {
105  {
106  phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
107 
108  phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
109  phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
110  phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
111  phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
112 
113  mcCoeff_ = Cc_*rho2()/tInf_;
114  mvCoeff_ = Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_);
115 
116  return true;
117  }
118  else
119  {
120  return false;
121  }
122 }
123 
124 
125 // ************************ vim: set sw=4 sts=4 et: ************************ //