diff --git a/opm/simulators/linalg/ISTLSolverEbos.hpp b/opm/simulators/linalg/ISTLSolverEbos.hpp index 0d0bf6dd0..c3d315b43 100644 --- a/opm/simulators/linalg/ISTLSolverEbos.hpp +++ b/opm/simulators/linalg/ISTLSolverEbos.hpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -485,6 +486,8 @@ protected: } bool solve(Vector& x) { + const int verbosity = useFlexible_ ? prm_.get("verbosity", 0) : parameters_.linear_solver_verbosity_; + const bool write_matrix = verbosity > 10; // Solve system. if (useFlexible_) @@ -493,6 +496,13 @@ protected: assert(flexibleSolver_); flexibleSolver_->apply(x, *rhs_, res); iterations_ = res.iterations; + if (write_matrix) { + Opm::Helper::writeSystem(simulator_, //simulator is only used to get names + getMatrix(), + *rhs_, + comm_.get()); + } + return converged_ = res.converged; } @@ -530,6 +540,13 @@ protected: scaleSolution(x); } + if (write_matrix) { + Opm::Helper::writeSystem(simulator_, //simulator is only used to get names + getMatrix(), + *rhs_, + comm_.get()); + } + return converged_; }