17#ifndef OPM_ABSTRACTISTLSOLVER_HEADER_INCLUDED
18#define OPM_ABSTRACTISTLSOLVER_HEADER_INCLUDED
20#include <opm/common/Exceptions.hpp>
21#include <opm/simulators/linalg/FlowLinearSolverParameters.hpp>
22#include <opm/simulators/linalg/PropertyTree.hpp>
43template <
class TypeTag>
48 using CommunicationType = Dune::OwnerOverlapCopyCommunication<int, int>;
50 using CommunicationType = Dune::Communication<int>;
55 using Matrix =
typename SparseMatrixAdapter::IstlMatrix;
92 virtual void prepare(
const Matrix& M, Vector& b) = 0;
105 virtual void prepare(
const SparseMatrixAdapter& M, Vector& b) = 0;
136 virtual void setMatrix(
const SparseMatrixAdapter& M) = 0;
172 virtual const CommunicationType*
comm()
const = 0;
197 if (!result.converged) {
198 if (result.reduction < parameters.relaxed_linear_solver_reduction_) {
199 std::stringstream ss;
200 ss <<
"Full linear solver tolerance not achieved. The reduction is:" << result.reduction <<
" after "
201 << result.iterations <<
" iterations ";
202 OpmLog::warning(ss.str());
207 if (!parameters.ignoreConvergenceFailure_ && !result.converged) {
208 const std::string msg(
"Convergence failure for linear solver.");
209 OPM_THROW_NOLOG(NumericalProblem, msg);
212 return result.converged;
Abstract interface for ISTL solvers.
Definition AbstractISTLSolver.hpp:45
virtual void setActiveSolver(int num)=0
Set the active solver by its index.
virtual int iterations() const =0
Get the number of iterations used in the last solve.
virtual void getResidual(Vector &b) const =0
Get the residual vector.
virtual const CommunicationType * comm() const =0
Get the communication object used by the solver.
virtual void setMatrix(const SparseMatrixAdapter &M)=0
Set the matrix for the solver.
virtual int getSolveCount() const =0
Get the count of how many times the solver has been called.
virtual int numAvailableSolvers() const =0
Get the number of available solvers.
virtual void eraseMatrix()=0
Signals that the memory for the matrix internally in the solver could be erased.
virtual void prepare(const Matrix &M, Vector &b)=0
Prepare the solver with the given matrix and right-hand side vector.
virtual void prepare(const SparseMatrixAdapter &M, Vector &b)=0
Prepare the solver with the given sparse matrix and right-hand side vector.
virtual bool solve(Vector &x)=0
Solve the system of equations Ax = b.
virtual void setResidual(Vector &b)=0
Set the residual vector.
static bool checkConvergence(const Dune::InverseOperatorResult &result, const FlowLinearSolverParameters ¶meters)
Check the convergence of the linear solver.
Definition AbstractISTLSolver.hpp:194
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
This class carries all parameters for the NewtonIterationBlackoilInterleaved class.
Definition FlowLinearSolverParameters.hpp:98