Restrict Vanka patches to the adaptively refined region - #5333
Draft
pbrubeck wants to merge 2 commits into
Draft
Conversation
…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>
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.
ASMVankaPCbuilt its index sets in Python, taking each seed's star and closure throughgetTransitiveClosureand gathering the dofs point by point — the same general pathASMStarPChad before #5329. Coloring already groupedASMStarPC's patches and restricted them to an adaptively refined region, butASMVankaPChad 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_coloringhad no restriction to key its grouping on.ASMVankaPCnow sharesASMStarPC's Cython IS-construction mechanism infiredrake/cython/patchimpl.pyx.create_star_points()takes the star of each owned seed as before; the newcreate_closure_points()takes the closure of a group of points, which applied to those stars is what-pc_patch_construct_type vankasolves for. Seeds may be restricted to the region that was genuinely refined, the same wayASMStarPC's do, and the coloring then colors only those.Changes
create_closure_points()and the widenedcreate_patch_ises()replacebuild_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, withpc_vanka_include_type entity, the seed alone — while the included ones read its closure.get_colors()no longer forcesmat_coloring_typetopowerfor the distance-three separation Vanka patches need: PETSc'sDMPlexCreateColoringLabel()(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/_valueandpc_vanka_adaptiverestrictASMVankaPCthe same way the equivalentASMStarPCoptions do.PatchPCalready applies the same restriction for-patch_pc_patch_construct_type vanka, since itsadaptiveoption is construct-type agnostic.Options
pc_vanka_adaptiveASMVankaPCto the entities whose patch meets the refined region, building the label frommesh.adaptive_cell_maps.pc_vanka_construct_label/_valueASMVankaPCto anyDMLabelalready on the mesh's DMPlex, for a region the adaptive machinery did not produce.pc_vanka_use_coloringpc_vanka_exclude_subspaces.Tests
Added to
tests/firedrake/regression/test_star_pc.py:test_adaptive_vanka_equivalence,test_adaptive_vanka_coloring, andtest_adaptive_vanka_is_restricted, mirroring the existingtest_adaptive_star_*tests but driving a manufactured Taylor-Hood Stokes problem throughASMVankaPCandPatchPC(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 newadaptive_vanka_meshfixture supplies it alongside the existingadaptive_mesh.AI was used to draft this change (Claude Code, Sonnet 5).