2 Commits

Author SHA1 Message Date
janik 14cdf4c7ee Add balanced quadtree grid engine (adaptive cells, phase 1)
fill_resistance/quadtree.py decomposes a layer's fine copper mask into
2:1-balanced power-of-two leaves: boundary and keep-fine cells stay at
the fine size, interiors coarsen with their Chebyshev distance to the
nearest feature (guard factor, default 4), and an explicit enforcement
pass splits any leaf more than twice an edge-adjacent neighbor. Face
conductances use the series-half-cell rule, which reduces to the
production harmonic mean for equal sizes and EXACTLY to sigma in the
uniform limit - verified edge-for-edge against solver.build_edges and
to rel 1e-12 in R against run_solve, so the exact-value test suite
stays authoritative for this engine.

Measured (feature-dense 120x120 plate, h=50um, production AMG solver):
uniform 5.58M unknowns ~35s; adaptive guard=4 823k / ~8s at -1.1%;
guard=8 1.74M / ~12s at -0.47%. tools/adaptive_proto.py now benchmarks
the engine itself.

Not yet wired into the pipeline: phase 2 ports electrodes, barrels,
1D chains, buildup and field output onto leaves.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 17:05:31 +07:00
janik b68115b4aa Add validated quadtree-adaptive grid prototype with benchmark numbers
Proves the design for true adaptive cell sizes: bottom-up coarsening of
the existing fine raster into power-of-two leaves (erosion-graded),
vectorized leaf-graph construction whose uniform limit reproduces the
production grid exactly (rel diff 0), solved with the production
assembly + AMG. On an adversarial 5.6M-cell geometry: 12x fewer
unknowns at -0.42% R (27 s -> 3 s) up to 26x at -2.1%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 16:54:16 +07:00