From 98debed7411f97bd3b048957fb4ac7ac7af581a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 6 Apr 2017 14:54:08 +0200 Subject: [PATCH] Fix minor output bug and refine output. Previously the substep summary reports were cumulative, misleading the user. Also, made output a little more compact and readable, ensuring numbers line up unless unusually many digits are needed for times and iteration counts. --- opm/autodiff/BlackoilModelEbos.hpp | 2 +- opm/simulators/WellSwitchingLogger.cpp | 2 +- opm/simulators/WellSwitchingLogger.hpp | 2 +- .../AdaptiveTimeStepping_impl.hpp | 22 +++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/opm/autodiff/BlackoilModelEbos.hpp b/opm/autodiff/BlackoilModelEbos.hpp index f26132841..b6b719536 100644 --- a/opm/autodiff/BlackoilModelEbos.hpp +++ b/opm/autodiff/BlackoilModelEbos.hpp @@ -309,7 +309,7 @@ namespace Opm { current_relaxation_ -= nonlinear_solver.relaxIncrement(); current_relaxation_ = std::max(current_relaxation_, nonlinear_solver.relaxMax()); if (terminalOutputEnabled()) { - std::string msg = " Oscillating behavior detected: Relaxation set to " + std::string msg = " Oscillating behavior detected: Relaxation set to " + std::to_string(current_relaxation_); OpmLog::info(msg); } diff --git a/opm/simulators/WellSwitchingLogger.cpp b/opm/simulators/WellSwitchingLogger.cpp index ea5c2974c..92e9b5c20 100644 --- a/opm/simulators/WellSwitchingLogger.cpp +++ b/opm/simulators/WellSwitchingLogger.cpp @@ -140,7 +140,7 @@ void WellSwitchingLogger::logSwitch(const char* name, std::array fromto, ss << " Switching control mode for well " << name << " from " << modestring[WellControlType(fromto[0])] << " to " << modestring[WellControlType(fromto[1])] - << " on rank " << rank << std::endl; + << " on rank " << rank; OpmLog::info(ss.str()); } #endif diff --git a/opm/simulators/WellSwitchingLogger.hpp b/opm/simulators/WellSwitchingLogger.hpp index fe94e0602..93415fdde 100644 --- a/opm/simulators/WellSwitchingLogger.hpp +++ b/opm/simulators/WellSwitchingLogger.hpp @@ -76,7 +76,7 @@ public: std::ostringstream ss; ss << " Switching control mode for well " << name << " from " << modestring[from] - << " to " << modestring[to] << std::endl; + << " to " << modestring[to]; OpmLog::info(ss.str()); } } diff --git a/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp b/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp index b398c8621..580a55972 100644 --- a/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp +++ b/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp @@ -283,14 +283,14 @@ namespace Opm { { std::ostringstream ss; ss << " Substep summary: "; - if (report.total_well_iterations != 0) { - ss << "well iterations = " << report.total_well_iterations << ", "; + if (substepReport.total_well_iterations != 0) { + ss << "well its = " << std::setw(2) << substepReport.total_well_iterations << ", "; } - ss << "newton iterations = " << report.total_newton_iterations << ", " - << "linearizations = " << report.total_linearizations - << " (" << report.assemble_time << " sec), " - << "linear iterations = " << report.total_linear_iterations - << " (" << report.linear_solve_time << " sec)"; + 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)"; OpmLog::info(ss.str()); } @@ -327,8 +327,8 @@ namespace Opm { substepTimer.setLastStepFailed(true); // increase restart counter if( restarts >= solver_restart_max_ ) { - const auto msg = std::string("Solver failed to converge after ") - + std::to_string(restarts) + " restarts."; + const auto msg = std::string("Solver failed to converge after cutting timestep ") + + std::to_string(restarts) + " times."; if (solver_verbose_) { OpmLog::error(msg); } @@ -340,8 +340,8 @@ namespace Opm { substepTimer.provideTimeStepEstimate( newTimeStep ); if( solver_verbose_ ) { std::string msg; - msg = "Solver convergence failed, restarting solver with new time step (" - + std::to_string(unit::convert::to( newTimeStep, unit::day )) + " days).\n"; + msg = "Solver convergence failed, cutting timestep to " + + std::to_string(unit::convert::to( newTimeStep, unit::day )) + " days.\n"; OpmLog::problem(msg); } // reset states