Commit 10fa5172 authored by Andrew Heather's avatar Andrew Heather
Browse files

optimisation - removed double allocation of storage of t

parent 0f2ed0ee
......@@ -246,11 +246,9 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::omega
{
pr *= pow(cr, exp - 1.0);
}
}
return pf*cf - pr*cr;
}
......@@ -468,10 +466,27 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
this->thermo().rho()
);
label nCells = rho.size();
label nReaction = reactions_.size();
tmp<volScalarField> tsource
(
new volScalarField
(
IOobject
(
"tc",
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimTime, SMALL),
zeroGradientFvPatchScalarField::typeName
)
);
scalarField& t = tsource();
scalarField t(nCells, SMALL);
label nReaction = reactions_.size();
if (this->chemistry_)
{
......@@ -509,25 +524,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
}
}
tmp<volScalarField> tsource
(
new volScalarField
(
IOobject
(
"tc",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar("zero", dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
tsource().internalField() = t;
tsource().correctBoundaryConditions();
return tsource;
......@@ -682,7 +679,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
forAll(rho, celli)
{
for (label i=0; i<nSpecie(); i++)
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = 0.0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment