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.
Why rfx
Section titled “Why rfx”| Feature | Detail |
|---|---|
| GPU acceleration | 7,309 Mcells/s on RTX 4090, 5,847 on RTX 3090, 5,249 on RTX A6000 |
| Multi-GPU distributed FDTD | jax.pmap slab decomposition for larger 3-D jobs on a single multi-GPU host |
| Autodiff | jax.grad through the full time-stepping loop for topology and shape optimization |
| Topology optimization | Density-based filtering, projection, and beta continuation for inverse design |
| Time-domain optimization objectives | Use proxy losses such as minimize_reflected_energy() and maximize_transmitted_energy() inside differentiable loops |
| Conformal PEC | Dey-Mittra method for 2nd-order accuracy on curved conductors |
| Material fitting | Debye/Lorentz fitting plus differentiable FDTD-based refinement from S-parameters |
| Non-uniform mesh + auto-config | Graded z-profiles and auto_configure() for thin substrates and broadband setups |
| Harminv resonance | High-Q mode extraction with sub-bin frequency precision |
| Multi-mode + Floquet ports | Rectangular TE/TM eigenmodes and phased-array unit-cell workflows with Bloch periodic BC |
| Cross-validated | Published 5-case RF validation plus earlier cavity/waveguide cross-validation vs. Meep and OpenEMS |
| 500+ tests | Pytest suite with lint + CPU/GPU coverage and advanced-example validation scripts |
Quick install
Section titled “Quick install”pip install rfx-fdtdPyPI package name: rfx-fdtd
Python import:
import rfxGPU support (JAX + CUDA):
pip install "jax[cuda12]" rfx-fdtdRecent highlights
Section titled “Recent highlights”- v1.4.0 brings waveguide / Floquet ports into differentiable
forward()andoptimize()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
maincontinues to harden the workflow withsim.preflight()validation, a 23-script cross-validation bundle, and newer geometry coverage such as thePolylineWireprimitive.
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.
Ten-line example
Section titled “Ten-line example”from rfx import Simulation, Box, GaussianPulse
# 2.4 GHz patch antenna on FR4sim = 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") # patchsim.add(Box((0.0, 0.0, 0.0), (0.08, 0.06, 0.0)), material="pec") # groundsim.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}")Key concepts
Section titled “Key concepts”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]Documentation by topic
Section titled “Documentation by topic”Getting Started
Section titled “Getting Started”- Installation — Python/JAX install, GPU notes, dev setup
- Quick Start — first simulation with the current stable high-level API
- Your First Patch Antenna — current-source resonance workflow for a 2.4 GHz FR4 patch
Modeling & Setup
Section titled “Modeling & Setup”- Simulation API —
Simulation,Result,auto_configure, ports, NTFF, and design helpers - Materials & Geometry — library materials, Debye/Lorentz, CSG shapes, PCB stackup
- Sources & Ports — point sources, lumped/wire ports, multi-mode waveguide ports, Floquet ports
- Probes & S-Parameters — DFT probes, S-matrix, Harminv, de-embedding, Smith chart
- Non-Uniform Mesh — graded z-profiles for thin-substrate structures
- Waveguide Ports — multi-mode waveguide S-matrix with TE/TM eigenmodes
- Floquet Ports — phased-array unit-cell analysis with Bloch BC
Analysis & Validation
Section titled “Analysis & Validation”- Cross-Validation & Accuracy — published RF benchmarks plus cross-solver checks
- Convergence Study — mesh refinement analysis and accuracy verification
- Far-Field & RCS — NTFF radiation patterns and scattering workflows
- Antenna Metrics — gain, efficiency, beamwidth, bandwidth, F/B ratio
- Visualization & Analysis — plotting, exports, post-processing
- Solver Comparison — feature and performance comparison vs. Meep and OpenEMS
Design & Optimization
Section titled “Design & Optimization”- Inverse Design — autodiff-driven topology, shape, and far-field optimization
- Topology Optimization — density-based inverse design with filtering and projection
- Parametric Sweeps — sequential sweep and
jax.vmapbatch evaluation - Material Fitting — CSV import, Debye/Lorentz fitting, differentiable FDTD-based fitting
- Patch Antenna Design — full design workflow for a rectangular microstrip patch
- Microstrip Filter Design — coupled-line bandpass filter with two-port S-parameters
Advanced & Research Methods
Section titled “Advanced & Research Methods”- Advanced Features — multi-GPU, mixed precision, proxy objectives, advanced example workflows
- Conformal PEC — Dey-Mittra method for curved conductors
- SBP-SAT Subgridding — local mesh refinement with JIT performance
- Gradient Behavior — where gradients are strong vs noisy
- Geometry & Limitations — primitives, supported workflows, and remaining trade-offs
AI Agent Guide
Section titled “AI Agent Guide”- rfx for AI Agents — why the API is agent-friendly
- Automatic Simulation Configuration — geometry-to-sim parameter workflow
- Prompt Templates for RF Design — reusable agent prompts
- Automated Design Workflows — end-to-end design patterns
Project & maintainer
Section titled “Project & maintainer”- Migration Guide — Meep/OpenEMS workflow mapping
- Contributing — maintainer workflow and test expectations
- Changelog — release-level capability summary plus current-main notes
Repo examples
Section titled “Repo examples”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.