SubmeshHierarchy#5083
Conversation
|
I think some discussion must happen before opening such involved AI-generated PRs. In particular I am not sure if this is the intended way of composing MeshHierarchy and Submesh. What happens if one creates the Submesh on the base mesh instead? |
|
Updated the PR to address Pablo's review feedback. Summary of changes: mesh.py: Dropped mg/mesh.py: Replaced the
test: Updated to use the explicit All three GMG tests (hierarchy construction, fieldsplit GMG, monolithic GMG) pass. |
b321a34 to
7afa595
Compare
53763cd to
b67e66d
Compare
Replace the implicit Submesh(mh[-1], ...) approach with Pablo's explicit MeshHierarchy(submesh, nref) API. Three architectural changes: * mesh.py: Drop _create_submesh_raw; inline the body back into Submesh and store _submesh_label_name / _submesh_label_value / _submesh_ignore_halo so that MeshHierarchy can replay the same filter on each parent level. * mg/mesh.py: Add MeshSequence support at the top of MeshHierarchy (builds independent hierarchies for each component, wraps fine meshes in MeshSequenceGeometry). Add submesh_parent branch: for a Submesh, re-apply dmcommon.submesh_create to each level of the pre-existing parent hierarchy rather than refining the submesh DM directly. Remove the now-superseded _build_submesh_hierarchy_for_level and _submesh_coarse_to_fine_cells helpers. The coarse_to_fine_cells computation for submesh pairs is delegated to the same impl.coarse_to_fine_cells call as for volume meshes, which works because submesh_create preserves the consecutive child-numbering property. * test: Update test_submesh_mg.py to use the new explicit API (build parent hierarchy first, then call MeshHierarchy(submesh, nref)). The dmhooks.py / mg/embedded.py / mg/ufl_utils.py fixes from the previous commit are kept unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
37668d7 to
d9f3b48
Compare
5be65fa to
77f8efc
Compare
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
This PR was generated almost entirely by Claude Code (and then almost entirely rewritten by @pbrubeck).
Description
Introduces
SubmeshHierarchythat simply wrapsHierachyBase(Submesh)to enable geometric multigrid on multidomain problems withSubmeshThis PR also adds the first demo explaining
SubmeshandMeasureintersection.