Skip to content

rfx

Differentiable FDTD for RF/Microwave — powered by JAX

rfx is a 3-D finite-difference time-domain (FDTD) electromagnetic simulator built in JAX. It targets RF and microwave engineers who need accurate broadband field solutions, practical RF workflow tooling, and native gradient support for inverse design — without leaving Python.

The docs below cover the stable v1.4.0 package surface and call out selected workflow-hardening and validation updates already merged on main.


FeatureDetail
GPU acceleration7,309 Mcells/s on RTX 4090, 5,847 on RTX 3090, 5,249 on RTX A6000
Multi-GPU distributed FDTDjax.pmap slab decomposition for larger 3-D jobs on a single multi-GPU host
Autodiffjax.grad through the full time-stepping loop for topology and shape optimization
Topology optimizationDensity-based filtering, projection, and beta continuation for inverse design
Time-domain optimization objectivesUse proxy losses such as minimize_reflected_energy() and maximize_transmitted_energy() inside differentiable loops
Conformal PECDey-Mittra method for 2nd-order accuracy on curved conductors
Material fittingDebye/Lorentz fitting plus differentiable FDTD-based refinement from S-parameters
Non-uniform mesh + auto-configGraded z-profiles and auto_configure() for thin substrates and broadband setups
Harminv resonanceHigh-Q mode extraction with sub-bin frequency precision
Multi-mode + Floquet portsRectangular TE/TM eigenmodes and phased-array unit-cell workflows with Bloch periodic BC
Cross-validatedPublished 5-case RF validation plus earlier cavity/waveguide cross-validation vs. Meep and OpenEMS
500+ testsPytest suite with lint + CPU/GPU coverage and advanced-example validation scripts

Terminal window
pip install rfx-fdtd

PyPI package name: rfx-fdtd Python import:

import rfx

GPU support (JAX + CUDA):

Terminal window
pip install "jax[cuda12]" rfx-fdtd

  • v1.4.0 brings waveguide / Floquet ports into differentiable forward() and optimize() loops, so modal and periodic-port workflows stay inside the gradient-based design path.
  • v1.4.0 also adds richer export and dataset I/O: geometry JSON, experiment reports, simulation datasets, optimisation trajectories, and broader far-field / optimisation result saves.
  • v1.4.0 rounds out the advanced solver stack with JAX-differentiable far-field evaluation, experimental ADI 2-D / 3-D paths, SBP-SAT subgridding, and the research-grade example bundle under examples/50_advanced/.
  • Current main continues to harden the workflow with sim.preflight() validation, a 23-script cross-validation bundle, and newer geometry coverage such as the PolylineWire primitive.

Pages that describe evolving or research-grade workflows should say so explicitly. Use the user guide for the supported surface, and treat advanced or experimental notes as capability previews rather than blanket guarantees.


from rfx import Simulation, Box, GaussianPulse
# 2.4 GHz patch antenna on FR4
sim = Simulation(freq_max=4e9, domain=(0.08, 0.06, 0.025), boundary="cpml")
sim.add(Box((0.0, 0.0, 0.0), (0.08, 0.06, 0.0016)), material="fr4")
sim.add(Box((0.02, 0.01, 0.0016), (0.049, 0.049, 0.0016)), material="pec") # patch
sim.add(Box((0.0, 0.0, 0.0), (0.08, 0.06, 0.0)), material="pec") # ground
sim.add_source((0.029, 0.03, 0.0008), "ez",
waveform=GaussianPulse(f0=2.4e9, bandwidth=0.8))
sim.add_probe((0.029, 0.03, 0.0008), "ez")
result = sim.run(n_steps=8000)
modes = result.find_resonances(freq_range=(1.5e9, 3.5e9))
print(f"Resonance: {modes[0].freq/1e9:.4f} GHz Q={modes[0].Q:.0f}")

Simulation ──► add_material / add / add_port / add_probe / add_ntff_box
└──► run() ──► Result
├── time_series (n_steps × n_probes)
├── s_params (n_ports × n_ports × n_freqs)
├── ntff_data (raw far-field accumulation)
└── find_resonances() → [HarminvMode]

  • Migration Guide — Meep/OpenEMS workflow mapping
  • Contributing — maintainer workflow and test expectations
  • Changelog — release-level capability summary plus current-main notes

The public site focuses on guides. For runnable research-style workflows, see examples/50_advanced/ for patch optimization, waveguide inverse design, broadband matching, array coupling, dielectric-lens shaping, material characterization, and GPU validation scripts.