20#ifndef OPM_PRESSURE_SOLVER_POLICY_HEADER_INCLUDED
21#define OPM_PRESSURE_SOLVER_POLICY_HEADER_INCLUDED
26#include <dune/istl/solver.hh>
27#include <dune/istl/owneroverlapcopy.hh>
33 template <
class OperatorType,
class Solver,
class LevelTransferPolicy>
49 using X =
typename Operator::range_type;
56 struct PressureInverseOperator :
public Dune::InverseOperator<X, X>
59 template <
typename GlobalIndex,
typename LocalIndex>
60 PressureInverseOperator(
Operator& op,
62 const Dune::OwnerOverlapCopyCommunication<GlobalIndex, LocalIndex>& comm)
65 assert(op.category() == Dune::SolverCategory::overlapping);
68 linsolver_ = std::make_unique<Solver>(op, comm, prm, std::function<X()>(),
73 PressureInverseOperator(
Operator& op,
75 const SequentialInformation&)
78 assert(op.category() != Dune::SolverCategory::overlapping);
81 linsolver_ = std::make_unique<Solver>(op, prm, std::function<X()>(),
86 Dune::SolverCategory::Category category()
const override
88 return linsolver_->category();
93 linsolver_->apply(x, b, reduction, res);
98 linsolver_->apply(x, b, res);
101 void updatePreconditioner()
103 linsolver_->preconditioner().update();
107 std::unique_ptr<Solver> linsolver_;
123 coarseOperator_ = transferPolicy.getCoarseLevelOperator();
128 coarseOperator_ = transferPolicy.getCoarseLevelOperator();
129 auto& tp =
dynamic_cast<LevelTransferPolicy&
>(transferPolicy);
130 PressureInverseOperator* inv
131 =
new PressureInverseOperator(*coarseOperator_, prm_, tp.getCoarseLevelCommunication());
137 std::shared_ptr<Operator> coarseOperator_;
Definition: PressureSolverPolicy.hpp:35
CoarseLevelSolver * createCoarseLevelSolver(LTP &transferPolicy)
Definition: PressureSolverPolicy.hpp:126
PressureSolverPolicy(const Opm::PropertyTree &prm)
Constructs the coarse solver policy.
Definition: PressureSolverPolicy.hpp:43
OperatorType Operator
The type of the linear operator used.
Definition: PressureSolverPolicy.hpp:38
PressureInverseOperator CoarseLevelSolver
The type of solver constructed for the coarse level.
Definition: PressureSolverPolicy.hpp:112
void setCoarseOperator(LTP &transferPolicy)
Constructs a coarse level solver.
Definition: PressureSolverPolicy.hpp:121
Definition: PropertyTree.hpp:37
Definition: fvbaseprimaryvariables.hh:141
Dune::InverseOperatorResult InverseOperatorResult
Definition: BdaBridge.hpp:32