Merge pull request #1433 from totto82/fix_reportStep

Add reportStep method in SimulatorReport and use it
This commit is contained in:
Atgeirr Flø Rasmussen 2018-04-04 15:23:01 +02:00 committed by GitHub
commit ce308455ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 19 deletions

View File

@ -259,16 +259,9 @@ public:
if( terminal_output_ )
{
//stepReport.briefReport();
std::ostringstream iter_msg;
iter_msg << "Stepsize " << (double)unit::convert::to(timer.currentStepLength(), unit::day);
if (solver->wellIterations() != 0) {
iter_msg << " days well iterations = " << solver->wellIterations() << ", ";
}
iter_msg << "non-linear iterations = " << solver->nonlinearIterations()
<< ", total linear iterations = " << solver->linearIterations()
<< "\n";
OpmLog::info(iter_msg.str());
std::ostringstream ss;
stepReport.reportStep(ss);
OpmLog::info(ss.str());
}
}

View File

@ -20,6 +20,8 @@
#include "config.h"
#include <opm/core/simulator/SimulatorReport.hpp>
#include <ostream>
#include <iomanip>
namespace Opm
{
@ -70,6 +72,22 @@ namespace Opm
}
}
void SimulatorReport::reportStep(std::ostringstream& ss)
{
if ( verbose_ )
{
ss << "Time step summary: ";
if (total_well_iterations != 0) {
ss << "well its = " << std::setw(2) << total_well_iterations << ", ";
}
ss << "newton its = " << std::setw(2) << total_newton_iterations << ", "
<< "linearizations = " << std::setw(2) << total_linearizations
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << assemble_time << " sec), "
<< "linear its = " << std::setw(3) << total_linear_iterations
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << linear_solve_time << " sec)";
}
}
void SimulatorReport::reportFullyImplicit(std::ostream& os, const SimulatorReport* failureReport)
{
if ( verbose_ )

View File

@ -52,6 +52,7 @@ namespace Opm
void operator+=(const SimulatorReport& sr);
/// Print a report to the given stream.
void report(std::ostream& os);
void reportStep(std::ostringstream& os);
/// Print a report, leaving out the transport time.
void reportFullyImplicit(std::ostream& os, const SimulatorReport* failedReport = nullptr);
void reportParam(std::ostream& os);

View File

@ -309,15 +309,7 @@ namespace Opm {
if( timestep_verbose_ )
{
std::ostringstream ss;
ss << "Time step summary: ";
if (substepReport.total_well_iterations != 0) {
ss << "well its = " << std::setw(2) << substepReport.total_well_iterations << ", ";
}
ss << "newton its = " << std::setw(2) << substepReport.total_newton_iterations << ", "
<< "linearizations = " << std::setw(2) << substepReport.total_linearizations
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << substepReport.assemble_time << " sec), "
<< "linear its = " << std::setw(3) << substepReport.total_linear_iterations
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << substepReport.linear_solve_time << " sec)";
substepReport.reportStep(ss);
OpmLog::info(ss.str());
}