mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
chemistryModel: Some basic optimisations
This commit is contained in:
@ -778,6 +778,9 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
|||||||
const scalarField& T = this->thermo().T();
|
const scalarField& T = this->thermo().T();
|
||||||
const scalarField& p = this->thermo().p();
|
const scalarField& p = this->thermo().p();
|
||||||
|
|
||||||
|
scalarField c(nSpecie_);
|
||||||
|
scalarField c0(nSpecie_);
|
||||||
|
|
||||||
forAll(rho, celli)
|
forAll(rho, celli)
|
||||||
{
|
{
|
||||||
const scalar rhoi = rho[celli];
|
const scalar rhoi = rho[celli];
|
||||||
@ -785,15 +788,11 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
|||||||
const scalar pi = p[celli];
|
const scalar pi = p[celli];
|
||||||
scalar Ti = T[celli];
|
scalar Ti = T[celli];
|
||||||
|
|
||||||
scalarField c(nSpecie_, 0.0);
|
|
||||||
scalarField c0(nSpecie_, 0.0);
|
|
||||||
scalarField dc(nSpecie_, 0.0);
|
|
||||||
|
|
||||||
for (label i=0; i<nSpecie_; i++)
|
for (label i=0; i<nSpecie_; i++)
|
||||||
{
|
{
|
||||||
c[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
|
c[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
|
||||||
|
c0[i] = c[i];
|
||||||
}
|
}
|
||||||
c0 = c;
|
|
||||||
|
|
||||||
// initialise timing parameters
|
// initialise timing parameters
|
||||||
scalar t = 0;
|
scalar t = 0;
|
||||||
@ -809,8 +808,8 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
|||||||
|
|
||||||
// update the temperature
|
// update the temperature
|
||||||
const scalar cTot = sum(c);
|
const scalar cTot = sum(c);
|
||||||
ThermoType mixture(0.0*specieThermo_[0]);
|
ThermoType mixture((c[0]/cTot)*specieThermo_[0]);
|
||||||
for (label i=0; i<nSpecie_; i++)
|
for (label i=1; i<nSpecie_; i++)
|
||||||
{
|
{
|
||||||
mixture += (c[i]/cTot)*specieThermo_[i];
|
mixture += (c[i]/cTot)*specieThermo_[i];
|
||||||
}
|
}
|
||||||
@ -822,10 +821,9 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
|||||||
}
|
}
|
||||||
deltaTMin = min(tauC, deltaTMin);
|
deltaTMin = min(tauC, deltaTMin);
|
||||||
|
|
||||||
dc = c - c0;
|
|
||||||
for (label i=0; i<nSpecie_; i++)
|
for (label i=0; i<nSpecie_; i++)
|
||||||
{
|
{
|
||||||
RR_[i][celli] = dc[i]*specieThermo_[i].W()/deltaT[celli];
|
RR_[i][celli] = (c[i] - c0[i])*specieThermo_[i].W()/deltaT[celli];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user