kineticTheoryModel.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) 2011-2016 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 "kineticTheoryModel.H"
27 #include "mathematicalConstants.H"
28 #include "twoPhaseSystem.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 Foam::RASModels::kineticTheoryModel::kineticTheoryModel
33 (
34  const volScalarField& alpha,
35  const volScalarField& rho,
36  const volVectorField& U,
37  const surfaceScalarField& alphaRhoPhi,
38  const surfaceScalarField& phi,
39  const transportModel& phase,
40  const word& propertiesName,
41  const word& type
42 )
43 :
44  eddyViscosity
45  <
46  RASModel<EddyDiffusivity<ThermalDiffusivity
47  <
48  PhaseCompressibleTurbulenceModel<phaseModel>
49  >>>
50  >
51  (
52  type,
53  alpha,
54  rho,
55  U,
56  alphaRhoPhi,
57  phi,
58  phase,
59  propertiesName
60  ),
61 
62  phase_(phase),
63 
64  viscosityModel_
65  (
66  kineticTheoryModels::viscosityModel::New
67  (
68  coeffDict_
69  )
70  ),
71  conductivityModel_
72  (
73  kineticTheoryModels::conductivityModel::New
74  (
75  coeffDict_
76  )
77  ),
78  radialModel_
79  (
80  kineticTheoryModels::radialModel::New
81  (
82  coeffDict_
83  )
84  ),
85  granularPressureModel_
86  (
87  kineticTheoryModels::granularPressureModel::New
88  (
89  coeffDict_
90  )
91  ),
92  frictionalStressModel_
93  (
94  kineticTheoryModels::frictionalStressModel::New
95  (
96  coeffDict_
97  )
98  ),
99 
100  equilibrium_(coeffDict_.lookup("equilibrium")),
101  e_("e", dimless, coeffDict_),
102  alphaMax_("alphaMax", dimless, coeffDict_),
103  alphaMinFriction_
104  (
105  "alphaMinFriction",
106  dimless,
107  coeffDict_
108  ),
109  residualAlpha_
110  (
111  "residualAlpha",
112  dimless,
113  coeffDict_
114  ),
115 
116  Theta_
117  (
118  IOobject
119  (
120  IOobject::groupName("Theta", phase.name()),
121  U.time().timeName(),
122  U.mesh(),
123  IOobject::MUST_READ,
124  IOobject::AUTO_WRITE
125  ),
126  U.mesh()
127  ),
128 
129  lambda_
130  (
131  IOobject
132  (
133  IOobject::groupName("lambda", phase.name()),
134  U.time().timeName(),
135  U.mesh(),
136  IOobject::NO_READ,
137  IOobject::NO_WRITE
138  ),
139  U.mesh(),
140  dimensionedScalar("zero", dimensionSet(0, 2, -1, 0, 0), 0.0)
141  ),
142 
143  gs0_
144  (
145  IOobject
146  (
147  IOobject::groupName("gs0", phase.name()),
148  U.time().timeName(),
149  U.mesh(),
150  IOobject::NO_READ,
151  IOobject::NO_WRITE
152  ),
153  U.mesh(),
154  dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 0.0)
155  ),
156 
157  kappa_
158  (
159  IOobject
160  (
161  IOobject::groupName("kappa", phase.name()),
162  U.time().timeName(),
163  U.mesh(),
164  IOobject::NO_READ,
165  IOobject::NO_WRITE
166  ),
167  U.mesh(),
168  dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
169  )
170 {
171  if (type == typeName)
172  {
173  printCoeffs(type);
174  }
175 }
176 
177 
178 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
179 
181 {}
182 
183 
184 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
185 
187 {
188  if
189  (
190  eddyViscosity
191  <
192  RASModel<EddyDiffusivity<ThermalDiffusivity
193  <
194  PhaseCompressibleTurbulenceModel<phaseModel>
195  >>>
196  >::read()
197  )
198  {
199  coeffDict().lookup("equilibrium") >> equilibrium_;
200  e_.readIfPresent(coeffDict());
201  alphaMax_.readIfPresent(coeffDict());
202  alphaMinFriction_.readIfPresent(coeffDict());
203 
204  viscosityModel_->read();
205  conductivityModel_->read();
206  radialModel_->read();
207  granularPressureModel_->read();
208  frictionalStressModel_->read();
209 
210  return true;
211  }
212  else
213  {
214  return false;
215  }
216 }
217 
218 
221 {
223  return nut_;
224 }
225 
226 
229 {
231  return nut_;
232 }
233 
234 
237 {
238  return tmp<volSymmTensorField>
239  (
241  (
242  IOobject
243  (
244  IOobject::groupName("R", U_.group()),
245  runTime_.timeName(),
246  mesh_,
249  ),
250  - (nut_)*dev(twoSymm(fvc::grad(U_)))
251  - (lambda_*fvc::div(phi_))*symmTensor::I
252  )
253  );
254 }
255 
256 
259 {
260  const volScalarField& rho = phase_.rho();
261 
262  tmp<volScalarField> tpPrime
263  (
264  Theta_
265  *granularPressureModel_->granularPressureCoeffPrime
266  (
267  alpha_,
268  radialModel_->g0(alpha_, alphaMinFriction_, alphaMax_),
269  radialModel_->g0prime(alpha_, alphaMinFriction_, alphaMax_),
270  rho,
271  e_
272  )
273  + frictionalStressModel_->frictionalPressurePrime
274  (
275  alpha_,
276  alphaMinFriction_,
277  alphaMax_
278  )
279  );
280 
281  volScalarField::Boundary& bpPrime =
282  tpPrime.ref().boundaryFieldRef();
283 
284  forAll(bpPrime, patchi)
285  {
286  if (!bpPrime[patchi].coupled())
287  {
288  bpPrime[patchi] == 0;
289  }
290  }
291 
292  return tpPrime;
293 }
294 
295 
298 {
299  return fvc::interpolate(pPrime());
300 }
301 
302 
305 {
306  return tmp<volSymmTensorField>
307  (
309  (
310  IOobject
311  (
312  IOobject::groupName("devRhoReff", U_.group()),
313  runTime_.timeName(),
314  mesh_,
317  ),
318  - (rho_*nut_)
319  *dev(twoSymm(fvc::grad(U_)))
320  - ((rho_*lambda_)*fvc::div(phi_))*symmTensor::I
321  )
322  );
323 }
324 
325 
328 (
329  volVectorField& U
330 ) const
331 {
332  return
333  (
334  - fvm::laplacian(rho_*nut_, U)
335  - fvc::div
336  (
337  (rho_*nut_)*dev2(T(fvc::grad(U)))
338  + ((rho_*lambda_)*fvc::div(phi_))
339  *dimensioned<symmTensor>("I", dimless, symmTensor::I)
340  )
341  );
342 }
343 
344 
346 {
347  // Local references
348  volScalarField alpha(max(alpha_, scalar(0)));
349  const volScalarField& rho = phase_.rho();
350  const surfaceScalarField& alphaRhoPhi = alphaRhoPhi_;
351  const volVectorField& U = U_;
352  const volVectorField& Uc_ =
353  refCast<const twoPhaseSystem>(phase_.fluid()).otherPhase(phase_).U();
354 
355  const scalar sqrtPi = sqrt(constant::mathematical::pi);
356  dimensionedScalar ThetaSmall("ThetaSmall", Theta_.dimensions(), 1.0e-6);
357  dimensionedScalar ThetaSmallSqrt(sqrt(ThetaSmall));
358 
359  tmp<volScalarField> tda(phase_.d());
360  const volScalarField& da = tda();
361 
362  tmp<volTensorField> tgradU(fvc::grad(U_));
363  const volTensorField& gradU(tgradU());
364  volSymmTensorField D(symm(gradU));
365 
366  // Calculating the radial distribution function
367  gs0_ = radialModel_->g0(alpha, alphaMinFriction_, alphaMax_);
368 
369  if (!equilibrium_)
370  {
371  // Particle viscosity (Table 3.2, p.47)
372  nut_ = viscosityModel_->nu(alpha, Theta_, gs0_, rho, da, e_);
373 
374  volScalarField ThetaSqrt("sqrtTheta", sqrt(Theta_));
375 
376  // Bulk viscosity p. 45 (Lun et al. 1984).
377  lambda_ = (4.0/3.0)*sqr(alpha)*da*gs0_*(1.0 + e_)*ThetaSqrt/sqrtPi;
378 
379  // Stress tensor, Definitions, Table 3.1, p. 43
381  (
382  rho*(2.0*nut_*D + (lambda_ - (2.0/3.0)*nut_)*tr(D)*I)
383  );
384 
385  // Dissipation (Eq. 3.24, p.50)
386  volScalarField gammaCoeff
387  (
388  "gammaCoeff",
389  12.0*(1.0 - sqr(e_))
390  *max(sqr(alpha), residualAlpha_)
391  *rho*gs0_*(1.0/da)*ThetaSqrt/sqrtPi
392  );
393 
394  // Drag
396  (
397  refCast<const twoPhaseSystem>(phase_.fluid()).drag(phase_).K()
398  );
399 
400  // Eq. 3.25, p. 50 Js = J1 - J2
401  volScalarField J1("J1", 3.0*beta);
402  volScalarField J2
403  (
404  "J2",
405  0.25*sqr(beta)*da*magSqr(U - Uc_)
406  /(
407  max(alpha, residualAlpha_)*rho
408  *sqrtPi*(ThetaSqrt + ThetaSmallSqrt)
409  )
410  );
411 
412  // particle pressure - coefficient in front of Theta (Eq. 3.22, p. 45)
413  volScalarField PsCoeff
414  (
415  granularPressureModel_->granularPressureCoeff
416  (
417  alpha,
418  gs0_,
419  rho,
420  e_
421  )
422  );
423 
424  // 'thermal' conductivity (Table 3.3, p. 49)
425  kappa_ = conductivityModel_->kappa(alpha, Theta_, gs0_, rho, da, e_);
426 
427  // Construct the granular temperature equation (Eq. 3.20, p. 44)
428  // NB. note that there are two typos in Eq. 3.20:
429  // Ps should be without grad
430  // the laplacian has the wrong sign
431  fvScalarMatrix ThetaEqn
432  (
433  1.5*
434  (
435  fvm::ddt(alpha, rho, Theta_)
436  + fvm::div(alphaRhoPhi, Theta_)
437  - fvc::Sp(fvc::ddt(alpha, rho) + fvc::div(alphaRhoPhi), Theta_)
438  )
439  - fvm::laplacian(kappa_, Theta_, "laplacian(kappa,Theta)")
440  ==
441  - fvm::SuSp((PsCoeff*I) && gradU, Theta_)
442  + (tau && gradU)
443  + fvm::Sp(-gammaCoeff, Theta_)
444  + fvm::Sp(-J1, Theta_)
445  + fvm::Sp(J2/(Theta_ + ThetaSmall), Theta_)
446  );
447 
448  ThetaEqn.relax();
449  ThetaEqn.solve();
450  }
451  else
452  {
453  // Equilibrium => dissipation == production
454  // Eq. 4.14, p.82
455  volScalarField K1("K1", 2.0*(1.0 + e_)*rho*gs0_);
457  (
458  "K3",
459  0.5*da*rho*
460  (
461  (sqrtPi/(3.0*(3.0 - e_)))
462  *(1.0 + 0.4*(1.0 + e_)*(3.0*e_ - 1.0)*alpha*gs0_)
463  +1.6*alpha*gs0_*(1.0 + e_)/sqrtPi
464  )
465  );
466 
468  (
469  "K2",
470  4.0*da*rho*(1.0 + e_)*alpha*gs0_/(3.0*sqrtPi) - 2.0*K3/3.0
471  );
472 
473  volScalarField K4("K4", 12.0*(1.0 - sqr(e_))*rho*gs0_/(da*sqrtPi));
474 
475  volScalarField trD
476  (
477  "trD",
478  alpha/(alpha + residualAlpha_)
479  *fvc::div(phi_)
480  );
481  volScalarField tr2D("tr2D", sqr(trD));
482  volScalarField trD2("trD2", tr(D & D));
483 
484  volScalarField t1("t1", K1*alpha + rho);
485  volScalarField l1("l1", -t1*trD);
486  volScalarField l2("l2", sqr(t1)*tr2D);
487  volScalarField l3
488  (
489  "l3",
490  4.0
491  *K4
492  *alpha
493  *(2.0*K3*trD2 + K2*tr2D)
494  );
495 
496  Theta_ = sqr
497  (
498  (l1 + sqrt(l2 + l3))
499  /(2.0*max(alpha, residualAlpha_)*K4)
500  );
501 
502  kappa_ = conductivityModel_->kappa(alpha, Theta_, gs0_, rho, da, e_);
503  }
504 
505  Theta_.max(0);
506  Theta_.min(100);
507 
508  {
509  // particle viscosity (Table 3.2, p.47)
510  nut_ = viscosityModel_->nu(alpha, Theta_, gs0_, rho, da, e_);
511 
512  volScalarField ThetaSqrt("sqrtTheta", sqrt(Theta_));
513 
514  // Bulk viscosity p. 45 (Lun et al. 1984).
515  lambda_ = (4.0/3.0)*sqr(alpha)*da*gs0_*(1.0 + e_)*ThetaSqrt/sqrtPi;
516 
517  // Frictional pressure
518  volScalarField pf
519  (
520  frictionalStressModel_->frictionalPressure
521  (
522  alpha,
523  alphaMinFriction_,
524  alphaMax_
525  )
526  );
527 
528  // Add frictional shear viscosity, Eq. 3.30, p. 52
529  nut_ += frictionalStressModel_->nu
530  (
531  alpha,
532  alphaMinFriction_,
533  alphaMax_,
534  pf/rho,
535  D
536  );
537 
538  // Limit viscosity
539  nut_.min(100);
540  }
541 
542  if (debug)
543  {
544  Info<< typeName << ':' << nl
545  << " max(Theta) = " << max(Theta_).value() << nl
546  << " max(nut) = " << max(nut_).value() << endl;
547  }
548 }
549 
550 
551 // ************************************************************************* //
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:58
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
#define K1
Definition: SHA1.C:167
#define K4
Definition: SHA1.C:170
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define K2
Definition: SHA1.C:168
tmp< fvMatrix< Type > > Sp(const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
GeometricField< tensor, fvPatchField, volMesh > volTensorField
Definition: volFieldsFwd.H:59
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
#define K3
Definition: SHA1.C:169
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
virtual tmp< volScalarField > pPrime() const
Return the phase-pressure&#39;.
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:67
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
Info<< "Reading strained laminar flame speed field Su\n"<< endl;volScalarField Su(IOobject("Su", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field betav\n"<< endl;volScalarField betav(IOobject("betav", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field Lobs\n"<< endl;volScalarField Lobs(IOobject("Lobs", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field CT\n"<< endl;volSymmTensorField CT(IOobject("CT", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field Nv\n"<< endl;volScalarField Nv(IOobject("Nv", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field nsv\n"<< endl;volSymmTensorField nsv(IOobject("nsv", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);IOdictionary PDRProperties(IOobject("PDRProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));autoPtr< PDRDragModel > drag
Definition: createFields.H:182
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
stressControl lookup("compactNormalStress") >> compactNormalStress
dynamicFvMesh & mesh
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
static const SymmTensor I
Definition: SymmTensor.H:72
tmp< fvMatrix< Type > > SuSp(const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
static word groupName(Name name, const word &group)
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:46
virtual tmp< volSymmTensorField > devRhoReff() const
Return the effective stress tensor.
virtual void correct()
Solve the kinetic theory equations and correct the viscosity.
word timeName
Definition: getTimeIndex.H:3
void min(const dimensioned< Type > &)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
virtual tmp< surfaceScalarField > pPrimef() const
Return the face-phase-pressure&#39;.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual ~kineticTheoryModel()
Destructor.
static const char nl
Definition: Ostream.H:262
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:46
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
virtual tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the source term for the momentum equation.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
RASModel< EddyDiffusivity< turbulenceModel > > RASModel
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
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.
Internal & ref()
Return a reference to the dimensioned internal field.
label patchi
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:46
virtual bool read()
Re-read model coefficients if they have changed.
messageStream Info
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate.
A class for managing temporary objects.
Definition: PtrList.H:54
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366