25 #ifndef EWOMS_SOLVER_PRECONDITIONER_HH
26 #define EWOMS_SOLVER_PRECONDITIONER_HH
29 #include <dune/istl/preconditioners.hh>
38 template <
class Matrix,
class DomainVector,
class RangeVector>
40 :
public Dune::Preconditioner<DomainVector, RangeVector>
42 typedef Dune::MatrixAdapter<Matrix, DomainVector, RangeVector> InnerOperator;
43 typedef Dune::SeqScalarProduct<DomainVector> InnerScalarProduct;
44 typedef Dune::SeqILU0<Matrix, DomainVector, RangeVector> InnerPreConditioner;
46 typedef typename DomainVector::field_type Scalar;
52 enum {
category = Dune::SolverCategory::overlapping };
56 innerOperator_ =
new InnerOperator(matrix);
57 innerScalarProduct_ =
new InnerScalarProduct;
58 innerPreCond_ =
new InnerPreConditioner(matrix, 1.0);
60 Scalar tolerance = 1e-6;
63 innerSolver_ =
new InnerSolver(*innerOperator_,
74 delete innerOperator_;
75 delete innerScalarProduct_;
79 void pre(domain_type &x, range_type &y)
82 void apply(domain_type &x,
const range_type &d)
86 Dune::InverseOperatorResult result;
87 innerSolver_->
apply(x, dd, result);
91 innerOperator_->apply(x0, dd);
93 Scalar defectBefore = dd.two_norm();
95 innerOperator_->apply(x, dd);
97 Scalar defectAfter = dd.two_norm();
98 if (defectBefore < defectAfter) {
100 innerPreCond_->apply(x, d);
108 InnerOperator *innerOperator_;
109 InnerScalarProduct *innerScalarProduct_;
110 InnerPreConditioner *innerPreCond_;
111 InnerSolver *innerSolver_;
void apply(domain_type &x, const range_type &d)
Definition: solverpreconditioner.hh:82
Copy of dune-istl's linear solvers with added support for pluggable convergence criteria.
DomainVector domain_type
Definition: solverpreconditioner.hh:49
Definition: solverpreconditioner.hh:52
void post(domain_type &x)
Definition: solverpreconditioner.hh:104
RangeVector range_type
Definition: solverpreconditioner.hh:50
Definition: baseauxiliarymodule.hh:35
~SolverPreconditioner()
Definition: solverpreconditioner.hh:71
void pre(domain_type &x, range_type &y)
Definition: solverpreconditioner.hh:79
Bi-conjugate Gradient Stabilized (BiCG-STAB)
Definition: solvers.hh:623
An ISTL preconditioner that solves the linear system of equations locally on each rank...
Definition: solverpreconditioner.hh:39
virtual void apply(X &x, X &b, Dune::InverseOperatorResult &res)
Apply inverse operator.
Definition: solvers.hh:683
SolverPreconditioner(const Matrix &matrix, int order, Scalar relaxationFactor)
Definition: solverpreconditioner.hh:54