Skip to content

Restrict Vanka patches to the adaptively refined region - #5333

Draft
pbrubeck wants to merge 2 commits into
pbrubeck/adaptive-patchfrom
pbrubeck/adaptive-vanka
Draft

Restrict Vanka patches to the adaptively refined region#5333
pbrubeck wants to merge 2 commits into
pbrubeck/adaptive-patchfrom
pbrubeck/adaptive-vanka

Conversation

@pbrubeck

@pbrubeck pbrubeck commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Depends on PETSc petsc/petsc!9484, the tip of the stack !9480 → !9414 → !9481 → !9484. The last commit points CI at that branch and must be dropped before merging.

ASMVankaPC built its index sets in Python, taking each seed's star and closure through getTransitiveClosure and gathering the dofs point by point — the same general path ASMStarPC had before #5329. Coloring already grouped ASMStarPC's patches and restricted them to an adaptively refined region, but ASMVankaPC had neither: every entity of the stratum got a patch, so a smoother on an adaptively refined level relaxed the whole mesh to fix a corner of it, and -pc_vanka_use_coloring had no restriction to key its grouping on.

ASMVankaPC now shares ASMStarPC's Cython IS-construction mechanism in firedrake/cython/patchimpl.pyx. create_star_points() takes the star of each owned seed as before; the new create_closure_points() takes the closure of a group of points, which applied to those stars is what -pc_patch_construct_type vanka solves for. Seeds may be restricted to the region that was genuinely refined, the same way ASMStarPC's do, and the coloring then colors only those.

Changes

  • create_closure_points() and the widened create_patch_ises() replace build_vanka_indices()/get_entity_dofs(), which are gone. create_patch_ises() now takes points and offsets per subspace rather than one array shared by all of them, since a Vanka patch's excluded subspaces (pc_vanka_exclude_subspaces) read only the star — or, with pc_vanka_include_type entity, the seed alone — while the included ones read its closure.
  • get_colors() no longer forces mat_coloring_type to power for the distance-three separation Vanka patches need: PETSc's DMPlexCreateColoringLabel() (petsc/petsc!9484) now folds the requested distance into the graph it colors, so the default greedy coloring, applied at distance one, is correct for any distance.
  • pc_vanka_construct_label/_value and pc_vanka_adaptive restrict ASMVankaPC the same way the equivalent ASMStarPC options do. PatchPC already applies the same restriction for -patch_pc_patch_construct_type vanka, since its adaptive option is construct-type agnostic.

Options

Option Effect
pc_vanka_adaptive Restricts ASMVankaPC to the entities whose patch meets the refined region, building the label from mesh.adaptive_cell_maps.
pc_vanka_construct_label / _value Restricts ASMVankaPC to any DMLabel already on the mesh's DMPlex, for a region the adaptive machinery did not produce.
pc_vanka_use_coloring Unchanged in meaning, but now also colors only the selected entities when combined with either of the above, and correctly separates patches at Vanka's wider reach while respecting pc_vanka_exclude_subspaces.

Tests

Added to tests/firedrake/regression/test_star_pc.py: test_adaptive_vanka_equivalence, test_adaptive_vanka_coloring, and test_adaptive_vanka_is_restricted, mirroring the existing test_adaptive_star_* tests but driving a manufactured Taylor-Hood Stokes problem through ASMVankaPC and PatchPC(construct_type=vanka). They run at 1 and 3 processes; the latter needs mesh overlap distance two rather than one, since a Vanka patch reaches further than a star patch, so a new adaptive_vanka_mesh fixture supplies it alongside the existing adaptive_mesh.

AI was used to draft this change (Claude Code, Sonnet 5).

pbrubeck and others added 2 commits August 6, 2026 19:07
…ction

ASMVankaPC now shares the same Cython IS-construction mechanism as
ASMStarPC: create_star_points() takes the star of each owned seed, and the
new create_closure_points() takes the closure of a group of points which,
applied to those stars, are the points -pc_patch_construct_type vanka
solves for. This replaces the pure-Python build_vanka_indices()/
get_entity_dofs() path that only handled the general, non-colored case.

create_patch_ises() now takes points and offsets per subspace instead of a
single array shared by all of them, since a Vanka patch's excluded
subspaces (pc_vanka_exclude_subspaces) read the star, or with
pc_vanka_include_type entity just the seed, while the included ones read
its closure.

The seeds may be restricted to the entities marked by a DMLabel, named by
pc_vanka_construct_label, and the coloring then colors only those. With
pc_vanka_adaptive the label comes from adapt.mark_refined_entities(), the
same restriction ASMStarPC applies, so that a smoother on an adaptively
refined level only relaxes the entities whose patch meets the refined
region. PatchPC already builds the same restricted patches for
-patch_pc_patch_construct_type vanka, since its adaptive option is
construct-type agnostic.

get_colors() no longer forces the mat_coloring_type to "power" for the
distance-3 separation Vanka patches need: DMPlexCreateColoringLabel() now
folds the requested distance into the graph it builds, so the default
greedy coloring, applied to that graph at distance one, is correct for
any requested distance.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds test_adaptive_vanka_equivalence, test_adaptive_vanka_coloring, and
test_adaptive_vanka_is_restricted, mirroring the existing
test_adaptive_star_* tests: they drive a manufactured Taylor-Hood Stokes
problem through ASMVankaPC and PatchPC(construct_type=vanka), each with
pc_vanka_adaptive/pc_vanka_use_coloring, and check that the two
implementations take the same number of iterations and hold the expected
number of patches.

Unlike a star patch, a Vanka patch reaches every cell that shares a point
with the seed's closure, so validate_overlap() requires overlap distance
two rather than one. The existing adaptive_mesh fixture only requests
distance one, which is enough for ASMStarPC but leaves ASMVankaPC's
patches inconsistent across ranks; adaptive_vanka_mesh requests the extra
overlap, sharing the corner-marking logic with adaptive_mesh through the
new _refined_corner_mesh() helper.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pbrubeck pbrubeck added the base:main Run this PR using a main (dev) build label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

base:main Run this PR using a main (dev) build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant