22#ifndef OPM_FLEXIBLE_SOLVER_HEADER_INCLUDED
23#define OPM_FLEXIBLE_SOLVER_HEADER_INCLUDED
25#include <opm/simulators/linalg/PreconditionerWithUpdate.hpp>
27#include <dune/istl/solver.hh>
28#include <dune/istl/paamg/pinfo.hh>
42template <
class Operator>
43class FlexibleSolver :
public Dune::InverseOperator<typename Operator::domain_type,
44 typename Operator::range_type>
47 using VectorType =
typename Operator::domain_type;
55 const std::function<VectorType()>& weightsCalculator,
56 std::size_t pressureIndex);
63 const std::function<VectorType()>& weightsCalculator,
64 std::size_t pressureIndex);
66 virtual void apply(VectorType& x, VectorType& rhs, Dune::InverseOperatorResult& res)
override;
68 virtual void apply(VectorType& x, VectorType& rhs,
double reduction, Dune::InverseOperatorResult& res)
override;
73 virtual Dune::SolverCategory::Category category()
const override;
76 using AbstractScalarProductType = Dune::ScalarProduct<VectorType>;
77 using AbstractSolverType = Dune::InverseOperator<VectorType, VectorType>;
82 const std::function<VectorType()> weightsCalculator,
const Comm& comm,
83 std::size_t pressureIndex);
86 const std::function<VectorType()> weightsCalculator,
const Dune::Amg::SequentialInformation&,
87 std::size_t pressureIndex);
94 void init(Operator& op,
97 const std::function<VectorType()> weightsCalculator,
98 std::size_t pressureIndex);
100 Operator* linearoperator_for_solver_;
101 std::shared_ptr<AbstractPrecondType> preconditioner_;
102 std::shared_ptr<AbstractScalarProductType> scalarproduct_;
103 std::shared_ptr<AbstractSolverType> linsolver_;
A solver class that encapsulates all needed objects for a linear solver (operator,...
Definition: FlexibleSolver.hpp:45
FlexibleSolver(Operator &op, const Opm::PropertyTree &prm, const std::function< VectorType()> &weightsCalculator, std::size_t pressureIndex)
Create a sequential solver.
Definition: FlexibleSolver_impl.hpp:45
AbstractPrecondType & preconditioner()
Access the contained preconditioner.
Definition: FlexibleSolver_impl.hpp:87
Definition: PropertyTree.hpp:37
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27