-
Notifications
You must be signed in to change notification settings - Fork 176
Description
Describe the current issue
At the moment, it is only possible to set the interpolation matrix P for GTMGPC. However, it might be desirable to also set the restriction matrix, which is not necessarily the transpose of P. For example, for the setup in this paper the residual needs to be scaled by a diagonal matrix after restriction, and this could be taken care of by supplying a restriction matrix whose rows have been scaled appropriately.
Describe the solution you'd like
Pass the restriction matrix through an appctx. Add the following to the initialise() method of GTMGPC:
restr_petscmat = appctx.get("restriction_matrix", None)
if restr_petscmat is not None:
pcmg.setMGRestriction(1, restr_petscmat)
Describe alternatives you've considered
Alternatively, to address the scaling problem described above, one could try to pass through a scaling factor for the residual after restriction, i.e. do something like this:
rscale = appctx.get("rscale", None)
if rscale is not None:
pcmg.setMGRScale(1, rscale)
However, this does not appear to work since setMGRScale() is only used for non-linear multigrid.
Additional info
The following code contains an example which uses the workaround for passing the restriction as a PETSc matrix:
Activity
eikehmueller commentedon Jun 13, 2025
Extending
GTMGPCto accept an additional (optional) key to theappctxdictionary for the restriction matrix seems natural and backward-compatible, so I don't see any reason for not doing this. If the callback is not specified it will default toNone, and the restriction matrix defaults to the transpose of the interpolation matrix.