AMR for line grids (1D forest of binary trees)
#1,431 opened on Jul 30, 2026
Repository metrics
- Stars
- (439 stars)
- PR merge metrics
- (Avg merge 15d 5h) (17 merged PRs in 30d)
Description
#780 adds adaptive mesh refinement for Quadrilateral (2D) and Hexahedron (3D) grids via a p4est-style forest of octrees (ForestBWG). The same machinery could support Line grids in 1D — a forest of binary trees — but this is deliberately left out of the initial PR (review discussion).
Compared to the 2D/3D case, 1D is structurally much simpler, which makes this a nice self-contained follow-up:
OctantBWG{1, 2}("bintant"): 1 coordinate, level +x; Morton index degenerates to the plain binary code,children/parent/verticesare one-liners.- The inter-tree connectivity is trivial: a macro edge ("tree face") is a single vertex shared by at most two trees, so there are no orientations, no corner/edge permutation tables (
ℛ/𝒬/𝒫etc. are not needed at all) — the transform machinery collapses to a mirror-or-shift of one coordinate. - 2:1 balancing reduces to vertex balancing; there are no hanging nodes in a conforming sense (a refined/unrefined interface meets in a shared vertex), so
creategridneeds no conformity info and aGrid(not aNonConformingGrid) could be returned. - Most of the entry points (
refine!,coarsen!,refine_and_coarsen!,balanceforest!,creategrid) should generalize with small, mostly mechanicaldim = 1methods.
Starting points in the code: src/Adaptivity/BWG.jl (OctantBWG, OctreeBWG, ForestBWG, and the DEFAULT_MAXLEVEL tuple, which already reserves a slot for dim = 1), the AMR devdocs page, and test/test_p4est.jl for the test patterns to mirror.
Suggested by @termi-official during the #780 review.