Ferrite-FEM / Ferrite-FEM/Ferrite.jl

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

Open
#1,431 0 comments 0 reactions 0 assignees View on GitHub
AMR feature good first issue
Dominant language
Julia
Stars
453
Forks
115
Avg merge
1d 17h
Merged PRs (30d)
11

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](https://github.com/Ferrite-FEM/Ferrite.jl/pull/780#discussion_r3677048021)).

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.