mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
flow_ebos: print statistics about failed time steps
the performance summary at the end of a Norne run which are printed by `flow_ebos` now looks like this on my machine: ``` Total time (seconds): 773.757 Solver time (seconds): 753.349 Assembly time (seconds): 377.218 (Failed: 23.537; 6.23965%) Linear solve time (seconds): 352.022 (Failed: 23.2757; 6.61201%) Update time (seconds): 16.3658 (Failed: 1.13149; 6.91375%) Output write time (seconds): 22.5991 Overall Well Iterations: 870 (Failed: 35; 4.02299%) Overall Linearizations: 2098 (Failed: 136; 6.48236%) Overall Newton Iterations: 1756 (Failed: 136; 7.74487%) Overall Linear Iterations: 26572 (Failed: 1786; 6.72136%) ``` for the flow_legacy family, nothing changes.
This commit is contained in:
@@ -124,6 +124,7 @@ namespace Opm
|
||||
{
|
||||
SimulatorReport iterReport;
|
||||
SimulatorReport report;
|
||||
failureReport_ = SimulatorReport();
|
||||
|
||||
// Do model-specific once-per-step calculations.
|
||||
model_->prepareStep(timer, initial_reservoir_state, initial_well_state);
|
||||
@@ -137,19 +138,30 @@ namespace Opm
|
||||
|
||||
// ---------- Main nonlinear solver loop ----------
|
||||
do {
|
||||
// Do the nonlinear step. If we are in a converged state, the
|
||||
// model will usually do an early return without an expensive
|
||||
// solve, unless the minIter() count has not been reached yet.
|
||||
iterReport = model_->nonlinearIteration(iteration, timer, *this, reservoir_state, well_state);
|
||||
try {
|
||||
// Do the nonlinear step. If we are in a converged state, the
|
||||
// model will usually do an early return without an expensive
|
||||
// solve, unless the minIter() count has not been reached yet.
|
||||
iterReport = model_->nonlinearIteration(iteration, timer, *this, reservoir_state, well_state);
|
||||
|
||||
report += iterReport;
|
||||
report.converged = iterReport.converged;
|
||||
report += iterReport;
|
||||
report.converged = iterReport.converged;
|
||||
|
||||
converged = report.converged;
|
||||
iteration += 1;
|
||||
converged = report.converged;
|
||||
iteration += 1;
|
||||
}
|
||||
catch (...) {
|
||||
// if an iteration fails during a time step, all previous iterations
|
||||
// count as a failure as well
|
||||
failureReport_ += report;
|
||||
failureReport_ += model_->failureReport();
|
||||
throw;
|
||||
}
|
||||
} while ( (!converged && (iteration <= maxIter())) || (iteration <= minIter()));
|
||||
|
||||
if (!converged) {
|
||||
failureReport_ += report;
|
||||
|
||||
std::string msg = "Failed to complete a time step within " + std::to_string(maxIter()) + " iterations.";
|
||||
if (model_->terminalOutputEnabled()) {
|
||||
OpmLog::problem(msg);
|
||||
|
||||
Reference in New Issue
Block a user