44#ifndef EWOMS_ISTL_SOLVER_WRAPPERS_HH
45#define EWOMS_ISTL_SOLVER_WRAPPERS_HH
47#include <dune/istl/solvers.hh>
60#define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME) \
61 template <class TypeTag> \
62 class SolverWrapper##SOLVER_NAME \
64 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \
65 using OverlappingMatrix = GetPropType<TypeTag, Properties::OverlappingMatrix>; \
66 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \
69 using RawSolver = ISTL_SOLVER_NAME<OverlappingVector>; \
71 SolverWrapper##SOLVER_NAME() \
74 static void registerParameters() \
77 template <class LinearOperator, class ScalarProduct, class Preconditioner> \
78 std::shared_ptr<RawSolver> get(LinearOperator& parOperator, \
79 ScalarProduct& parScalarProduct, \
80 Preconditioner& parPreCond) \
82 Scalar tolerance = Parameters::Get<Parameters::LinearSolverTolerance<Scalar>>(); \
83 int maxIter = Parameters::Get<Parameters::LinearSolverMaxIterations>();\
86 if (parOperator.overlap().myRank() == 0) \
87 verbosity = Parameters::Get<Parameters::LinearSolverVerbosity>(); \
88 solver_ = std::make_shared<RawSolver>(parOperator, parScalarProduct, \
89 parPreCond, tolerance, maxIter, \
96 { solver_.reset(); } \
99 std::shared_ptr<RawSolver> solver_; \
113template <
class TypeTag>
121 using RawSolver = Dune::RestartedGMResSolver<OverlappingVector>;
128 Parameters::Register<Parameters::GMResRestart>
129 (
"Number of iterations after which the GMRES linear solver is restarted");
132 template <
class LinearOperator,
class ScalarProduct,
class Preconditioner>
133 std::shared_ptr<RawSolver>
get(LinearOperator& parOperator,
134 ScalarProduct& parScalarProduct,
135 Preconditioner& parPreCond)
137 Scalar tolerance = Parameters::Get<Parameters::LinearSolverTolerance<Scalar>>();
138 int maxIter = Parameters::Get<Parameters::LinearSolverMaxIterations>();
141 if (parOperator.overlap().myRank() == 0)
142 verbosity = Parameters::Get<Parameters::LinearSolverVerbosity>();
143 int restartAfter = Parameters::Get<Parameters::GMResRestart>();
144 solver_ = std::make_shared<RawSolver>(parOperator,
159 std::shared_ptr<RawSolver> solver_;
162#undef EWOMS_WRAP_ISTL_SOLVER
Solver wrapper for the restarted GMRES solver of dune-istl.
Definition: istlsolverwrappers.hh:115
std::shared_ptr< RawSolver > get(LinearOperator &parOperator, ScalarProduct &parScalarProduct, Preconditioner &parPreCond)
Definition: istlsolverwrappers.hh:133
void cleanup()
Definition: istlsolverwrappers.hh:155
static void registerParameters()
Definition: istlsolverwrappers.hh:126
Dune::RestartedGMResSolver< OverlappingVector > RawSolver
Definition: istlsolverwrappers.hh:121
SolverWrapperRestartedGMRes()
Definition: istlsolverwrappers.hh:123
#define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME)
Macro to create a wrapper around an ISTL solver.
Definition: istlsolverwrappers.hh:60
Declares the parameters for the black oil model.
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:235
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.