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
This commit is contained in:
Henry Weller
2017-06-26 14:09:12 +01:00
parent 53f0c26cf0
commit 38dd1a845d
2 changed files with 22 additions and 5 deletions

View File

@ -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;

View File

@ -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_;