Commit abc56888 authored by Henry Weller's avatar Henry Weller Committed by Andrew Heather
Browse files

TDACChemistryModel: improved reporting of CPU time

Added a grow time and better allocate the CPU time to either add or grow.  This
gives much more information to the user and helps changing the settings
accordingly.

Patch contributed by Francesco Contino
parent 00f6ea83
......@@ -123,6 +123,7 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
if (tabulation_->log())
{
cpuAddFile_ = logFile("cpu_add.out");
cpuGrowFile_ = logFile("cpu_grow.out");
cpuRetrieveFile_ = logFile("cpu_retrieve.out");
}
......@@ -613,6 +614,7 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
clockTime_.timeIncrement();
scalar reduceMechCpuTime_ = 0;
scalar addNewLeafCpuTime_ = 0;
scalar growCpuTime_ = 0;
scalar solveChemistryCpuTime_ = 0;
scalar searchISATCpuTime_ = 0;
......@@ -703,17 +705,20 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
// (it will either expand the current data or add a new stored point).
else
{
clockTime_.timeIncrement();
// Store total time waiting to attribute to add or grow
scalar timeTmp = clockTime_.timeIncrement();
if (reduced)
{
// Reduce mechanism change the number of species (only active)
mechRed_->reduceMechanism(c, Ti, pi);
nActiveSpecies += mechRed_->NsSimp();
nAvg++;
scalar timeIncr = clockTime_.timeIncrement();
reduceMechCpuTime_ += timeIncr;
timeTmp += timeIncr;
}
reduceMechCpuTime_ += clockTime_.timeIncrement();
// Calculate the chemical source terms
while (timeLeft > SMALL)
{
......@@ -742,7 +747,11 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
timeLeft -= dt;
}
solveChemistryCpuTime_ += clockTime_.timeIncrement();
{
scalar timeIncr = clockTime_.timeIncrement();
solveChemistryCpuTime_ += timeIncr;
timeTmp += timeIncr;
}
// If tabulation is used, we add the information computed here to
// the stored points (either expand or add)
......@@ -768,13 +777,14 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
if (growOrAdd)
{
this->setTabulationResultsAdd(celli);
addNewLeafCpuTime_ += clockTime_.timeIncrement() + timeTmp;
}
else
{
this->setTabulationResultsGrow(celli);
growCpuTime_ += clockTime_.timeIncrement() + timeTmp;
}
}
addNewLeafCpuTime_ += clockTime_.timeIncrement();
// When operations are done and if mechanism reduction is active,
// the number of species (which also affects nEqns) is set back
......@@ -822,6 +832,10 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
<< this->time().timeOutputValue()
<< " " << searchISATCpuTime_ << endl;
cpuGrowFile_()
<< this->time().timeOutputValue()
<< " " << growCpuTime_ << endl;
cpuAddFile_()
<< this->time().timeOutputValue()
<< " " << addNewLeafCpuTime_ << endl;
......
......@@ -111,6 +111,9 @@ class TDACChemistryModel
//- Log file for the average time spent adding tabulated data
autoPtr<OFstream> cpuAddFile_;
//- Log file for the average time spent growing tabulated data
autoPtr<OFstream> cpuGrowFile_;
//- Log file for the average time spent retrieving tabulated data
autoPtr<OFstream> cpuRetrieveFile_;
......
Supports Markdown
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