All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AttouFerschneider.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) 2018-2020 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 "AttouFerschneider.H"
27 #include "phasePair.H"
28 #include "phaseSystem.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace dragModels
36 {
37  defineTypeNameAndDebug(AttouFerschneider, 0);
38  addToRunTimeSelectionTable(dragModel, AttouFerschneider, dictionary);
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
46 Foam::dragModels::AttouFerschneider::KGasLiquid
47 (
48  const phaseModel& gas,
49  const phaseModel& liquid
50 ) const
51 {
52  const phaseModel& solid = gas.fluid().phases()[solidName_];
53 
54  const volScalarField oneMinusGas(max(1 - gas, liquid.residualAlpha()));
55  const volScalarField cbrtR
56  (
57  cbrt(max(solid, solid.residualAlpha())/oneMinusGas)
58  );
59  const volScalarField magURel(mag(gas.U() - liquid.U()));
60 
61  return
62  E2_*gas.thermo().mu()*sqr(oneMinusGas/solid.d())*sqr(cbrtR)
63  /max(gas, gas.residualAlpha())
64  + E2_*gas.rho()*magURel*(1 - gas)/solid.d()*cbrtR;
65 }
66 
67 
69 Foam::dragModels::AttouFerschneider::KGasSolid
70 (
71  const phaseModel& gas,
72  const phaseModel& solid
73 ) const
74 {
75  const volScalarField oneMinusGas(max(1 - gas, solid.residualAlpha()));
76  const volScalarField cbrtR
77  (
78  cbrt(max(solid, solid.residualAlpha())/oneMinusGas)
79  );
80 
81  return
82  E1_*gas.thermo().mu()*sqr(oneMinusGas/solid.d())*sqr(cbrtR)
83  /max(gas, gas.residualAlpha())
84  + E2_*gas.rho()*mag(gas.U())*(1 - gas)/solid.d()*cbrtR;
85 }
86 
87 
89 Foam::dragModels::AttouFerschneider::KLiquidSolid
90 (
91  const phaseModel& liquid,
92  const phaseModel& solid
93 ) const
94 {
95  const phaseModel& gas = liquid.fluid().phases()[gasName_];
96 
97  return
98  E1_*liquid.thermo().mu()
99  *sqr(max(solid, solid.residualAlpha())/solid.d())
100  /max(liquid, liquid.residualAlpha())
101  + E2_*liquid.rho()*mag(gas.U())*solid/solid.d();
102 }
103 
104 
105 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
106 
108 (
109  const dictionary& dict,
110  const phasePair& pair,
111  const bool registerObject
112 )
113 :
114  dragModel(dict, pair, registerObject),
115  gasName_(dict.lookup("gas")),
116  liquidName_(dict.lookup("liquid")),
117  solidName_(dict.lookup("solid")),
118  E1_("E1", dimless, dict),
119  E2_("E2", dimless, dict)
120 {}
121 
122 
123 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
124 
126 {}
127 
128 
129 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 
133 {
135  << "Not implemented."
136  << "Drag coefficient is not defined for the AttouFerschneider model."
137  << exit(FatalError);
138 
139  return tmp<volScalarField>(nullptr);
140 }
141 
142 
145 {
146  switch (Pair<word>::compare(pair_, phasePairKey(gasName_, liquidName_)))
147  {
148  case 1:
149  return KGasLiquid(pair_.phase1(), pair_.phase2());
150  case -1:
151  return KGasLiquid(pair_.phase2(), pair_.phase1());
152  }
153 
154  switch (Pair<word>::compare(pair_, phasePairKey(gasName_, solidName_)))
155  {
156  case 1:
157  return KGasSolid(pair_.phase1(), pair_.phase2());
158  case -1:
159  return KGasSolid(pair_.phase2(), pair_.phase1());
160  }
161 
162  switch (Pair<word>::compare(pair_, phasePairKey(liquidName_, solidName_)))
163  {
164  case 1:
165  return KLiquidSolid(pair_.phase1(), pair_.phase2());
166  case -1:
167  return KLiquidSolid(pair_.phase2(), pair_.phase1());
168  }
169 
171  << "The pair does not contain two of out of the gas, liquid and solid "
172  << "phase models."
173  << exit(FatalError);
174 
175  return tmp<volScalarField>(nullptr);
176 }
177 
178 
181 {
182  return fvc::interpolate(K());
183 }
184 
185 
186 // ************************************************************************* //
dictionary dict
const phaseModel & phase2() const
Return phase 2.
Definition: phasePairI.H:34
virtual tmp< volScalarField > K() const
The drag coefficient used in the momentum equation.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
const phaseModel & phase1() const
Return phase 1.
Definition: phasePairI.H:28
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static int compare(const Pair< word > &a, const Pair< word > &b)
Compare Pairs.
Definition: Pair.H:153
virtual tmp< surfaceScalarField > Kf() const
The drag coefficient used in the face-momentum equations.
virtual ~AttouFerschneider()
Destructor.
const dimensionSet dimless
Macros for easy insertion into run-time selection tables.
AttouFerschneider(const dictionary &dict, const phasePair &pair, const bool registerObject)
Construct from a dictionary and a phase pair.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
virtual tmp< volScalarField > K() const
Return the drag coefficient K.
stressControl lookup("compactNormalStress") >> compactNormalStress
dimensionedScalar cbrt(const dimensionedScalar &ds)
const phasePair & pair_
Phase pair.
Definition: dragModel.H:62
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for managing temporary objects.
Definition: PtrList.H:53
virtual tmp< volScalarField > CdRe() const
Drag coefficient.
Namespace for OpenFOAM.