Skip to content

Conversation

@pbrubeck
Copy link
Contributor

@pbrubeck pbrubeck commented Nov 4, 2025

Description

Fixes #4687

Depends on https://gitlab.com/petsc/petsc/-/merge_requests/8860 to trigger preconditioner update for a MatNest with more than one field on a block of the fieldsplit.

Also fixes fieldsplit for AssembledMatrix with bcs

Cleanup create_subdm in dmhooks.py

@pbrubeck pbrubeck force-pushed the pbrubeck/fix/nest-fieldsplit branch from 7c9dfcc to aaabace Compare November 4, 2025 17:24
@pbrubeck pbrubeck changed the title Fieldsplit: update MatNest Jacobian Fieldsplit: update MatNest Jacobian and support bcs on AssembledMatrix Nov 4, 2025
Comment on lines 517 to 524
# Bump petsc matrix state of each split by assembling them.
# Ensures that if the matrix changed, the preconditioner is
# updated if necessary.
for field, splits in ctx._splits.items():
for subctx in splits:
subctx._jac.assemble()
if subctx.Jp is not None:
subctx._pjac.assemble()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanozampini I think this should be called elsewhere, maybe in pyop2 or PETSc, but so far this fixes the bug #4687. This is very similar to what we had to do for MatIS

if op2tensor.handle.getType() == "is":
# Flag the entire matrix as assembled before indexing the diagonal block
op2tensor.handle.assemble()

@pbrubeck pbrubeck force-pushed the pbrubeck/fix/nest-fieldsplit branch from abddfda to 4ab9490 Compare November 21, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants