1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "kineticTheoryModel.H"
27 #include "surfaceInterpolate.H"
28 #include "mathematicalConstants.H"
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 Foam::kineticTheoryModel::kineticTheoryModel
35 const Foam::phaseModel& phasea,
36 const Foam::volVectorField& Ub,
37 const Foam::volScalarField& alpha,
38 const Foam::dragModel& draga
52 kineticTheoryProperties_
56 "kineticTheoryProperties",
57 Ua_.time().constant(),
63 kineticTheory_(kineticTheoryProperties_.lookup("kineticTheory")),
64 equilibrium_(kineticTheoryProperties_.lookup("equilibrium")),
68 kineticTheoryModels::viscosityModel::New
70 kineticTheoryProperties_
75 conductivityModel::New
77 kineticTheoryProperties_
84 kineticTheoryProperties_
87 granularPressureModel_
89 granularPressureModel::New
91 kineticTheoryProperties_
94 frictionalStressModel_
96 frictionalStressModel::New
98 kineticTheoryProperties_
101 e_(kineticTheoryProperties_.lookup("e")),
102 alphaMax_(kineticTheoryProperties_.lookup("alphaMax")),
103 alphaMinFriction_(kineticTheoryProperties_.lookup("alphaMinFriction")),
104 Fr_(kineticTheoryProperties_.lookup("Fr")),
105 eta_(kineticTheoryProperties_.lookup("eta")),
106 p_(kineticTheoryProperties_.lookup("p")),
107 phi_(dimensionedScalar(kineticTheoryProperties_.lookup("phi"))*M_PI/180.0),
113 Ua_.time().timeName(),
125 Ua_.time().timeName(),
131 dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
138 Ua_.time().timeName(),
144 dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
151 Ua_.time().timeName(),
157 dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
164 Ua_.time().timeName(),
170 dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
177 Ua_.time().timeName(),
183 dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 1.0)
188 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
190 Foam::kineticTheoryModel::~kineticTheoryModel()
194 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
196 void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
203 const scalar sqrtPi = sqrt(constant::mathematical::pi);
205 surfaceScalarField phi(1.5*rhoa_*phia_*fvc::interpolate(alpha_));
207 volTensorField dU(gradUat.T()); //fvc::grad(Ua_);
208 volSymmTensorField D(symm(dU));
210 // NB, drag = K*alpha*beta,
211 // (the alpha and beta has been extracted from the drag function for
212 // numerical reasons)
213 volScalarField Ur(mag(Ua_ - Ub_));
214 volScalarField betaPrim(alpha_*(1.0 - alpha_)*draga_.K(Ur));
216 // Calculating the radial distribution function (solid volume fraction is
217 // limited close to the packing limit, but this needs improvements)
218 // The solution is higly unstable close to the packing limit.
219 gs0_ = radialModel_->g0
221 min(max(alpha_, scalar(1e-6)), alphaMax_ - 0.01),
225 // particle pressure - coefficient in front of Theta (Eq. 3.22, p. 45)
226 volScalarField PsCoeff
228 granularPressureModel_->granularPressureCoeff
237 // 'thermal' conductivity (Table 3.3, p. 49)
238 kappa_ = conductivityModel_->kappa(alpha_, Theta_, gs0_, rhoa_, da_, e_);
240 // particle viscosity (Table 3.2, p.47)
241 mua_ = viscosityModel_->mua(alpha_, Theta_, gs0_, rhoa_, da_, e_);
243 dimensionedScalar Tsmall
246 dimensionSet(0 , 2 ,-2 ,0 , 0, 0, 0),
250 dimensionedScalar TsmallSqrt = sqrt(Tsmall);
251 volScalarField ThetaSqrt(sqrt(Theta_));
253 // dissipation (Eq. 3.24, p.50)
254 volScalarField gammaCoeff
256 12.0*(1.0 - sqr(e_))*sqr(alpha_)*rhoa_*gs0_*(1.0/da_)*ThetaSqrt/sqrtPi
259 // Eq. 3.25, p. 50 Js = J1 - J2
260 volScalarField J1(3.0*betaPrim);
263 0.25*sqr(betaPrim)*da_*sqr(Ur)
264 /(max(alpha_, scalar(1e-6))*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt))
267 // bulk viscosity p. 45 (Lun et al. 1984).
268 lambda_ = (4.0/3.0)*sqr(alpha_)*rhoa_*da_*gs0_*(1.0+e_)*ThetaSqrt/sqrtPi;
270 // stress tensor, Definitions, Table 3.1, p. 43
271 volSymmTensorField tau(2.0*mua_*D + (lambda_ - (2.0/3.0)*mua_)*tr(D)*I);
275 // construct the granular temperature equation (Eq. 3.20, p. 44)
276 // NB. note that there are two typos in Eq. 3.20
277 // no grad infront of Ps
278 // wrong sign infront of laplacian
279 fvScalarMatrix ThetaEqn
281 fvm::ddt(1.5*alpha_*rhoa_, Theta_)
282 + fvm::div(phi, Theta_, "div(phi,Theta)")
284 fvm::SuSp(-((PsCoeff*I) && dU), Theta_)
286 + fvm::laplacian(kappa_, Theta_, "laplacian(kappa,Theta)")
287 + fvm::Sp(-gammaCoeff, Theta_)
288 + fvm::Sp(-J1, Theta_)
289 + fvm::Sp(J2/(Theta_ + Tsmall), Theta_)
297 // equilibrium => dissipation == production
299 volScalarField K1(2.0*(1.0 + e_)*rhoa_*gs0_);
304 (sqrtPi/(3.0*(3.0-e_)))
305 *(1.0 + 0.4*(1.0 + e_)*(3.0*e_ - 1.0)*alpha_*gs0_)
306 +1.6*alpha_*gs0_*(1.0 + e_)/sqrtPi
312 4.0*da_*rhoa_*(1.0 + e_)*alpha_*gs0_/(3.0*sqrtPi) - 2.0*K3/3.0
315 volScalarField K4(12.0*(1.0 - sqr(e_))*rhoa_*gs0_/(da_*sqrtPi));
317 volScalarField trD(tr(D));
318 volScalarField tr2D(sqr(trD));
319 volScalarField trD2(tr(D & D));
321 volScalarField t1(K1*alpha_ + rhoa_);
322 volScalarField l1(-t1*trD);
323 volScalarField l2(sqr(t1)*tr2D);
328 *max(alpha_, scalar(1e-6))
329 *(2.0*K3*trD2 + K2*tr2D)
332 Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha_ + 1.0e-4)*K4));
340 frictionalStressModel_->frictionalPressure
351 PsCoeff += pf/(Theta_+Tsmall);
353 PsCoeff.min(1.0e+10);
354 PsCoeff.max(-1.0e+10);
356 // update particle pressure
357 pa_ = PsCoeff*Theta_;
359 // frictional shear stress, Eq. 3.30, p. 52
362 frictionalStressModel_->muf
372 // add frictional stress
377 Info<< "kinTheory: max(Theta) = " << max(Theta_).value() << endl;
379 volScalarField ktn(mua_/rhoa_);
381 Info<< "kinTheory: min(nua) = " << min(ktn).value()
382 << ", max(nua) = " << max(ktn).value() << endl;
384 Info<< "kinTheory: min(pa) = " << min(pa_).value()
385 << ", max(pa) = " << max(pa_).value() << endl;
389 // ************************************************************************* //