Merkle.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-2021 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 "Merkle.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace twoPhaseChangeModels
34 {
35  defineTypeNameAndDebug(Merkle, 0);
36  addToRunTimeSelectionTable(cavitationModel, Merkle, dictionary);
37 }
38 }
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
45 )
46 :
47  cavitationModel(typeName, mixture),
48 
49  UInf_("UInf", dimVelocity, twoPhaseChangeModelCoeffs_),
50  tInf_("tInf", dimTime, twoPhaseChangeModelCoeffs_),
51  Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
52  Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
53 
54  p0_("0", pSat().dimensions(), 0.0),
55 
56  mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
57  mvCoeff_(Cv_*mixture_.rho1()/(0.5*sqr(UInf_)*tInf_*mixture_.rho2()))
58 {
59  correct();
60 }
61 
62 
63 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
64 
67 {
68  const volScalarField& p =
69  mixture_.U().db().lookupObject<volScalarField>("p");
70 
72  (
73  mcCoeff_*max(p - pSat(), p0_),
74  mvCoeff_*min(p - pSat(), p0_)
75  );
76 }
77 
78 
81 {
82  const volScalarField& p =
83  mixture_.U().db().lookupObject<volScalarField>("p");
84 
85  const volScalarField limitedAlpha1
86  (
87  min(max(mixture_.alpha1(), scalar(0)), scalar(1))
88  );
89 
91  (
92  mcCoeff_*(1.0 - limitedAlpha1)*pos0(p - pSat()),
93  (-mvCoeff_)*limitedAlpha1*neg(p - pSat())
94  );
95 }
96 
97 
99 {
101 }
102 
103 
105 {
106  if (cavitationModel::read())
107  {
108  twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
109 
110  twoPhaseChangeModelCoeffs_.lookup("UInf") >> UInf_;
111  twoPhaseChangeModelCoeffs_.lookup("tInf") >> tInf_;
112  twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
113  twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
114 
115  mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
116  mvCoeff_ = Cv_*mixture_.rho1()/(0.5*sqr(UInf_)*tInf_*mixture_.rho2());
117 
118  return true;
119  }
120  else
121  {
122  return false;
123  }
124 }
125 
126 
127 // ************************************************************************* //
defineTypeNameAndDebug(cavitationModel, 0)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Abstract base class for cavitation models.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimless
dimensionedScalar neg(const dimensionedScalar &ds)
Macros for easy insertion into run-time selection tables.
const dimensionSet dimTime
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
virtual Pair< tmp< volScalarField > > mDotP() const
Return the mass condensation and vaporisation rates as coefficients.
Definition: Merkle.C:80
virtual bool read()
Read the transportProperties dictionary and update.
Definition: Merkle.C:104
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-9/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
Definition: pEqn.H:68
virtual void correct()=0
Correct the phaseChange model.
dimensionedScalar pos0(const dimensionedScalar &ds)
const dimensionSet dimVelocity
addToRunTimeSelectionTable(cavitationModel, Kunz, dictionary)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual Pair< tmp< volScalarField > > mDotAlphal() const
Return the mass condensation and vaporisation rates as a.
Definition: Merkle.C:66
An immiscible incompressible two-phase mixture transport model.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Merkle(const immiscibleIncompressibleTwoPhaseMixture &mixture)
Construct for mixture.
Definition: Merkle.C:43
volScalarField & p
virtual void correct()
Correct the Merkle phaseChange model.
Definition: Merkle.C:98
Namespace for OpenFOAM.
virtual bool read()
Read the transportProperties dictionary and update.