44#ifndef EWOMS_ISTL_SOLVER_WRAPPERS_HH
45#define EWOMS_ISTL_SOLVER_WRAPPERS_HH
51#include <dune/istl/solvers.hh>
58#define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME) \
59 template <class TypeTag> \
60 class SolverWrapper##SOLVER_NAME \
62 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \
63 using OverlappingMatrix = GetPropType<TypeTag, Properties::OverlappingMatrix>; \
64 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \
67 using RawSolver = ISTL_SOLVER_NAME<OverlappingVector>; \
69 SolverWrapper##SOLVER_NAME() \
72 static void registerParameters() \
75 template <class LinearOperator, class ScalarProduct, class Preconditioner> \
76 std::shared_ptr<RawSolver> get(LinearOperator& parOperator, \
77 ScalarProduct& parScalarProduct, \
78 Preconditioner& parPreCond) \
80 Scalar tolerance = Parameters::get<TypeTag, Properties::LinearSolverTolerance>(); \
81 int maxIter = Parameters::get<TypeTag, Properties::LinearSolverMaxIterations>();\
84 if (parOperator.overlap().myRank() == 0) \
85 verbosity = Parameters::get<TypeTag, Properties::LinearSolverVerbosity>(); \
86 solver_ = std::make_shared<RawSolver>(parOperator, parScalarProduct, \
87 parPreCond, tolerance, maxIter, \
94 { solver_.reset(); } \
97 std::shared_ptr<RawSolver> solver_; \
111template <
class TypeTag>
119 using RawSolver = Dune::RestartedGMResSolver<OverlappingVector>;
126 Parameters::registerParam<TypeTag, Properties::GMResRestart>
127 (
"Number of iterations after which the GMRES linear solver is restarted");
130 template <
class LinearOperator,
class ScalarProduct,
class Preconditioner>
131 std::shared_ptr<RawSolver>
get(LinearOperator& parOperator,
132 ScalarProduct& parScalarProduct,
133 Preconditioner& parPreCond)
135 Scalar tolerance = Parameters::get<TypeTag, Properties::LinearSolverTolerance>();
136 int maxIter = Parameters::get<TypeTag, Properties::LinearSolverMaxIterations>();
139 if (parOperator.overlap().myRank() == 0)
140 verbosity = Parameters::get<TypeTag, Properties::LinearSolverVerbosity>();
141 int restartAfter = Parameters::get<TypeTag, Properties::GMResRestart>();
142 solver_ = std::make_shared<RawSolver>(parOperator,
157 std::shared_ptr<RawSolver> solver_;
160#undef EWOMS_WRAP_ISTL_SOLVER
Solver wrapper for the restarted GMRES solver of dune-istl.
Definition: istlsolverwrappers.hh:113
std::shared_ptr< RawSolver > get(LinearOperator &parOperator, ScalarProduct &parScalarProduct, Preconditioner &parPreCond)
Definition: istlsolverwrappers.hh:131
void cleanup()
Definition: istlsolverwrappers.hh:153
static void registerParameters()
Definition: istlsolverwrappers.hh:124
Dune::RestartedGMResSolver< OverlappingVector > RawSolver
Definition: istlsolverwrappers.hh:119
SolverWrapperRestartedGMRes()
Definition: istlsolverwrappers.hh:121
#define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME)
Macro to create a wrapper around an ISTL solver.
Definition: istlsolverwrappers.hh:58
Declares the properties required by the black oil model.
Definition: bicgstabsolver.hh:42
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:242
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.