44 #ifndef EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH 45 #define EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH 47 #include <dune/common/version.hh> 55 #include <opm/simulators/linalg/ilufirstelement.hh> 56 #include <dune/istl/preconditioners.hh> 60 #define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \ 61 template <class TypeTag> \ 62 class PreconditionerWrapper##PREC_NAME \ 64 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \ 65 using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>; \ 66 using IstlMatrix = typename SparseMatrixAdapter::IstlMatrix; \ 67 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \ 70 using SequentialPreconditioner = ISTL_PREC_TYPE<IstlMatrix, \ 73 PreconditionerWrapper##PREC_NAME() \ 76 static void registerParameters() \ 78 Parameters::Register<Parameters::PreconditionerOrder> \ 79 ("The order of the preconditioner"); \ 80 Parameters::Register<Parameters::PreconditionerRelaxation<Scalar>> \ 81 ("The relaxation factor of the preconditioner"); \ 84 void prepare(IstlMatrix& matrix) \ 86 int order = Parameters::Get<Parameters::PreconditionerOrder>(); \ 87 Scalar relaxationFactor = Parameters::Get<Parameters::PreconditionerRelaxation<Scalar>>(); \ 88 seqPreCond_ = new SequentialPreconditioner(matrix, order, \ 92 SequentialPreconditioner& get() \ 93 { return *seqPreCond_; } \ 96 { delete seqPreCond_; } \ 99 SequentialPreconditioner *seqPreCond_; \ 104 #define EWOMS_WRAP_ISTL_SIMPLE_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \ 105 template <class TypeTag> \ 106 class PreconditionerWrapper##PREC_NAME \ 108 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \ 109 using OverlappingMatrix = GetPropType<TypeTag, Properties::OverlappingMatrix>; \ 110 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \ 113 using SequentialPreconditioner = ISTL_PREC_TYPE<OverlappingMatrix, \ 115 OverlappingVector>; \ 116 PreconditionerWrapper##PREC_NAME() \ 119 static void registerParameters() \ 121 Parameters::Register<Parameters::PreconditionerRelaxation<Scalar>> \ 122 ("The relaxation factor of the preconditioner"); \ 125 void prepare(OverlappingMatrix& matrix) \ 127 Scalar relaxationFactor = \ 128 Parameters::Get<Parameters::PreconditionerRelaxation<Scalar>>();\ 129 seqPreCond_ = new SequentialPreconditioner(matrix, \ 133 SequentialPreconditioner& get() \ 134 { return *seqPreCond_; } \ 137 { delete seqPreCond_; } \ 140 SequentialPreconditioner *seqPreCond_; \ 143 EWOMS_WRAP_ISTL_PRECONDITIONER(Jacobi, Dune::SeqJac)
145 EWOMS_WRAP_ISTL_PRECONDITIONER(GaussSeidel, Dune::SeqGS)
146 EWOMS_WRAP_ISTL_PRECONDITIONER(SOR, Dune::SeqSOR)
147 EWOMS_WRAP_ISTL_PRECONDITIONER(SSOR, Dune::SeqSSOR)
151 template <
class TypeTag>
158 static constexpr
int order = 0;
161 using SequentialPreconditioner = Dune::SeqILU<OverlappingMatrix, OverlappingVector, OverlappingVector, order>;
166 static void registerParameters()
168 Parameters::Register<Parameters::PreconditionerRelaxation<Scalar>>
169 (
"The relaxation factor of the preconditioner");
170 Parameters::Register<Parameters::PreconditionerOrder>
171 (
"The order of the preconditioner");
174 void prepare(OverlappingMatrix& matrix)
176 Scalar relaxationFactor = Parameters::Get<Parameters::PreconditionerRelaxation<Scalar>>();
179 seqPreCond_ =
new SequentialPreconditioner(matrix, relaxationFactor);
182 SequentialPreconditioner&
get()
183 {
return *seqPreCond_; }
186 {
delete seqPreCond_; }
189 SequentialPreconditioner *seqPreCond_;
192 #undef EWOMS_WRAP_ISTL_PRECONDITIONER 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:233
This file provides the infrastructure to retrieve run-time parameters.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: istlpreconditionerwrappers.hh:152
Declares the parameters for the black oil model.
The Opm property system, traits with inheritance.
Declares the properties required by the black oil model.