diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C index 52faf583b..e1993957e 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C @@ -118,7 +118,7 @@ void Foam::StandardChemistryModel::omega { const Reaction& R = reactions_[i]; - scalar omegai = omega + const scalar omegai = omega ( R, c, T, p, pf, cf, lRef, pr, cr, rRef ); @@ -587,9 +587,6 @@ Foam::StandardChemistryModel::calculateRR const label si ) const { - scalar pf, cf, pr, cr; - label lRef, rRef; - tmp tRR ( new volScalarField::Internal @@ -615,6 +612,9 @@ Foam::StandardChemistryModel::calculateRR const scalarField& T = this->thermo().T(); const scalarField& p = this->thermo().p(); + scalar pf, cf, pr, cr; + label lRef, rRef; + forAll(rho, celli) { const scalar rhoi = rho[celli]; @@ -627,21 +627,26 @@ Foam::StandardChemistryModel::calculateRR c_[i] = rhoi*Yi/specieThermo_[i].W(); } - const scalar w = omegaI - ( - ri, - c_, - Ti, - pi, - pf, - cf, - lRef, - pr, - cr, - rRef - ); + const Reaction& R = reactions_[ri]; + const scalar omegai = omega(R, c_, Ti, pi, pf, cf, lRef, pr, cr, rRef); - RR[celli] = w*specieThermo_[si].W(); + forAll(R.lhs(), s) + { + if (si == R.lhs()[s].index) + { + RR[celli] -= R.lhs()[s].stoichCoeff*omegai; + } + } + + forAll(R.rhs(), s) + { + if (si == R.rhs()[s].index) + { + RR[celli] += R.rhs()[s].stoichCoeff*omegai; + } + } + + RR[celli] *= specieThermo_[si].W(); } return tRR;