Skip to content

Repository files navigation

rfx

██████╗ ███████╗██╗  ██╗
██╔══██╗██╔════╝╚██╗██╔╝
██████╔╝█████╗   ╚███╔╝
██╔══██╗██╔══╝   ██╔██╗
██║  ██║██║     ██╔╝ ██╗
╚═╝  ╚═╝╚═╝     ╚═╝  ╚═╝

Differentiable 3D FDTD electromagnetic simulator for RF and microwave engineering — powered by JAX.

Start with the uniform Cartesian Yee solver. Feature support and its limits live in the support matrix; per-port-family S-parameter limits live in the S-parameter support matrix.

License Tests PyPI Docs

At a Glance

GPU-accelerated 200³ grid on an RTX 4090: 7,266 Mcells/s with PEC walls, 2,087 Mcells/s with CPML absorbers — an open-boundary simulation pays the absorber, so quote the second for antenna/scattering work. Measured by marginal-cost differencing (scripts/diagnostics/gpu_throughput_bench.py); see the benchmark guide for other cards.
Differentiable jax.grad through the time-domain solver for sensitivity and inverse design
RF workflow tools materials, sources, probes, ports, S-parameters, Harminv, far-field / RCS
Per-family S-parameters lumped/wire, microstrip, rectangular waveguide, and coaxial paths use distinct calculators
Preflight + fidelity guards sim.fidelity_report() shows declared-vs-rasterized geometry before a solve; sim.preflight() surfaces setup errors and support-boundary issues
Supervisable long runs report_every=N prints step count, elapsed time, rate, and ETA on supported uniform and single-device non-uniform runs when checkpointing is compatible
Cross-validated public cases mapped to Meep / OpenEMS / Palace / analytic references, each with a reproduce command

Installation

pip install rfx-fdtd                  # CPU
pip install "jax[cuda12]" rfx-fdtd    # GPU (JAX + CUDA)

Development install:

git clone https://github.com/bk-squared/rfx.git
cd rfx && pip install -e ".[all]"

Quick Start

from rfx import Box, GaussianPulse, Simulation

sim = Simulation(
    freq_max=5e9,
    domain=(0.14, 0.06, 0.05),
    dx=2e-3,
    boundary="cpml",
    cpml_layers=8,
)
sim.add_material("slab", eps_r=2.2, sigma=0.01)
sim.add(Box((0.07, 0.018, 0.018), (0.09, 0.042, 0.032)), material="slab")
sim.add_source(
    (0.03, 0.03, 0.025),
    "ez",
    waveform=GaussianPulse(f0=3e9, bandwidth=0.8),
)
sim.add_probe((0.11, 0.03, 0.025), "ez")

sim.fidelity_report()
preflight = sim.preflight()
print(preflight.format())
preflight.raise_for_failure()

result = sim.run(n_steps=1200, report_every=200)
print(result.time_series.shape)

fidelity_report() describes how each entity rasterizes; it does not predict RF error. Progress reporting is off by default and does not change returned arrays.

For a real antenna workflow — including the mesh, time-window, and reference checks required before reporting RF results — follow the First Patch tutorial.

Interfaces

Beyond the Python API:

  • Dashboardpip install "rfx-fdtd[dashboard]" && rfx-dashboard: browser GUI for building, running, and inspecting a simulation.
  • Experiment CLIrfx experiment run <spec.json>: versioned CPU runs from a strict JSON spec, with submit/status/cancel.
  • Studio + MCPpip install "rfx-fdtd[studio]" && rfx studio: local app with append-only experiment revisions, approval-gated MCP actions, and an optional LLM Design Copilot.

The Experiment CLI and Studio/MCP share the same ExperimentSpec format. Details, safety model, and remote deployment: Studio, CLI, and MCP Experiments.

Differentiable Design

JAX-traced objectives for inverse design — sensitivity calculations through the discrete solver, validated per port family. Runnable examples with finite-difference cross-checks live in examples/inverse_design/; background in the Autodiff and Adjoint guide.

Validation

Every public cross-validation case is mapped to a named analytic or external reference with a reproduce command and acceptance gates. Start with Cross-Validation and Accuracy for the support limits, then Benchmarks for the per-case numbers. The CPU-feasible subset runs locally:

PYTHONPATH=. python scripts/run_crossval_cpu.py

Exit codes: 0 all gates passed, 1 a gate failed, 2 a required external reference was unavailable (inconclusive, not silently green).

Documentation

Full documentation: remilab.ai/rfx

Citation

@software{kim_rfx_2026,
  author       = {Byungkwan Kim},
  title        = {rfx: JAX-based differentiable 3D FDTD simulator for RF engineering},
  institution  = {REMI Lab, Chungnam National University},
  year         = {2026},
  url          = {https://github.com/bk-squared/rfx}
}

License

MIT License. See LICENSE.

Acknowledgments

Developed by Byungkwan Kim at the Radar & ElectroMagnetic Intelligence (REMI) Laboratory, Chungnam National University.