diff --git a/opm/simulators/linalg/FlowLinearSolverParameters.hpp b/opm/simulators/linalg/FlowLinearSolverParameters.hpp index f2019bccf..425c41a2c 100644 --- a/opm/simulators/linalg/FlowLinearSolverParameters.hpp +++ b/opm/simulators/linalg/FlowLinearSolverParameters.hpp @@ -45,6 +45,12 @@ template struct LinearSolverReduction { using type = UndefinedProperty; }; + +template +struct RelaxedLinearSolverReduction { + using type = UndefinedProperty; +}; + template struct IluRelaxation { using type = UndefinedProperty; @@ -126,6 +132,11 @@ struct LinearSolverReduction { static constexpr type value = 1e-2; }; template +struct RelaxedLinearSolverReduction { + using type = GetPropType; + static constexpr type value = 1e-2; +}; +template struct IluRelaxation { using type = GetPropType; static constexpr type value = 0.9; @@ -217,6 +228,7 @@ namespace Opm struct FlowLinearSolverParameters { double linear_solver_reduction_; + double relaxed_linear_solver_reduction_; double ilu_relaxation_; int linear_solver_maxiter_; int linear_solver_restart_; @@ -242,6 +254,7 @@ namespace Opm { // TODO: these parameters have undocumented non-trivial dependencies linear_solver_reduction_ = EWOMS_GET_PARAM(TypeTag, double, LinearSolverReduction); + relaxed_linear_solver_reduction_ = EWOMS_GET_PARAM(TypeTag, double, RelaxedLinearSolverReduction); ilu_relaxation_ = EWOMS_GET_PARAM(TypeTag, double, IluRelaxation); linear_solver_maxiter_ = EWOMS_GET_PARAM(TypeTag, int, LinearSolverMaxIter); linear_solver_restart_ = EWOMS_GET_PARAM(TypeTag, int, LinearSolverRestart); @@ -271,7 +284,8 @@ namespace Opm template static void registerParameters() { - EWOMS_REGISTER_PARAM(TypeTag, double, LinearSolverReduction, "The minimum reduction of the residual which the linear solver must achieve"); + EWOMS_REGISTER_PARAM(TypeTag, double, LinearSolverReduction, "The minimum reduction of the residual which the linear solver must achieve should try to achive"); + EWOMS_REGISTER_PARAM(TypeTag, double, RelaxedLinearSolverReduction, "The minimum reduction of the residual which the linear solver need to achieve for the solution to be accepted"); EWOMS_REGISTER_PARAM(TypeTag, double, IluRelaxation, "The relaxation factor of the linear solver's ILU preconditioner"); EWOMS_REGISTER_PARAM(TypeTag, int, LinearSolverMaxIter, "The maximum number of iterations of the linear solver"); EWOMS_REGISTER_PARAM(TypeTag, int, LinearSolverRestart, "The number of iterations after which GMRES is restarted"); @@ -299,6 +313,7 @@ namespace Opm { newton_use_gmres_ = false; linear_solver_reduction_ = 1e-2; + relaxed_linear_solver_reduction_ = 1e-2; linear_solver_maxiter_ = 150; linear_solver_restart_ = 40; linear_solver_verbosity_ = 0; diff --git a/opm/simulators/linalg/ISTLSolverEbos.hpp b/opm/simulators/linalg/ISTLSolverEbos.hpp index 753903ddd..a91464dae 100644 --- a/opm/simulators/linalg/ISTLSolverEbos.hpp +++ b/opm/simulators/linalg/ISTLSolverEbos.hpp @@ -434,9 +434,17 @@ std::unique_ptr blockJacobiAdjacency(const Grid& grid, // store number of iterations iterations_ = result.iterations; converged_ = result.converged; - + if(!converged_){ + if(result.reduction < parameters_.relaxed_linear_solver_reduction_){ + std::stringstream ss; + ss<< "Full linear solver tolerance not achived. The reduction is:" << result.reduction + << " after " << result.iterations << " iterations "; + OpmLog::warning(ss.str()); + converged_ = true; + } + } // Check for failure of linear solver. - if (!parameters_.ignoreConvergenceFailure_ && !result.converged) { + if (!parameters_.ignoreConvergenceFailure_ && !converged_) { const std::string msg("Convergence failure for linear solver."); OPM_THROW_NOLOG(NumericalProblem, msg); }