36template<
class ChemistryModel>
39 typename ChemistryModel::reactionThermo&
thermo
43 coeffsDict_(this->subDict(
"EulerImplicitCoeffs")),
44 cTauChem_(coeffsDict_.get<scalar>(
"cTauChem")),
45 eqRateLimiter_(coeffsDict_.get<
Switch>(
"equilibriumRateLimiter")),
52template<
class ChemistryModel>
59template<
class ChemistryModel>
74 this->reactions_[index];
78 const label si =
R.lhs()[
s].index;
79 const scalar sl =
R.lhs()[
s].stoichCoeff;
80 RR[si][rRef] -= sl*pr*corr;
81 RR[si][lRef] += sl*pf*corr;
86 const label si =
R.rhs()[
s].index;
87 const scalar sr =
R.rhs()[
s].stoichCoeff;
88 RR[si][lRef] -= sr*pf*corr;
89 RR[si][rRef] += sr*pr*corr;
94template<
class ChemistryModel>
105 simpleMatrix<scalar> RR(
nSpecie, 0, 0);
107 for (label i=0; i<
nSpecie; i++)
113 const scalar cTot =
sum(c);
114 typename ChemistryModel::thermoType
mixture
116 (this->specieThermo_[0].W()*c[0])*this->specieThermo_[0]
118 for (label i=1; i<
nSpecie; i++)
120 mixture += (this->specieThermo_[i].W()*c[i])*this->specieThermo_[i];
123 const scalar deltaTEst =
min(deltaT, subDeltaT);
125 forAll(this->reactions(), i)
127 scalar pf, cf, pr, cr;
130 const scalar omegai =
131 this->omegaI(i, c,
T,
p, 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);
152 for (label i=0; i<
nSpecie; i++)
155 for (label j=0; j<
nSpecie; j++)
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);
176 for (label i=0; i<
nSpecie; i++)
178 RR(i, i) += 1/deltaT;
179 RR.source()[i] =
c[i]/deltaT;
186 for (label i=0; i<
nSpecie; i++)
192 mixture = (this->specieThermo_[0].W()*c[0])*this->specieThermo_[0];
193 for (label i=1; i<
nSpecie; i++)
195 mixture += (this->specieThermo_[i].W()*c[i])*this->specieThermo_[i];
#define R(A, B, C, D, E, F, K, M)
Macros for easy insertion into run-time selection tables.
virtual void solve(scalarField &c, scalar &T, scalar &p, scalar &deltaT, scalar &subDeltaT) const
Update the concentrations and return the chemical time.
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
EulerImplicit(typename ChemistryModel::reactionThermo &thermo)
Construct from thermo.
virtual ~EulerImplicit()
Destructor.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
chemistrySolver(typename ChemistryModel::reactionThermo &thermo)
Construct from thermo.
A simple square matrix solver with scalar coefficients.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
const scalar RR
Universal gas constant: default in [J/(kmol K)].
const dimensionedScalar c
Speed of light in a vacuum.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
#define forAll(list, i)
Loop across all elements in list.