mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1126 from atgeirr/refined-output
Refined output to terminal and log
This commit is contained in:
@@ -150,13 +150,11 @@ namespace Opm
|
|||||||
} while ( (!converged && (iteration <= maxIter())) || (iteration <= minIter()));
|
} while ( (!converged && (iteration <= maxIter())) || (iteration <= minIter()));
|
||||||
|
|
||||||
if (!converged) {
|
if (!converged) {
|
||||||
|
std::string msg = "Failed to complete a time step within " + std::to_string(maxIter()) + " iterations.";
|
||||||
if (model_->terminalOutputEnabled()) {
|
if (model_->terminalOutputEnabled()) {
|
||||||
OPM_THROW(Opm::NumericalProblem, "Failed to complete a time step within "+std::to_string(maxIter())+" iterations.");
|
OpmLog::problem(msg);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OPM_THROW_NOLOG(Opm::NumericalProblem, "Failed to complete a time step within "+std::to_string(maxIter())+" iterations.");
|
|
||||||
}
|
}
|
||||||
|
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do model-specific post-step actions.
|
// Do model-specific post-step actions.
|
||||||
|
|||||||
@@ -324,8 +324,9 @@ public:
|
|||||||
events.hasEvent(ScheduleEvents::PRODUCTION_UPDATE, timer.currentStepNum()) ||
|
events.hasEvent(ScheduleEvents::PRODUCTION_UPDATE, timer.currentStepNum()) ||
|
||||||
events.hasEvent(ScheduleEvents::INJECTION_UPDATE, timer.currentStepNum()) ||
|
events.hasEvent(ScheduleEvents::INJECTION_UPDATE, timer.currentStepNum()) ||
|
||||||
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE, timer.currentStepNum());
|
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE, timer.currentStepNum());
|
||||||
report += adaptiveTimeStepping->step( timer, *solver, state, well_state, event, output_writer_,
|
stepReport = adaptiveTimeStepping->step( timer, *solver, state, well_state, event, output_writer_,
|
||||||
output_writer_.requireFIPNUM() ? &fipnum : nullptr );
|
output_writer_.requireFIPNUM() ? &fipnum : nullptr );
|
||||||
|
report += stepReport;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// solve for complete report step
|
// solve for complete report step
|
||||||
@@ -384,7 +385,7 @@ public:
|
|||||||
|
|
||||||
std::string msg;
|
std::string msg;
|
||||||
msg =
|
msg =
|
||||||
"Time step took " + std::to_string(stepReport.solver_time) + " seconds; "
|
"Time step took " + std::to_string(solver_timer.secsSinceStart()) + " seconds; "
|
||||||
"total solver time " + std::to_string(report.solver_time) + " seconds.";
|
"total solver time " + std::to_string(report.solver_time) + " seconds.";
|
||||||
OpmLog::note(msg);
|
OpmLog::note(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ void WellSwitchingLogger::logSwitch(const char* name, std::array<char,2> fromto,
|
|||||||
ss << " Switching control mode for well " << name
|
ss << " Switching control mode for well " << name
|
||||||
<< " from " << modestring[WellControlType(fromto[0])]
|
<< " from " << modestring[WellControlType(fromto[0])]
|
||||||
<< " to " << modestring[WellControlType(fromto[1])]
|
<< " to " << modestring[WellControlType(fromto[1])]
|
||||||
<< " on rank " << rank << std::endl;
|
<< " on rank " << rank;
|
||||||
OpmLog::info(ss.str());
|
OpmLog::info(ss.str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << " Switching control mode for well " << name
|
ss << " Switching control mode for well " << name
|
||||||
<< " from " << modestring[from]
|
<< " from " << modestring[from]
|
||||||
<< " to " << modestring[to] << std::endl;
|
<< " to " << modestring[to];
|
||||||
OpmLog::info(ss.str());
|
OpmLog::info(ss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,14 +283,14 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << " Substep summary: ";
|
ss << " Substep summary: ";
|
||||||
if (report.total_well_iterations != 0) {
|
if (substepReport.total_well_iterations != 0) {
|
||||||
ss << "well iterations = " << report.total_well_iterations << ", ";
|
ss << "well its = " << std::setw(2) << substepReport.total_well_iterations << ", ";
|
||||||
}
|
}
|
||||||
ss << "newton iterations = " << report.total_newton_iterations << ", "
|
ss << "newton its = " << std::setw(2) << substepReport.total_newton_iterations << ", "
|
||||||
<< "linearizations = " << report.total_linearizations
|
<< "linearizations = " << std::setw(2) << substepReport.total_linearizations
|
||||||
<< " (" << report.assemble_time << " sec), "
|
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << substepReport.assemble_time << " sec), "
|
||||||
<< "linear iterations = " << report.total_linear_iterations
|
<< "linear its = " << std::setw(3) << substepReport.total_linear_iterations
|
||||||
<< " (" << report.linear_solve_time << " sec)";
|
<< " (" << std::fixed << std::setprecision(3) << std::setw(6) << substepReport.linear_solve_time << " sec)";
|
||||||
OpmLog::info(ss.str());
|
OpmLog::info(ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,8 +327,8 @@ namespace Opm {
|
|||||||
substepTimer.setLastStepFailed(true);
|
substepTimer.setLastStepFailed(true);
|
||||||
// increase restart counter
|
// increase restart counter
|
||||||
if( restarts >= solver_restart_max_ ) {
|
if( restarts >= solver_restart_max_ ) {
|
||||||
const auto msg = std::string("Solver failed to converge after ")
|
const auto msg = std::string("Solver failed to converge after cutting timestep ")
|
||||||
+ std::to_string(restarts) + " restarts.";
|
+ std::to_string(restarts) + " times.";
|
||||||
if (solver_verbose_) {
|
if (solver_verbose_) {
|
||||||
OpmLog::error(msg);
|
OpmLog::error(msg);
|
||||||
}
|
}
|
||||||
@@ -340,8 +340,8 @@ namespace Opm {
|
|||||||
substepTimer.provideTimeStepEstimate( newTimeStep );
|
substepTimer.provideTimeStepEstimate( newTimeStep );
|
||||||
if( solver_verbose_ ) {
|
if( solver_verbose_ ) {
|
||||||
std::string msg;
|
std::string msg;
|
||||||
msg = "Solver convergence failed, restarting solver with new time step ("
|
msg = "Solver convergence failed, cutting timestep to "
|
||||||
+ std::to_string(unit::convert::to( newTimeStep, unit::day )) + " days).\n";
|
+ std::to_string(unit::convert::to( newTimeStep, unit::day )) + " days.\n";
|
||||||
OpmLog::problem(msg);
|
OpmLog::problem(msg);
|
||||||
}
|
}
|
||||||
// reset states
|
// reset states
|
||||||
|
|||||||
Reference in New Issue
Block a user