FreeFOAM The Cross-Platform CFD Toolkit
Merkle.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 "Merkle.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace phaseChangeTwoPhaseMixtures
34 {
35  defineTypeNameAndDebug(Merkle, 0);
36  addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, 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_/(0.5*sqr(UInf_)*tInf_)),
59  mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
60 {
61  correct();
62 }
63 
64 
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66 
69 {
70  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
71 
72  return Pair<tmp<volScalarField> >
73  (
74  mcCoeff_*max(p - pSat(), p0_),
75  mvCoeff_*min(p - pSat(), p0_)
76  );
77 }
78 
81 {
82  const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
83  volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
84 
85  return Pair<tmp<volScalarField> >
86  (
87  mcCoeff_*(1.0 - limitedAlpha1)*pos(p - pSat()),
88  (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
89  );
90 }
91 
92 
94 {}
95 
96 
98 {
100  {
101  phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
102 
103  phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
104  phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
105  phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
106  phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
107 
108  mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
109  mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2());
110 
111  return true;
112  }
113  else
114  {
115  return false;
116  }
117 }
118 
119 
120 // ************************ vim: set sw=4 sts=4 et: ************************ //