[Dune-devel] New virtual method proposal: Preconditioner::update()
Atgeirr Rasmussen
Atgeirr.Rasmussen at sintef.no
Thu Sep 19 09:07:25 CEST 2019
Dear Dune developers,
I have two things I'd like to discuss with you.
1.
I would like to propose an interface addition for the Preconditioner template of dune-istl, namely to add a virtual method:
/*! \brief Update preconditioner.
This method can be called to update the preconditioner,
assuming that the sparsity structure of the underlying operator
or matrix is unchanged but that its entries may have
changed. For simple preconditioners this may be a no-op whereas
for more complex preconditioners like ILU or AMG it will not.
*/
virtual void update () = 0;
The intention of this method is to make it possible to reuse expensive structures of a preconditioner, in the common case that the sparsity structure is stable while the coefficients change. Typically, all time-dependent problems will have such behaviour, when adaptivity is not used (or not used at every step). Nonlinear problems will benefit even more, even with adaptivity (assuming one does not adapt the grid between nonlinear iterations).
Prototype implementations have been made in the OPM module opm-simulators (directory opm/simulators/linalg). A new class there, PreconditionerWithUpdate, adds the new interface, and existing preconditioners are made to inherit from it either using a simple no-op wrapper, or by adding a proper implementation of update(). The latter has only been done for the AMG and ILU0 preconditioners, but the results are very promising, it significantly cuts linear solve times for OPM Flow using CPR/AMG preconditioning, with only marginal increase in linear iterations observed.
2.
The changes to dune-istl in Dune 2.6 made it possible to exploit object-oriented techniques for linear solvers and preconditioners. With those changes it became feasible to treat preconditioners polymorphically at runtime. In the opm-simulators module mentioned above, we have made a few classes, PreconditionerFactory and FlexibleSolver that exploit this to let itself be configured entirely at runtime, using a parameter tree. It works for both serial and parallel cases, as it is templated on the operator type. I hope that this is interesting to the Dune community, and would like to contribute this to dune-istl. There are a few issues to discuss first, though:
a) The PreconditionerFactory we have made uses the preconditioner interface with update() as described above, because it is important to us. In any case the interface should be decided on before adding any PreconditionerFactory to dune-istl.
b) The runtime-flexible classes are controlled by using boost::property_tree::ptree, which in turn is typically created from a JSON file. I imagine that this must change to Dune::ParameterTree? We then need to replace the JSON by something else, or can we add JSON support to ParameterTree?
This is an example of a JSON file setting up a BiCGStab solver with a CPR preconditioner using AMG as its inner preconditioner (with ILU0 as its smoother), and ParallelOverlappingILU0 as its outer preconditioner:
{
"tol": "1e-2",
"maxiter": "20",
"verbosity": "0",
"solver": "bicgstab",
"preconditioner": {
"type": "cpr",
"pressure_var_index": "1",
"finesmoother": {
"type": "ParOverILU0",
"relaxation": "1.0"
},
"coarsesolver": {
"tol": "1e-1",
"maxiter": "1",
"verbosity": "0",
"solver": "loopsolver",
"preconditioner": {
"type": "amg",
"smoother": "ILU0",
"maxlevel": "5",
"coarsenTarget": "1000",
"alpha": "0.2",
"beta": "0.0001",
"verbosity": "0",
"relaxation": "1.0",
"iterations": "1"
}
},
"verbosity": "0"
}
}
I hope this is interesting to you, and welcome any feedback. Also, to ensure any code is formatted according to Dune standards, do anyone have a spec file for clang-format?
Sincerely Yours,
Atgeirr Flø Rasmussen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20190919/3b2ef63a/attachment.htm>
More information about the Dune-devel
mailing list