Repository navigation
Mesh.multigrid_levels: the mesh's multigrid hierarchy, coarsest first - #915
Merged
Merged
Conversation
…irst A read-only property that returns the mesh's hierarchy levels as a tuple, coarsest first and ending with the mesh itself: tuple(self._coarse_level_meshes()[:-1]) + (self,). That is the coarse tail a custom multigrid hierarchy is built from. Until now it was reached through the private _coarse_level_meshes() and an index trick, `_coarse_level_meshes()[:-1] + [mesh]`, in scripts, tests and the place_fault_ribbon example. The example now uses the property. The name follows set_custom_fmg and CustomMGHierarchy.level_meshes (coarsest first, the solver's mesh last); on a Mesh, "multigrid_levels" says which hierarchy is meant. test_1016_mesh_multigrid_levels checks: - the levels against dm_hierarchy, with the four-to-one cell count of a uniform triangle refinement; - that the mesh itself is the last level; - that the levels are built once and the property is read-only; - that an unrefined mesh is its own single level; - a custom FMG Poisson solve on levels[:-1] with one PCMG level per entry. Underworld development team with AI support from Claude Code
…docstring From the adversarial review. The property now resolves the levels in the solver's own order: - the coarse tail the mesh owns (an adapt child's, which its solvers pick up with no set_custom_fmg call), followed by the mesh; - else the refinement or coarsening hierarchy. On an adapt child it used to return the child alone while the child's solvers ran four levels. A single-level mesh returns itself without going through _coarse_level_meshes. That call wrapped the mesh into a hidden duplicate and re-tagged it, so reading the property on a coarse level of another hierarchy took that level out of its refine family and lost the pair its exact nested transfer. The docstring now says: - coarsened levels carry no boundary labels; - the first access is collective; - the levels are built once and are not rebuilt when the mesh is deformed or remeshed. It drops the claim that every consecutive pair transfers exactly. Its ribbon example uses a 3-D base, as place_fault_ribbon requires. The tests now cover: - the native refine pair on every consecutive refinement level, before and after reading the property on each level; - no wrap built for an unrefined mesh; - a coarsening hierarchy (serial: PETSc coarsens a distributed 2-D mesh through ParMmg, which is 3-D only); - an adapt child, whose levels are its tail and match the levels of the multigrid its solver picks up. Marks: level 2 on the module, since the tests solve; the tier on each test. Underworld development team with AI support from Claude Code
Member
Author
Adversarial review (fixes in 185da98)Reviewed by a separate agent against Findings and what was done
On the head (development fc67b65 merged in), test_1016, test_1010 and test_1022 pass: 40 tests. Underworld development team with AI support from Claude Code |
PETSc coarsens a mesh through its mmg adaptor. conda-forge's PETSc
3.25.3, which CI runs, is built without mmg, and the test failed there
with "Grid adaptor mmg not registered" (error 63). It is now skipped when
PETSc.Sys.hasExternalPackage("mmg") is False. It still runs on the custom
PETSc builds (amr), where test_1016's 6 tests pass.
Underworld development team with AI support from Claude Code
lmoresi
added a commit
that referenced
this pull request
Oct 31, 2026
…patch on the split finest level (ruling of 2026-11-01) The fault-multigrid guide drops the chain as what production runs and states the ruled tail with its counts from the tail sweep on #912's build; its configuration rule on the blocks now says FAC blocks are LU and records that the rotated path ran them as ILU(0) from 2026-09-03 until #912 (#892). The split-level section says the library merged (#889, #890) and keeps the chain as the measured alternative. Mesh.multigrid_levels (#915) replaces the private accessor. The faults-in-convection guide's hierarchy section, code and table are rewritten to the welded tail, with the chain labelled as the alternative and the ILU-era table retired to the journal. The guide is added to the developer toctree it was missing from. Underworld development team with AI support from Claude Code
Merged
9 tasks done
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.
Mesh.multigrid_levelsis a read-only property: the mesh's multigrid hierarchy as meshes, coarsest first, ending with the mesh itself. That is the coarse tail a custom multigrid hierarchy is built from. Until now it was reached through the private_coarse_level_meshes()and an index trick in scripts, tests and theplace_fault_ribbonexample. The example now uses the property.What it returns
The levels come in the order the solver's own multigrid uses them:
set_custom_fmgcall), followed by the mesh;The levels are built once and are not rebuilt when the mesh is deformed or remeshed. The first access is collective. Coarsened levels carry no boundary labels. The docstring says all three.
The name follows
set_custom_fmgandCustomMGHierarchy.level_meshes: coarsest first, the solver's mesh last.Tests
test_1016_mesh_multigrid_levels checks:
dm_hierarchy, with the four-to-one cell count of a uniform triangle refinement;levels[:-1]with one PCMG level per entry.On this head, with development fc67b65 merged in, test_1016, test_1010 and test_1022 pass: 40 tests.
Review
The adversarial review (185da98) is in the first comment.
Underworld development team with AI support from Claude Code