19 #ifndef OPM_SYSTEMPRECONDITIONERFACTORY_HEADER_INCLUDED 20 #define OPM_SYSTEMPRECONDITIONERFACTORY_HEADER_INCLUDED 22 #include <opm/simulators/linalg/system/MultiComm.hpp> 23 #include <opm/simulators/linalg/system/SystemPreconditioner.hpp> 24 #include <opm/simulators/linalg/PreconditionerFactory.hpp> 25 #include <opm/simulators/linalg/system/SystemTypes.hpp> 27 #include <dune/istl/operators.hh> 28 #include <dune/istl/paamg/pinfo.hh> 33 template <
class Operator,
class Comm,
typename>
34 struct StandardPreconditioners;
36 template<
typename Scalar>
37 using SystemSeqOp = Dune::MatrixAdapter<SystemMatrix<Scalar>, SystemVector<Scalar>, SystemVector<Scalar>>;
41 const Dune::JacComm&>;
42 template<
typename Scalar>
43 using SystemParOp = Dune::OverlappingSchwarzOperator<SystemMatrix<Scalar>, SystemVector<Scalar>,
44 SystemVector<Scalar>, SystemComm>;
54 template<
typename Scalar>
55 void addSystemCprSeq()
57 using O = SystemSeqOp<Scalar>;
58 using F = PreconditionerFactory<O, Dune::Amg::SequentialInformation>;
59 using V = SystemVector<Scalar>;
60 using P = PropertyTree;
62 F::addCreator(
"system_cpr",
63 [](
const O& op,
const P& prm,
64 const std::function<V()>& sysWeightCalc,
65 std::size_t pressureIndex) {
66 std::function<ResVector<Scalar>()> resWeightCalc;
68 resWeightCalc = [sysWeightCalc]() {
69 return sysWeightCalc()[Dune::Indices::_0];
72 return std::make_shared<SystemPreconditioner<Scalar, SeqResOperator<Scalar>>>(
73 op.getmat(), resWeightCalc, pressureIndex, prm);
83 template<
typename Scalar>
84 void addSystemCprParSeq()
86 using O = SystemParOp<Scalar>;
87 using F = PreconditionerFactory<O, Dune::Amg::SequentialInformation>;
88 using V = SystemVector<Scalar>;
89 using P = PropertyTree;
91 F::addCreator(
"system_cpr",
92 [](
const O& op,
const P& prm,
93 const std::function<V()>& sysWeightCalc,
94 std::size_t pressureIndex) {
95 std::function<ResVector<Scalar>()> resWeightCalc;
97 resWeightCalc = [sysWeightCalc]() {
98 return sysWeightCalc()[Dune::Indices::_0];
101 return std::make_shared<SystemPreconditioner<Scalar, SeqResOperator<Scalar>>>(
102 op.getmat(), resWeightCalc, pressureIndex, prm);
106 template<
typename Scalar>
107 void addSystemCprPar()
109 using O = SystemParOp<Scalar>;
110 using F = PreconditionerFactory<O, SystemComm>;
111 using V = SystemVector<Scalar>;
112 using P = PropertyTree;
114 F::addCreator(
"system_cpr",
115 [](
const O& op,
const P& prm,
116 const std::function<V()>& sysWeightCalc,
117 std::size_t pressureIndex,
118 const SystemComm& comm) {
119 std::function<ResVector<Scalar>()> resWeightCalc;
121 resWeightCalc = [sysWeightCalc]() {
122 return sysWeightCalc()[Dune::Indices::_0];
125 const auto& resComm = comm[Dune::Indices::_0];
126 return std::make_shared<SystemPreconditioner<Scalar, ParResOperator<Scalar>, ParResComm>>(
127 op.getmat(), resWeightCalc, pressureIndex, prm, resComm);
136 static void add() { detail::addSystemCprSeq<double>(); }
141 static void add() { detail::addSystemCprSeq<float>(); }
147 static void add() { detail::addSystemCprParSeq<double>(); }
151 struct StandardPreconditioners<SystemParOp<float>,
Dune::Amg::SequentialInformation, void> {
152 static void add() { detail::addSystemCprParSeq<float>(); }
156 struct StandardPreconditioners<SystemParOp<double>, SystemComm, void> {
157 static void add() { detail::addSystemCprPar<double>(); }
161 struct StandardPreconditioners<SystemParOp<float>, SystemComm, void> {
162 static void add() { detail::addSystemCprPar<float>(); }
168 #endif // OPM_SYSTEMPRECONDITIONERFACTORY_HEADER_INCLUDED Definition: MultiComm.hpp:118
Definition: fvbaseprimaryvariables.hh:161
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
Definition: StandardPreconditioners_mpi.hpp:134