FieldForge 開源工具讓 KiCad 電路板直接進行電磁模擬
Open-source, GPU-first EM simulation and automated meshing for KiCad
檢查電路板的訊號品質,常得先轉換板子資料,再手動準備模擬模型。
- FieldForge 是一套開源工具,可在 KiCad 選取走線或差動對,讀出板子的形狀與層板設定,自動建立電磁模擬模型,並把結果畫回外掛介面,不必來回轉換 Gerber 檔或手動調整網格。專案也提供 GPU 模擬與 Touchstone 輸出。
- 作者表示,部分結果已和解析計算及 gerber2ems 交叉比對,並公開驗證報告。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
FieldForge 把 KiCad 的板層與走線資料直接轉成模擬模型,並提供比對結果,呈現免手動網格處理的電路模擬流程。
Open-source, GPU-first EM simulation + automated meshing for KiCad (1–50 GHz PCB SI).
Select a net or differential pair in KiCad → exact geometry + stackup extracted over the IPC API → auto-meshed openEMS / Palace model → Touchstone S-parameters plotted back in the plugin. No Gerber round-trip, no manual meshing.
Status: board extraction, automated meshing, GPU FDTD and shielded-MoM S-parameter production are working end to end, including mixed-mode pairs and via-transition sweeps through 50 GHz.
Shipped so far (each with tests + a committed validation report):
- Headless KiCad 9 IPC extraction (nets → layered polygons + vias + stackup), verified on Antmicro Jetson Orin (8L), HackRF One, Castor & Pollux, StickHub — three .kicad_pcb format generations through one code path.
- Auto graded grid (1/3–2/3 edge snapping, smoothness ≤ 1.5) + openEMS backend:
microstrip Z0 −1.74% / stripline +1.21% vs analytic (2 % gates, zero manual
mesh edits) —
validation/reports/p04_z0_gates.*. - gerber2ems head-to-head on identical coupons: diff pair |ΔSDD21| p95 0.32 dB,
|ΔSDD11| 2.34 dB (0.2–6 GHz, gates 0.5/3 dB) — PASS; reference-tool passivity
limits documented above 12 GHz —
validation/reports/p05_crosscheck.*. - Palace/Gmsh emitter (prism extrusion, SIBC tags, lumped ports) — solve queued
for the lab server (
docs/server-runbook.md). - PyQt6 plugin: net picker → extract → simulate → S-param panel, with automatic net-region cutout meshing.
- CUDA Yee kernels (sm_61 + sm_86) with exact-advection gates, plus the
ff_yee3d_*physics-module ABI described below. Via-transition validation reaches 50 GHz (validation/reports/p40_fdtd_via.json). - Shielded-MoM production path (
mom): board or cached geometry in, dense GPU solve where available, adaptive band synthesis, Touchstone output, and honest linear-point fallback when a rational fit is not passive or cannot converge. Coupled pairs produce mixed-mode SDD/SCC files (--diff), with passivity and reciprocity recorded in the report (docs/product_loop.md).
SI plots
Mixed-mode SDD parameters and the corresponding Smith chart for a real bridge3090 differential pair (12 solved points, 0.2–6 GHz):
The same SDD loci projected onto the Riemann hemisphere:
An |S(i,j)| heatmap for the NVCLK1_P four-port network at 2 GHz:
Generate these views with mom.plot: --mm for mixed-mode labels and
--sphere for the hemisphere projection. The solver also writes the underlying
Touchstone and JSON reports, so every figure remains machine-checkable.
Quick start (dev box):
./ci/run_ci.sh all # unit + KiCad + solver + CUDA tiers
python -m fieldforge_gui.app --board <your.kicad_pcb> # from kicad-plugin/
Shielded-MoM product loop — one command to S-parameters:
python -m mom board.kicad_pcb --nets NET_P,NET_N --band 0.5:4
python -m mom geoms.pkl --name jetson_can --band 0.5:4 --loss --thick
python -m mom pair.pkl --name pair --diff NET_P,NET_N # mixed-mode SDD/SCC
python -m mom.plot out/pair_mm.s4p --mm --sphere # Smith charts
Writes <name>.sNp + <name>.report.json (and <name>_mm.sNp
with --diff); adaptive band synthesis solves ~8–12 points for a
full band and falls back to honest point solves when the fit
can't be trusted (band_mode in the report); GPU auto-detected.
Details: docs/product_loop.md.
Next milestones
- Close the unattended convergence loop across the public mesh gauntlet.
- Complete open-media MoM and SI-aware routing integrations.
- Correlate additional coupon measurements above 6 GHz against the solvers.
Layout
core/ C++20 + CUDA: ffdtd kernels (P1+), C ABI [Apache-2.0]
pyff/ geometry model, extractors, emitters, drivers [Apache-2.0]
kicad-plugin/ IPC-API client + PyQt6 panel [GPL-3.0-or-later]
validation/ benchmark defs, golden data, report generator
docs/ licenses audit, design notes
tests/ pytest suite (V0 analytic gates run in CI)
Credits
- IPC-API board-access patterns adapted from OrthoRoute (MIT, © 2025 bbenchoff).
- Cross-validation baseline: gerber2ems (Apache-2.0, Antmicro).
- Solvers integrated, not reinvented: openEMS (GPL-3), Palace (Apache-2.0), Gmsh, scikit-rf.
License
Apache-2.0 for core/ and pyff/; GPL-3.0-or-later for kicad-plugin/;
see docs/licenses.md for the full dependency audit.
Solver module ABIs (composition contract)
The naive Yee engine (ff_yee3d_*) is the spine; physics modules
compose around the public step call — no engine-internal coupling:
per step: ff_debye_pre(dctx) # E^n snapshot (trap ADE)
ff_yee3d_step(ctx, 1, ...) # H, CPML, E, CPML, source
ff_debye_post(dctx) # dispersion correction
ff_sibc2_apply(damp) # per-face conductor damping
ff_sibc_apply(pin) # thin-sheet E_t (v2 hybrid)
ff_ports_*(pctx) # V/I gather + on-device DFT
- Accessors for sibling modules:
ff_yee3d_get_fields / _get_meta / _get_spacing_tables / _get_material_map(additive-only ABI). ff_march3d_*: fused z-march throughput engine (ping-pong buffers; no CPML/ports yet — capacity/speed path, bit-compatible physics).- CPML profiles:
pyff.cpml(physical-distance grading) is canonical;ffdtd_driver.cpml_tablesis deprecated on graded axes. - Field dumps/viewer:
pyff.fielddump+python -m pyff.ffview. - Measurement instruments: two-probe gated transmission
(
pyff.msl_sibc, ±25% window systematics — documented) and the sealed-box resonator-Q (pyff.resonator_q, window-immune).
Reports index: validation/reports/p1*_*.json — every number
regenerable by the matching validation/gen_*.py.


