README: potential map as its own figure, |J| map back to plain

The overlaid contour lines belonged on the potential plot the plugin
already produces; demo-potential.png is that figure for the same demo
solve.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
janik
2026-07-17 12:29:58 +07:00
parent 4408a4481d
commit 935cb2a959
4 changed files with 8 additions and 25 deletions
+6 -4
View File
@@ -16,10 +16,12 @@ current**. PNGs + a text summary are saved per run.
THT-pad contact (V+, injected at the drill-wall ring) squeezes past a THT-pad contact (V+, injected at the drill-wall ring) squeezes past a
notch in the F.Cu pour, transfers through the stitching-via field into notch in the F.Cu pour, transfers through the stitching-via field into
the B.Cu pour and leaves at the V lug — per-via currents and the the B.Cu pour and leaves at the V lug — per-via currents and the
hottest via are reported. The white equipotential lines share their hottest via are reported.*
levels across the layers, so their density reads as field strength:
nearly the whole drop happens around the notch on F.Cu, only two lines ![Potential on the two-layer demo net](docs/img/demo-potential.png)
fall across the B.Cu pour.* *The matching potential map with equipotential contour lines: they
bunch where the field is strongest — nearly the whole 8.7 mV drop
happens around the notch on F.Cu.*
Uses the KiCad **IPC API** (`kicad-python` / `kipy`), not the deprecated Uses the KiCad **IPC API** (`kicad-python` / `kipy`), not the deprecated
SWIG API. Requires KiCad **10.0.1+**. SWIG API. Requires KiCad **10.0.1+**.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

+2 -21
View File
@@ -104,32 +104,13 @@ def demo_problem() -> Problem:
return p return p
def _overlay_potential(fig, res, stack):
"""Equipotential contours on the per-layer current-density axes,
on shared levels so line density reads as field strength."""
vmax = float(np.nanmax(res.V))
vmin = min(0.0, float(np.nanmin(res.V)))
levels = np.linspace(vmin, vmax, 17)[1:-1]
ext = stack.extent_mm()
ny, nx = stack.shape2d
xs = np.linspace(ext[0], ext[1], nx, endpoint=False)
xs += (xs[1] - xs[0]) / 2
ys = np.linspace(ext[3], ext[2], ny, endpoint=False)
ys += (ys[1] - ys[0]) / 2
for li, ax in enumerate(a for a in fig.axes if a.images):
with np.errstate(invalid="ignore"):
ax.contour(xs, ys, res.V[li], levels=levels, colors="white",
linewidths=0.5, alpha=0.65)
def gen_demo_maps(): def gen_demo_maps():
p = demo_problem() p = demo_problem()
res, stack, e1, e2 = _solve(p, 0.05) res, stack, e1, e2 = _solve(p, 0.05)
fig_j = plots.fig_current(res, stack, e1, e2, p)
_overlay_potential(fig_j, res, stack)
figs = [ figs = [
(plots.fig_raster(stack, e1, e2, p, res), "demo-raster"), (plots.fig_raster(stack, e1, e2, p, res), "demo-raster"),
(fig_j, "demo-current"), (plots.fig_current(res, stack, e1, e2, p), "demo-current"),
(plots.fig_potential(res, stack, e1, e2, p), "demo-potential"),
] ]
plots.save_and_show(figs, OUT, show=False) plots.save_and_show(figs, OUT, show=False)