Ferrite-FEM/Ferrite.jl

AMR for line grids (1D forest of binary trees)

Aperta

#1431 aperta il 30 lug 2026

 (0 commenti) (0 reazioni) (0 assegnatari)Julia (109 fork)github user discovery
AMRfeaturegood first issue

Metriche repository

Star
 (439 stelle)
Metriche merge PR
 (Merge medio 15g 5h) (17 PR mergiate in 30 g)

Descrizione

#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/vertices are 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 creategrid needs no conformity info and a Grid (not a NonConformingGrid) could be returned.
  • Most of the entry points (refine!, coarsen!, refine_and_coarsen!, balanceforest!, creategrid) should generalize with small, mostly mechanical dim = 1 methods.

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.

Guida contributor