report pre/post time

This commit is contained in:
Tor Harald Sandve 2020-12-10 13:39:01 +01:00
parent 6e87ec6266
commit 6b7c0e630a
4 changed files with 26 additions and 4 deletions

View File

@ -226,8 +226,11 @@ namespace Opm {
/// Called once before each time step.
/// \param[in] timer simulation timer
void prepareStep(const SimulatorTimerInterface& timer)
SimulatorReportSingle prepareStep(const SimulatorTimerInterface& timer)
{
SimulatorReportSingle report;
Dune::Timer perfTimer;
perfTimer.start();
// update the solution variables in ebos
if ( timer.lastStepFailed() ) {
ebosSimulator_.model().updateFailed();
@ -251,6 +254,9 @@ namespace Opm {
std::cout << "equation scaling not suported yet" << std::endl;
//updateEquationsScaling();
}
report.pre_post_time += perfTimer.stop();
return report;
}
@ -394,9 +400,14 @@ namespace Opm {
/// Called once after each time step.
/// In this class, this function does nothing.
/// \param[in] timer simulation timer
void afterStep(const SimulatorTimerInterface& timer OPM_UNUSED)
SimulatorReportSingle afterStep(const SimulatorTimerInterface& timer OPM_UNUSED)
{
SimulatorReportSingle report;
Dune::Timer perfTimer;
perfTimer.start();
ebosSimulator_.problem().endTimeStep();
report.pre_post_time += perfTimer.stop();
return report;
}
/// Assemble the residual and Jacobian of the nonlinear system.

View File

@ -183,7 +183,7 @@ namespace Opm {
report.timestep_length = timer.currentStepLength();
// Do model-specific once-per-step calculations.
model_->prepareStep(timer);
report += model_->prepareStep(timer);
int iteration = 0;
@ -224,7 +224,7 @@ namespace Opm {
}
// Do model-specific post-step actions.
model_->afterStep(timer);
report += model_->afterStep(timer);
report.converged = true;
return report;
}

View File

@ -36,6 +36,7 @@ namespace Opm
total_time(0.0),
solver_time(0.0),
assemble_time(0.0),
pre_post_time(0.0),
assemble_time_well(0.0),
linear_solve_setup_time(0.0),
linear_solve_time(0.0),
@ -60,6 +61,7 @@ namespace Opm
linear_solve_time += sr.linear_solve_time;
solver_time += sr.solver_time;
assemble_time += sr.assemble_time;
pre_post_time += sr.pre_post_time;
assemble_time_well += sr.assemble_time_well;
update_time += sr.update_time;
output_write_time += sr.output_write_time;
@ -139,6 +141,14 @@ namespace Opm
100*failureReport->update_time/t);
}
os << std::endl;
t = pre_post_time + (failureReport ? failureReport->pre_post_time : 0.0);
os << fmt::format(" Pre/post step (seconds): {:7.2f}", t);
if (failureReport) {
os << fmt::format(" (Failed: {:2.1f}; {:2.1f}%)",
failureReport->pre_post_time,
100*failureReport->pre_post_time/t);
}
os << std::endl;
os << fmt::format(" Output write time (seconds): {:7.2f}",
output_write_time + (failureReport ? failureReport->output_write_time : 0.0));

View File

@ -34,6 +34,7 @@ namespace Opm
double total_time;
double solver_time;
double assemble_time;
double pre_post_time;
double assemble_time_well;
double linear_solve_setup_time;
double linear_solve_time;