chemistryModel: Added optional Treact to reduce the time of chemistry evaluation

Treact: Temperature below which the reaction rates are assumed 0
This commit is contained in:
Henry
2015-05-10 12:31:17 +01:00
parent ca07af4e64
commit 5acc3dbdd5
3 changed files with 59 additions and 22 deletions

View File

@ -51,7 +51,7 @@ Foam::chemistryModel<CompType, ThermoType>::chemistryModel
nSpecie_(Y_.size()),
nReaction_(reactions_.size()),
Treact_(CompType::template lookupOrDefault<scalar>("Treact", 0.0)),
RR_(nSpecie_)
{
// create the fields for the chemistry sources
@ -796,32 +796,44 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
forAll(rho, celli)
{
const scalar rhoi = rho[celli];
scalar pi = p[celli];
scalar Ti = T[celli];
for (label i=0; i<nSpecie_; i++)
if (Ti > Treact_)
{
c[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
c0[i] = c[i];
const scalar rhoi = rho[celli];
scalar pi = p[celli];
for (label i=0; i<nSpecie_; i++)
{
c[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
c0[i] = c[i];
}
// Initialise time progress
scalar timeLeft = deltaT[celli];
// Calculate the chemical source terms
while (timeLeft > SMALL)
{
scalar dt = timeLeft;
this->solve(c, Ti, pi, dt, this->deltaTChem_[celli]);
timeLeft -= dt;
}
deltaTMin = min(this->deltaTChem_[celli], deltaTMin);
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] =
(c[i] - c0[i])*specieThermo_[i].W()/deltaT[celli];
}
}
// Initialise time progress
scalar timeLeft = deltaT[celli];
// Calculate the chemical source terms
while (timeLeft > SMALL)
else
{
scalar dt = timeLeft;
this->solve(c, Ti, pi, dt, this->deltaTChem_[celli]);
timeLeft -= dt;
}
deltaTMin = min(this->deltaTChem_[celli], deltaTMin);
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = (c[i] - c0[i])*specieThermo_[i].W()/deltaT[celli];
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = 0;
}
}
}

View File

@ -97,6 +97,9 @@ protected:
//- Number of reactions
label nReaction_;
//- Temperature below which the reaction rates are assumed 0
scalar Treact_;
//- List of reaction rate per specie [kg/m3/s]
PtrList<DimensionedField<scalar, volMesh> > RR_;
@ -138,6 +141,12 @@ public:
//- The number of reactions
inline label nReaction() const;
//- Temperature below which the reaction rates are assumed 0
inline scalar Treact() const;
//- Temperature below which the reaction rates are assumed 0
inline scalar& Treact();
//- dc/dt = omega, rate of change in concentration, for each species
virtual tmp<scalarField> omega
(

View File

@ -68,6 +68,22 @@ Foam::chemistryModel<CompType, ThermoType>::nReaction() const
}
template<class CompType, class ThermoType>
inline Foam::scalar
Foam::chemistryModel<CompType, ThermoType>::Treact() const
{
return Treact_;
}
template<class CompType, class ThermoType>
inline Foam::scalar&
Foam::chemistryModel<CompType, ThermoType>::Treact()
{
return Treact_;
}
template<class CompType, class ThermoType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::chemistryModel<CompType, ThermoType>::RR