Skip to content

Pass restriction matrix to GTMGPC #4367

@eikehmueller

Description

@eikehmueller
Contributor

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:

hybridized_mixed_lumped.py.txt

Activity

eikehmueller

eikehmueller commented on Jun 13, 2025

@eikehmueller
ContributorAuthor

Extending GTMGPC to accept an additional (optional) key to the appctx dictionary 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 to None, and the restriction matrix defaults to the transpose of the interpolation matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Development

Participants

@pbrubeck@eikehmueller

Issue actions

    Pass restriction matrix to GTMGPC · Issue #4367 · firedrakeproject/firedrake