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);
92 void recreateDirectSolver();
97 void init(Operator& op,
100 const std::function<VectorType()> weightsCalculator,
101 std::size_t pressureIndex);
103 Operator* linearoperator_for_solver_;
104 std::shared_ptr<AbstractPrecondType> preconditioner_;
105 std::shared_ptr<AbstractScalarProductType> scalarproduct_;
106 std::shared_ptr<AbstractSolverType> linsolver_;
107 bool direct_solver_ =
false;
FlexibleSolver(Operator &op, const Opm::PropertyTree &prm, const std::function< VectorType()> &weightsCalculator, std::size_t pressureIndex)
Create a sequential solver.
Definition FlexibleSolver_impl.hpp:53
AbstractPrecondType & preconditioner()
Access the contained preconditioner.
Definition FlexibleSolver_impl.hpp:101
Definition PropertyTree.hpp:37
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37