Skip to content

feat: quadtree regridding and tags from marker counts - #70

Merged
max-models merged 2 commits into
develfrom
claude/tree-d3d-poison-maxwell-atyjic
Nov 25, 2026
Merged

max-models merged 2 commits into
develfrom
claude/tree-d3d-poison-maxwell-atyjic

Conversation

@max-models

@max-models max-models commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

A second way for regrid to place patches: AMRHierarchy.regrid(method="quadtree", block_size=16) cuts every level into aligned square blocks of block_size cells and makes a patch of each block that holds a tag. The blocks of a level are the children of those below; the nesting margin is propagated down so the tree is balanced. Blocks at the edge of the domain (an L) or of forbidden cells are cut to their allowed cells. quadtree_boxes returns the boxes on their own. Everything downstream (halos, transfer, markers, solvers) is unchanged, since the result is an ordinary properly nested hierarchy.

marker_tags(hierarchy, x, y, per_cell=..., levels=...) tags the cells holding more than per_cell markers, counted over all ranks, for refinement driven by marker counts (like a particle tree's leaf capacity).

New tutorial "Quadtree patches": cluster vs quadtree on the same tags, the parent/child structure, a marker-count mesh with a deposit and a nodal Poisson solve on it, and a moving beam. Following the beam, the quadtree (block 8) keeps ~88% of its patches per regrid against ~0% for the clusters, for about the same number of refined cells, but with ~20x more patches.

Checklist

  • pre-commit run and pytest pass (718 passed locally; the new tests also under mpirun -n 2/3/4)
  • New code has docstrings and tests
  • The docs (docs/, tutorials or README.qmd) are updated where the behaviour changed
  • The commit messages follow Conventional Commits (feat:, fix:, docs:, ...)

@max-models
max-models merged commit e013e7d into devel Nov 25, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant