33 template<
class ChemistryModel>
36 const typename ChemistryModel::reactionThermo& thermo
40 coeffsDict_(this->subDict(
"EulerImplicitCoeffs")),
41 cTauChem_(coeffsDict_.lookup<scalar>(
"cTauChem")),
42 eqRateLimiter_(coeffsDict_.lookup(
"equilibriumRateLimiter")),
49 template<
class ChemistryModel>
56 template<
class ChemistryModel>
71 this->reactions_[index];
76 const scalar sl = R.
lhs()[
s].stoichCoeff;
77 RR[si][rRef] -= sl*pr*corr;
78 RR[si][lRef] += sl*pf*corr;
84 const scalar sr = R.
rhs()[
s].stoichCoeff;
85 RR[si][lRef] -= sr*pf*corr;
86 RR[si][rRef] += sr*pr*corr;
91 template<
class ChemistryModel>
111 const scalar cTot =
sum(c);
112 typename ChemistryModel::thermoType
mixture 114 (this->specieThermos_[0].
W()*c[0])*this->specieThermos_[0]
118 mixture += (this->specieThermos_[i].W()*c[i])*this->specieThermos_[i];
120 const scalar ha = mixture.Ha(p, T);
121 const scalar deltaTEst =
min(deltaT, subDeltaT);
123 forAll(this->reactions(), i)
125 scalar pf, cf, pr, cr;
130 this->omegaI(i, p, T, c, li, pf, cf, lRef, pr, cr, rRef)
138 corr = 1/(1 + pr*deltaTEst);
142 corr = 1/(1 + pf*deltaTEst);
146 updateRRInReactionI(i, pr, pf, corr, lRef, rRef, p, T, RR);
162 tMin =
min(tMin, -(c[i] + small)/d);
167 const scalar cm =
max(cTot - c[i], 1
e-5);
168 tMin =
min(tMin, cm/d);
172 subDeltaT = cTauChem_*tMin;
173 deltaT =
min(deltaT, subDeltaT);
178 RR(i, i) += 1/deltaT;
179 RR.
source()[i] = c[i]/deltaT;
192 mixture = (this->specieThermos_[0].W()*c[0])*this->specieThermos_[0];
195 mixture += (this->specieThermos_[i].W()*c[i])*this->specieThermos_[i];
197 T = mixture.THa(ha, p, T);
Field< Type > & source()
Return access to the source.
#define forAll(list, i)
Loop across all elements in list.
An abstract base class for solving chemistry.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
rhoReactionThermo & thermo
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
EulerImplicit(const typename ChemistryModel::reactionThermo &thermo)
Construct from thermo.
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))
virtual void solve(scalar &p, scalar &T, scalarField &c, const label li, scalar &deltaT, scalar &subDeltaT) const
Update the concentrations and return the chemical time.
Field< Type > LUsolve() const
Solve the matrix using LU decomposition with pivoting.
const dimensionedScalar & e
Elementary charge.
A simple square matrix solver with scalar coefficients.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define R(A, B, C, D, E, F, K, M)
const scalarList W(::W(thermo))
const scalar RR
Universal gas constant (default in [J/kmol/K])
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
phaseChangeTwoPhaseMixture & mixture
void updateRRInReactionI(const label index, const scalar pr, const scalar pf, const scalar corr, const label lRef, const label rRef, const scalar p, const scalar T, simpleMatrix< scalar > &RR) const
virtual ~EulerImplicit()
Destructor.