Skip to content

Mesh Adaptivity via DMPlexTransform - #5215

Merged
pbrubeck merged 113 commits into
mainfrom
pbrubeck/mg-redist
Jul 31, 2026
Merged

Mesh Adaptivity via DMPlexTransform #5215
pbrubeck merged 113 commits into
mainfrom
pbrubeck/mg-redist

Conversation

@pbrubeck

@pbrubeck pbrubeck commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

AI-assisted

Enables adaptivity on any simplicial mesh via DMPlex.adaptLabel()/DMPlex.transform()
Depends on https://gitlab.com/petsc/petsc/-/merge_requests/9412 (merged) which introduces 3D adaptivity

Enables prolong/restrict/inject to natively support adaptively-refined hierarchies

Deprecate hierarchy-agnostic AdaptiveMeshHierarchy/AdaptiveTransferManager in favour of MeshHierarchy/TransferManager, now with adaptivity support.

@pbrubeck pbrubeck changed the title Native support for redistributed AdaptiveMeshHierarchy TransferManager: support a redistributed AdaptiveMeshHierarchy Jul 3, 2026
@pbrubeck
pbrubeck force-pushed the pbrubeck/mg-redist branch 2 times, most recently from 404f925 to 381f544 Compare July 3, 2026 19:51
@pbrubeck
pbrubeck force-pushed the pbrubeck/mg-redist branch from 381f544 to 885a7eb Compare July 3, 2026 19:56
Comment thread firedrake/mg/interface.py Outdated
Comment thread firedrake/mg/adaptive_hierarchy.py Outdated
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/mg/utils.py Outdated
Comment thread firedrake/mg/utils.py Outdated
@pbrubeck pbrubeck mentioned this pull request Jul 28, 2026
@pbrubeck

Copy link
Copy Markdown
Contributor Author

Tests are green (modulo a known stochastic failure that we should probably skip/remove)

pbrubeck and others added 2 commits July 30, 2026 01:27
A MeshHierarchy is no longer restricted to uniform refinement: add_mesh
and adapt move onto HierarchyBase, so uniform and adaptive levels stack
in one hierarchy. MeshHierarchy defaults to zero refinement levels, and
AdaptiveMeshHierarchy becomes a deprecated shim next to it, as
AdaptiveTransferManager is next to TransferManager.

Cell maps are now built in add_mesh rather than stashed on the mesh
behind a getattr. refine_marked_elements seeds a parent-cell label once
and lets the refine_sbr transform propagate it, so after any number of
rounds every fine cell still names the cell of the original mesh it
descends from; that removes the per-round composition of the cell maps
and the ragged inversion that rebuilt coarse_to_fine, both of which
looped over every fine cell in Python.

MeshGeometry declares adaptive_parent and adaptive_cell_maps in its
constructor, so add_mesh can check that the maps it is given belong to
the level it is stacking on instead of assuming it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/adapt.py
Comment thread firedrake/adapt.py
Comment thread firedrake/mg/mesh.py Outdated
Comment thread firedrake/mg/embedded.py Outdated
Comment thread firedrake/cython/mgimpl.pyx Outdated
Comment thread firedrake/cython/mgimpl.pyx Outdated
Comment thread firedrake/cython/mgimpl.pyx Outdated
Comment thread firedrake/mg/mesh.py Outdated
Comment thread firedrake/mg/mesh.py Outdated
Comment thread firedrake/netgen.py Outdated
Comment thread firedrake/mg/mesh.py Outdated
Comment thread firedrake/mg/mesh.py Outdated
pbrubeck and others added 2 commits July 30, 2026 12:28
Comment thread firedrake/netgen.py Outdated

@connorjward connorjward left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Last thing. I am now happy with the rest of the code.

Comment thread firedrake/cython/mgimpl.pyx
Comment thread firedrake/adapt.py
@pbrubeck
pbrubeck merged commit 3654347 into main Jul 31, 2026
24 of 28 checks passed
@pbrubeck
pbrubeck deleted the pbrubeck/mg-redist branch July 31, 2026 10:37
pbrubeck added a commit that referenced this pull request Aug 5, 2026
The recorded multigrid iteration counts and convergence plot predate
#5215's DMPlexTransform-based mesh adaptivity; regenerate both against
current refine_marked_elements output.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

3 participants