Support -snes_adapt#5213
Open
pbrubeck wants to merge 8 commits into
Open
Conversation
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
pbrubeck
commented
Jul 2, 2026
b27150b to
4932ac2
Compare
pbrubeck
commented
Jul 2, 2026
9bab35e to
8e73057
Compare
230017a to
f817644
Compare
1c7406a to
5ff2783
Compare
pbrubeck
commented
Jul 3, 2026
pbrubeck
commented
Jul 3, 2026
pbrubeck
commented
Jul 3, 2026
pbrubeck
commented
Jul 3, 2026
pbrubeck
commented
Jul 3, 2026
pbrubeck
commented
Jul 3, 2026
pbrubeck
commented
Jul 3, 2026
…x a DM refcount bug in adaptive refinement refine() no longer falls back to coarsen(): both now share a common reconstruct() singledispatch for direction-agnostic handlers, and only register their own special cases (Mesh, FunctionSpace, Function/Cofunction). Also fix a segfault in -snes_adapt_sequence: DMAdaptorAdapt() unconditionally destroys its input DM once a level is superseded, but AdaptiveMeshHierarchy keeps that DM alive as a coarse grid, so take an extra reference before that happens.
pbrubeck
commented
Jul 9, 2026
pbrubeck
commented
Jul 9, 2026
pbrubeck
commented
Jul 9, 2026
Comment on lines
+454
to
+456
| # DMAdaptorAdapt() unconditionally destroys its input DM, but | ||
| # AdaptiveMeshHierarchy keeps this level's DM alive as a coarse grid. | ||
| dm.incRef() |
Contributor
Author
There was a problem hiding this comment.
Should we only keep alive the coarsest level?
pbrubeck
commented
Jul 9, 2026
pbrubeck
commented
Jul 9, 2026
pbrubeck
commented
Jul 9, 2026
dc269c6 to
aa43084
Compare
pbrubeck
commented
Jul 9, 2026
pbrubeck
commented
Jul 9, 2026
| name = f"{name}_level_{level}" | ||
|
|
||
| new = firedrake.Function(Vnew, name=name) | ||
| new.interpolate(expr) |
Contributor
Author
There was a problem hiding this comment.
We should prolong instead, and that would be done at a later point
Suggested change
| new.interpolate(expr) |
pbrubeck
commented
Jul 9, 2026
| if is_dual(c): | ||
| manager.restrict(c, cmapping[c]) | ||
| if clevel > mlevel: | ||
| manager.restrict(c, mapped) |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| manager.restrict(c, mapped) | |
| manager.restrict(c, mapped) | |
| else: | |
| mapped.interpolate(c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Codex-assisted.
Implements UFL-level refinement of a variational problem and PETSc-level refinement of the SNES solver. In this way, users will not require to write the adaptivity loop themselves.
Depends on https://gitlab.com/petsc/petsc/-/merge_requests/9407