Go to the documentation of this file.
32 template<
class CompType,
class ThermoType>
39 CompType(
mesh, phaseName),
49 (this->
thermo()).speciesData()
53 nReaction_(reactions_.size()),
54 Treact_(CompType::template lookupOrDefault<scalar>(
"Treact", 0.0)),
67 "RR." + Y_[fieldI].
name(),
68 mesh.time().timeName(),
79 Info<<
"chemistryModel: Number of species = " << nSpecie_
80 <<
" and reactions = " << nReaction_ <<
endl;
86 template<
class CompType,
class ThermoType>
93 template<
class CompType,
class ThermoType>
102 scalar pf, cf, pr, cr;
112 scalar omegai = omega
114 R,
c,
T,
p, pf, cf, lRef, pr, cr, rRef
119 const label si =
R.lhs()[
s].index;
120 const scalar sl =
R.lhs()[
s].stoichCoeff;
126 const label si =
R.rhs()[
s].index;
127 const scalar sr =
R.rhs()[
s].stoichCoeff;
136 template<
class CompType,
class ThermoType>
153 scalar
w = omega(
R,
c,
T,
p, pf, cf, lRef, pr, cr, rRef);
158 template<
class CompType,
class ThermoType>
174 for (
label i = 0; i < nSpecie_; i++)
179 const scalar kf =
R.kf(
p,
T,
c2);
180 const scalar kr =
R.kr(kf,
p,
T,
c2);
185 const label Nl =
R.lhs().size();
186 const label Nr =
R.rhs().size();
189 lRef =
R.lhs()[slRef].index;
194 const label si =
R.lhs()[
s].index;
198 const scalar
exp =
R.lhs()[slRef].exponent;
205 const scalar
exp =
R.lhs()[
s].exponent;
209 cf =
max(0.0,
c[lRef]);
212 const scalar
exp =
R.lhs()[slRef].exponent;
231 rRef =
R.rhs()[srRef].index;
237 const label si =
R.rhs()[
s].index;
240 const scalar
exp =
R.rhs()[srRef].exponent;
247 const scalar
exp =
R.rhs()[
s].exponent;
251 cr =
max(0.0,
c[rRef]);
254 const scalar
exp =
R.rhs()[srRef].exponent;
272 return pf*cf - pr*cr;
276 template<
class CompType,
class ThermoType>
284 const scalar
T =
c[nSpecie_];
285 const scalar
p =
c[nSpecie_ + 1];
287 dcdt = omega(
c,
T,
p);
293 for (
label i = 0; i < nSpecie_; i++)
295 const scalar W = specieThermo_[i].W();
300 for (
label i=0; i<nSpecie_; i++)
302 cp +=
c[i]*specieThermo_[i].cp(
p,
T);
307 for (
label i = 0; i < nSpecie_; i++)
309 const scalar hi = specieThermo_[i].ha(
p,
T);
314 dcdt[nSpecie_] = -dT;
317 dcdt[nSpecie_ + 1] = 0.0;
321 template<
class CompType,
class ThermoType>
330 const scalar
T =
c[nSpecie_];
331 const scalar
p =
c[nSpecie_ + 1];
339 for (
label i=0; i<nEqns(); i++)
341 for (
label j=0; j<nEqns(); j++)
348 dcdt = omega(
c2,
T,
p);
354 const scalar kf0 =
R.kf(
p,
T,
c2);
355 const scalar kr0 =
R.kr(kf0,
p,
T,
c2);
359 const label sj =
R.lhs()[j].index;
363 const label si =
R.lhs()[i].index;
364 const scalar el =
R.lhs()[i].exponent;
371 kf *= el*
pow(
c2[si] + VSMALL, el - 1.0);
380 kf *= el*
pow(
c2[si], el - 1.0);
385 kf *=
pow(
c2[si], el);
391 const label si =
R.lhs()[i].index;
392 const scalar sl =
R.lhs()[i].stoichCoeff;
393 dfdc[si][sj] -= sl*kf;
397 const label si =
R.rhs()[i].index;
398 const scalar sr =
R.rhs()[i].stoichCoeff;
399 dfdc[si][sj] += sr*kf;
405 const label sj =
R.rhs()[j].index;
409 const label si =
R.rhs()[i].index;
410 const scalar er =
R.rhs()[i].exponent;
417 kr *= er*
pow(
c2[si] + VSMALL, er - 1.0);
426 kr *= er*
pow(
c2[si], er - 1.0);
431 kr *=
pow(
c2[si], er);
437 const label si =
R.lhs()[i].index;
438 const scalar sl =
R.lhs()[i].stoichCoeff;
439 dfdc[si][sj] += sl*kr;
443 const label si =
R.rhs()[i].index;
444 const scalar sr =
R.rhs()[i].stoichCoeff;
445 dfdc[si][sj] -= sr*kr;
451 const scalar
delta = 1.0e-3;
455 for (
label i = 0; i < nEqns(); i++)
462 template<
class CompType,
class ThermoType>
466 scalar pf, cf, pr, cr;
498 zeroGradientFvPatchScalarField::typeName
506 const label nReaction = reactions_.size();
508 if (this->chemistry_)
512 scalar rhoi =
rho[celli];
513 scalar Ti =
T[celli];
514 scalar
pi =
p[celli];
518 for (
label i=0; i<nSpecie_; i++)
520 scalar Yi = Y_[i][celli];
521 c[i] = rhoi*Yi/specieThermo_[i].W();
529 omega(
R,
c, Ti,
pi, pf, cf, lRef, pr, cr, rRef);
533 scalar sr =
R.rhs()[
s].stoichCoeff;
534 tc[celli] += sr*pf*cf;
537 tc[celli] = nReaction*cSum/tc[celli];
542 ttc().correctBoundaryConditions();
548 template<
class CompType,
class ThermoType>
559 this->mesh_.time().timeName(),
567 zeroGradientFvPatchScalarField::typeName
572 if (this->chemistry_)
580 const scalar hi = specieThermo_[i].Hc();
581 Sh[cellI] -= hi*RR_[i][cellI];
590 template<
class CompType,
class ThermoType>
601 this->mesh_.time().timeName(),
609 zeroGradientFvPatchScalarField::typeName
613 if (this->chemistry_)
616 dQ.dimensionedInternalField() = this->mesh_.V()*
Sh()();
623 template<
class CompType,
class ThermoType>
631 template<
class CompType,
class ThermoType>
635 const label reactionI,
639 scalar pf, cf, pr, cr;
680 const scalar rhoi =
rho[celli];
681 const scalar Ti =
T[celli];
682 const scalar
pi =
p[celli];
685 for (
label i=0; i<nSpecie_; i++)
687 const scalar Yi = Y_[i][celli];
688 c[i] = rhoi*Yi/specieThermo_[i].W();
691 const scalar
w = omegaI
705 RR[celli] =
w*specieThermo_[speciei].W();
713 template<
class CompType,
class ThermoType>
716 if (!this->chemistry_)
740 const scalar rhoi =
rho[celli];
741 const scalar Ti =
T[celli];
742 const scalar
pi =
p[celli];
745 for (
label i=0; i<nSpecie_; i++)
747 const scalar Yi = Y_[i][celli];
748 c[i] = rhoi*Yi/specieThermo_[i].W();
753 for (
label i=0; i<nSpecie_; i++)
755 RR_[i][celli] = dcdt[i]*specieThermo_[i].W();
761 template<
class CompType,
class ThermoType>
762 template<
class DeltaTType>
765 const DeltaTType& deltaT
770 scalar deltaTMin = GREAT;
772 if (!this->chemistry_)
799 scalar Ti =
T[celli];
803 const scalar rhoi =
rho[celli];
804 scalar
pi =
p[celli];
806 for (
label i=0; i<nSpecie_; i++)
808 c[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
813 scalar timeLeft = deltaT[celli];
816 while (timeLeft > SMALL)
818 scalar dt = timeLeft;
819 this->
solve(c, Ti,
pi, dt, this->deltaTChem_[celli]);
823 deltaTMin =
min(this->deltaTChem_[celli], deltaTMin);
825 for (
label i=0; i<nSpecie_; i++)
828 (
c[i] - c0[i])*specieThermo_[i].W()/deltaT[celli];
833 for (
label i=0; i<nSpecie_; i++)
844 template<
class CompType,
class ThermoType>
859 template<
class CompType,
class ThermoType>
865 return this->solve<scalarField>(deltaT);
869 template<
class CompType,
class ThermoType>
const scalar RR
Universal gas constant (default in [J/(kmol K)])
virtual void calculate()
Calculates the reaction rates.
virtual tmp< volScalarField > dQ() const
Return the heat release, i.e. enthalpy/sec [kg/m2/s3].
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
chemistryModel(const chemistryModel &)
Disallow copy constructor.
A class for handling words, derived from string.
virtual void derivatives(const scalar t, const scalarField &c, scalarField &dcdt) const
Calculate the derivatives in dydx.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
const dimensionSet dimEnergy
virtual tmp< DimensionedField< scalar, volMesh > > calculateRR(const label reactionI, const label speciei) const
Return reaction rate of the speciei in reactionI.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar exp(const dimensionedScalar &ds)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
#define R(A, B, C, D, E, F, K, M)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
virtual tmp< volScalarField > tc() const
Return the chemical time scale.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const volScalarField & cp
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual tmp< scalarField > omega(const scalarField &c, const scalar T, const scalar p) const
dc/dt = omega, rate of change in concentration, for each species
virtual scalar omegaI(label iReaction, const scalarField &c, const scalar T, const scalar p, scalar &pf, scalar &cf, label &lRef, scalar &pr, scalar &cr, label &rRef) const
Return the reaction rate for iReaction and the reference.
Abstract base class for the systems of ordinary differential equations.
scalar solve(const DeltaTType &deltaT)
Solve the reaction system for the given time step.
volScalarField scalarField(fieldObject, mesh)
virtual void jacobian(const scalar t, const scalarField &c, scalarField &dcdt, scalarSquareMatrix &dfdc) const
Calculate the Jacobian of the system.
basicMultiComponentMixture & composition
const dimensionedScalar c
Speed of light in a vacuum.
const dimensionSet dimVolume(pow3(dimLength))
Generic GeometricField class.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual label nEqns() const
Number of ODE's to solve.
virtual tmp< volScalarField > Sh() const
Return source for enthalpy equation [kg/m/s3].
word name(const complex &)
Return a string representation of a complex.
PtrList< volScalarField > & Y
virtual ~chemistryModel()
Destructor.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...