rfx-fdtd 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rfx_fdtd-1.0.0/.github/workflows/test.yml +48 -0
- rfx_fdtd-1.0.0/.gitignore +20 -0
- rfx_fdtd-1.0.0/ATTRIBUTION.md +46 -0
- rfx_fdtd-1.0.0/LICENSE +21 -0
- rfx_fdtd-1.0.0/PKG-INFO +266 -0
- rfx_fdtd-1.0.0/README.md +230 -0
- rfx_fdtd-1.0.0/docs/guide/advanced.md +174 -0
- rfx_fdtd-1.0.0/docs/guide/changelog.md +113 -0
- rfx_fdtd-1.0.0/docs/guide/contributing.md +188 -0
- rfx_fdtd-1.0.0/docs/guide/farfield_rcs.md +83 -0
- rfx_fdtd-1.0.0/docs/guide/geometry_and_limitations.md +517 -0
- rfx_fdtd-1.0.0/docs/guide/gradient_behavior.md +150 -0
- rfx_fdtd-1.0.0/docs/guide/index.md +43 -0
- rfx_fdtd-1.0.0/docs/guide/installation.md +53 -0
- rfx_fdtd-1.0.0/docs/guide/inverse_design.md +94 -0
- rfx_fdtd-1.0.0/docs/guide/migration.md +179 -0
- rfx_fdtd-1.0.0/docs/guide/quickstart.md +91 -0
- rfx_fdtd-1.0.0/docs/guide/simulation_api.md +197 -0
- rfx_fdtd-1.0.0/docs/guide/visualization_and_analysis.md +344 -0
- rfx_fdtd-1.0.0/docs/guide/waveguide_ports.md +87 -0
- rfx_fdtd-1.0.0/docs/guides/simulation_methodology.md +227 -0
- rfx_fdtd-1.0.0/examples/01_cavity_resonance.png +0 -0
- rfx_fdtd-1.0.0/examples/01_cavity_resonance.py +162 -0
- rfx_fdtd-1.0.0/examples/02_waveguide_sparams.png +0 -0
- rfx_fdtd-1.0.0/examples/02_waveguide_sparams.py +146 -0
- rfx_fdtd-1.0.0/examples/03_inverse_design.png +0 -0
- rfx_fdtd-1.0.0/examples/03_inverse_design.py +162 -0
- rfx_fdtd-1.0.0/examples/04_patch_antenna.png +0 -0
- rfx_fdtd-1.0.0/examples/04_patch_antenna.py +259 -0
- rfx_fdtd-1.0.0/examples/04_patch_antenna_farfield.png +0 -0
- rfx_fdtd-1.0.0/examples/04_patch_antenna_s11.png +0 -0
- rfx_fdtd-1.0.0/examples/04_patch_field_ez.png +0 -0
- rfx_fdtd-1.0.0/examples/04_patch_geometry.png +0 -0
- rfx_fdtd-1.0.0/examples/05_materials_gallery.py +156 -0
- rfx_fdtd-1.0.0/examples/05_patch_subgrid_geometry.png +0 -0
- rfx_fdtd-1.0.0/examples/05_patch_subgrid_s11.png +0 -0
- rfx_fdtd-1.0.0/examples/06_farfield_radiation.py +182 -0
- rfx_fdtd-1.0.0/examples/07_auto_configure.py +194 -0
- rfx_fdtd-1.0.0/examples/08_gpu_benchmark.py +225 -0
- rfx_fdtd-1.0.0/examples/14_microstrip_line.py +154 -0
- rfx_fdtd-1.0.0/examples/15_coupled_filter.py +145 -0
- rfx_fdtd-1.0.0/examples/16_dielectric_resonator.py +113 -0
- rfx_fdtd-1.0.0/examples/17_waveguide_coupler.py +109 -0
- rfx_fdtd-1.0.0/examples/18_cavity_filter.py +117 -0
- rfx_fdtd-1.0.0/examples/19_lumped_rlc.py +107 -0
- rfx_fdtd-1.0.0/examples/20_via_throughhole.py +121 -0
- rfx_fdtd-1.0.0/examples/21_curved_patch.py +150 -0
- rfx_fdtd-1.0.0/examples/22_subgridded.py +106 -0
- rfx_fdtd-1.0.0/examples/22_waveguide_anim.gif +0 -0
- rfx_fdtd-1.0.0/examples/gpu_benchmark_results.json +80 -0
- rfx_fdtd-1.0.0/pyproject.toml +40 -0
- rfx_fdtd-1.0.0/rfx/__init__.py +71 -0
- rfx_fdtd-1.0.0/rfx/animation.py +222 -0
- rfx_fdtd-1.0.0/rfx/api.py +1718 -0
- rfx_fdtd-1.0.0/rfx/auto_config.py +454 -0
- rfx_fdtd-1.0.0/rfx/batch.py +137 -0
- rfx_fdtd-1.0.0/rfx/boundaries/__init__.py +4 -0
- rfx_fdtd-1.0.0/rfx/boundaries/cpml.py +682 -0
- rfx_fdtd-1.0.0/rfx/boundaries/pec.py +74 -0
- rfx_fdtd-1.0.0/rfx/checkpoint.py +186 -0
- rfx_fdtd-1.0.0/rfx/core/__init__.py +3 -0
- rfx_fdtd-1.0.0/rfx/core/dft_utils.py +51 -0
- rfx_fdtd-1.0.0/rfx/core/yee.py +331 -0
- rfx_fdtd-1.0.0/rfx/eigenmode.py +610 -0
- rfx_fdtd-1.0.0/rfx/farfield.py +445 -0
- rfx_fdtd-1.0.0/rfx/geometry/__init__.py +5 -0
- rfx_fdtd-1.0.0/rfx/geometry/conformal.py +212 -0
- rfx_fdtd-1.0.0/rfx/geometry/csg.py +159 -0
- rfx_fdtd-1.0.0/rfx/geometry/curved.py +102 -0
- rfx_fdtd-1.0.0/rfx/geometry/smoothing.py +280 -0
- rfx_fdtd-1.0.0/rfx/geometry/thin_wire.py +113 -0
- rfx_fdtd-1.0.0/rfx/geometry/via.py +115 -0
- rfx_fdtd-1.0.0/rfx/gpu.py +114 -0
- rfx_fdtd-1.0.0/rfx/grid.py +129 -0
- rfx_fdtd-1.0.0/rfx/harminv.py +221 -0
- rfx_fdtd-1.0.0/rfx/io.py +163 -0
- rfx_fdtd-1.0.0/rfx/lumped.py +410 -0
- rfx_fdtd-1.0.0/rfx/materials/__init__.py +40 -0
- rfx_fdtd-1.0.0/rfx/materials/debye.py +216 -0
- rfx_fdtd-1.0.0/rfx/materials/lorentz.py +236 -0
- rfx_fdtd-1.0.0/rfx/materials/nonlinear.py +82 -0
- rfx_fdtd-1.0.0/rfx/materials/thin_conductor.py +74 -0
- rfx_fdtd-1.0.0/rfx/nonuniform.py +370 -0
- rfx_fdtd-1.0.0/rfx/optimize.py +196 -0
- rfx_fdtd-1.0.0/rfx/optimize_objectives.py +292 -0
- rfx_fdtd-1.0.0/rfx/probes/__init__.py +7 -0
- rfx_fdtd-1.0.0/rfx/probes/probes.py +871 -0
- rfx_fdtd-1.0.0/rfx/rcs.py +276 -0
- rfx_fdtd-1.0.0/rfx/runners/__init__.py +7 -0
- rfx_fdtd-1.0.0/rfx/runners/nonuniform.py +250 -0
- rfx_fdtd-1.0.0/rfx/runners/subgridded.py +236 -0
- rfx_fdtd-1.0.0/rfx/runners/uniform.py +436 -0
- rfx_fdtd-1.0.0/rfx/simulation.py +1220 -0
- rfx_fdtd-1.0.0/rfx/sources/__init__.py +16 -0
- rfx_fdtd-1.0.0/rfx/sources/sources.py +347 -0
- rfx_fdtd-1.0.0/rfx/sources/tfsf.py +406 -0
- rfx_fdtd-1.0.0/rfx/sources/tfsf_2d.py +415 -0
- rfx_fdtd-1.0.0/rfx/sources/waveguide_port.py +1095 -0
- rfx_fdtd-1.0.0/rfx/subgridding/__init__.py +0 -0
- rfx_fdtd-1.0.0/rfx/subgridding/jit_runner.py +219 -0
- rfx_fdtd-1.0.0/rfx/subgridding/runner.py +176 -0
- rfx_fdtd-1.0.0/rfx/subgridding/sbp_sat_1d.py +336 -0
- rfx_fdtd-1.0.0/rfx/subgridding/sbp_sat_2d.py +296 -0
- rfx_fdtd-1.0.0/rfx/subgridding/sbp_sat_3d.py +325 -0
- rfx_fdtd-1.0.0/rfx/visualize.py +267 -0
- rfx_fdtd-1.0.0/rfx/visualize3d.py +648 -0
- rfx_fdtd-1.0.0/rfx_fdtd.egg-info/PKG-INFO +266 -0
- rfx_fdtd-1.0.0/rfx_fdtd.egg-info/SOURCES.txt +177 -0
- rfx_fdtd-1.0.0/rfx_fdtd.egg-info/dependency_links.txt +1 -0
- rfx_fdtd-1.0.0/rfx_fdtd.egg-info/requires.txt +21 -0
- rfx_fdtd-1.0.0/rfx_fdtd.egg-info/top_level.txt +1 -0
- rfx_fdtd-1.0.0/setup.cfg +4 -0
- rfx_fdtd-1.0.0/tests/__init__.py +0 -0
- rfx_fdtd-1.0.0/tests/test_animation.py +243 -0
- rfx_fdtd-1.0.0/tests/test_api.py +1070 -0
- rfx_fdtd-1.0.0/tests/test_auto_config.py +49 -0
- rfx_fdtd-1.0.0/tests/test_auto_guard.py +89 -0
- rfx_fdtd-1.0.0/tests/test_batch.py +84 -0
- rfx_fdtd-1.0.0/tests/test_cavity.py +191 -0
- rfx_fdtd-1.0.0/tests/test_cfs_cpml.py +246 -0
- rfx_fdtd-1.0.0/tests/test_conformal.py +99 -0
- rfx_fdtd-1.0.0/tests/test_conservation_laws.py +354 -0
- rfx_fdtd-1.0.0/tests/test_cpml.py +143 -0
- rfx_fdtd-1.0.0/tests/test_crossval_comprehensive.py +507 -0
- rfx_fdtd-1.0.0/tests/test_curved_patch.py +154 -0
- rfx_fdtd-1.0.0/tests/test_custom_waveforms.py +147 -0
- rfx_fdtd-1.0.0/tests/test_debye.py +286 -0
- rfx_fdtd-1.0.0/tests/test_decay_convergence.py +178 -0
- rfx_fdtd-1.0.0/tests/test_decay_rlc.py +30 -0
- rfx_fdtd-1.0.0/tests/test_dft_probes.py +175 -0
- rfx_fdtd-1.0.0/tests/test_differentiable.py +151 -0
- rfx_fdtd-1.0.0/tests/test_eigenmode.py +162 -0
- rfx_fdtd-1.0.0/tests/test_eigenmode_port.py +155 -0
- rfx_fdtd-1.0.0/tests/test_farfield.py +143 -0
- rfx_fdtd-1.0.0/tests/test_fresnel_investigation.py +579 -0
- rfx_fdtd-1.0.0/tests/test_geometry.py +63 -0
- rfx_fdtd-1.0.0/tests/test_gpu.py +32 -0
- rfx_fdtd-1.0.0/tests/test_gradient_coverage.py +117 -0
- rfx_fdtd-1.0.0/tests/test_grid.py +50 -0
- rfx_fdtd-1.0.0/tests/test_io.py +163 -0
- rfx_fdtd-1.0.0/tests/test_lorentz.py +225 -0
- rfx_fdtd-1.0.0/tests/test_lossy.py +149 -0
- rfx_fdtd-1.0.0/tests/test_lumped_rlc.py +322 -0
- rfx_fdtd-1.0.0/tests/test_magnetic.py +285 -0
- rfx_fdtd-1.0.0/tests/test_meep_crossval.py +263 -0
- rfx_fdtd-1.0.0/tests/test_meep_crossval_patch.py +189 -0
- rfx_fdtd-1.0.0/tests/test_nonlinear.py +70 -0
- rfx_fdtd-1.0.0/tests/test_nonuniform_api.py +179 -0
- rfx_fdtd-1.0.0/tests/test_normalization.py +237 -0
- rfx_fdtd-1.0.0/tests/test_objective_library.py +181 -0
- rfx_fdtd-1.0.0/tests/test_openems_crossval.py +169 -0
- rfx_fdtd-1.0.0/tests/test_optimize.py +91 -0
- rfx_fdtd-1.0.0/tests/test_optimize_convergence.py +235 -0
- rfx_fdtd-1.0.0/tests/test_overlap_extraction.py +333 -0
- rfx_fdtd-1.0.0/tests/test_physics.py +610 -0
- rfx_fdtd-1.0.0/tests/test_pml_reflectivity.py +94 -0
- rfx_fdtd-1.0.0/tests/test_rcs.py +312 -0
- rfx_fdtd-1.0.0/tests/test_sbp_sat_1d.py +253 -0
- rfx_fdtd-1.0.0/tests/test_sbp_sat_2d.py +78 -0
- rfx_fdtd-1.0.0/tests/test_sbp_sat_3d.py +79 -0
- rfx_fdtd-1.0.0/tests/test_sbp_sat_alpha.py +80 -0
- rfx_fdtd-1.0.0/tests/test_sbp_sat_jit.py +284 -0
- rfx_fdtd-1.0.0/tests/test_series_rlc_current.py +96 -0
- rfx_fdtd-1.0.0/tests/test_simulation.py +744 -0
- rfx_fdtd-1.0.0/tests/test_sparam.py +115 -0
- rfx_fdtd-1.0.0/tests/test_stage5.py +286 -0
- rfx_fdtd-1.0.0/tests/test_subpixel.py +428 -0
- rfx_fdtd-1.0.0/tests/test_tfsf_oblique.py +166 -0
- rfx_fdtd-1.0.0/tests/test_tfsf_oblique_coverage.py +160 -0
- rfx_fdtd-1.0.0/tests/test_thin_conductor.py +108 -0
- rfx_fdtd-1.0.0/tests/test_thin_wire.py +56 -0
- rfx_fdtd-1.0.0/tests/test_validation_suite.py +31 -0
- rfx_fdtd-1.0.0/tests/test_verification.py +366 -0
- rfx_fdtd-1.0.0/tests/test_via.py +201 -0
- rfx_fdtd-1.0.0/tests/test_visualize.py +87 -0
- rfx_fdtd-1.0.0/tests/test_visualize3d.py +79 -0
- rfx_fdtd-1.0.0/tests/test_waveguide_port.py +403 -0
- rfx_fdtd-1.0.0/tests/test_wire_port.py +145 -0
- rfx_fdtd-1.0.0/tests/test_wire_sparam.py +228 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# NOTE: pyproject.toml has [project.optional-dependencies].dev (pytest, pytest-xdist)
|
|
2
|
+
# but no "test" extra. If you want a dedicated test extra, add to pyproject.toml:
|
|
3
|
+
# test = ["pytest>=7.0", "optax"]
|
|
4
|
+
# Until then, this workflow uses .[dev] to get pytest.
|
|
5
|
+
name: test
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
pull_request:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
lint:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.10"
|
|
21
|
+
- run: pip install ruff
|
|
22
|
+
- run: ruff check rfx/ tests/ --select E,F,W --ignore E501
|
|
23
|
+
|
|
24
|
+
test:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
timeout-minutes: 45
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- name: Check out repository
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
|
|
32
|
+
- name: Set up Python
|
|
33
|
+
uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: "3.10"
|
|
36
|
+
|
|
37
|
+
- name: Install package with dev dependencies
|
|
38
|
+
run: pip install -e ".[dev]"
|
|
39
|
+
|
|
40
|
+
- name: Run tests
|
|
41
|
+
run: >
|
|
42
|
+
pytest -x -q
|
|
43
|
+
--ignore=tests/test_meep_crossval.py
|
|
44
|
+
--ignore=tests/test_meep_crossval_patch.py
|
|
45
|
+
--ignore=tests/test_openems_crossval.py
|
|
46
|
+
--ignore=tests/test_crossval_comprehensive.py
|
|
47
|
+
--ignore=tests/test_subpixel.py
|
|
48
|
+
-k "not slow"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.pyc
|
|
3
|
+
*.egg-info/
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
.omc/
|
|
6
|
+
.omx/
|
|
7
|
+
docs-site/
|
|
8
|
+
CLAUDE.md
|
|
9
|
+
AGENTS.md
|
|
10
|
+
|
|
11
|
+
# Internal development artifacts (not for public repo)
|
|
12
|
+
docs/research_notes/
|
|
13
|
+
docs/codex_specs/
|
|
14
|
+
docs/reports/
|
|
15
|
+
docs/superpowers/
|
|
16
|
+
examples/vessl_*.yaml
|
|
17
|
+
examples/benchmark_jax_vs_numpy.py
|
|
18
|
+
|
|
19
|
+
# Generated plots (examples produce these at runtime)
|
|
20
|
+
examples/*.png
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# rfx Attribution & Licenses
|
|
2
|
+
|
|
3
|
+
## Core FDTD Algorithm
|
|
4
|
+
- **Yee algorithm**: K. S. Yee, "Numerical solution of initial boundary value problems involving Maxwell's equations in isotropic media", IEEE TAP, 1966.
|
|
5
|
+
- **License**: Public domain (fundamental algorithm, no copyright)
|
|
6
|
+
|
|
7
|
+
## PML / CPML
|
|
8
|
+
- **CFS-CPML**: J. A. Roden and S. D. Gedney, "Convolution PML (CPML): An efficient FDTD implementation of the CFS-PML for arbitrary media", Microwave and Optical Technology Letters, 27(5), 2000.
|
|
9
|
+
- **License**: Algorithm is public; implementation is original rfx code (MIT)
|
|
10
|
+
|
|
11
|
+
## SBP-SAT Subgridding
|
|
12
|
+
- **Reference**: B. Cheng, R. E. Diaz, et al., "Toward the Development of a 3-D SBP-SAT FDTD Method: Subgridding Implementation", IEEE Transactions on Antennas and Propagation, 2025 (DOI: 10.1109/TAP.2025.10836194)
|
|
13
|
+
- **License**: Algorithm from published paper; implementation is original rfx code (MIT)
|
|
14
|
+
- **Note**: SBP (Summation-By-Parts) operators and SAT (Simultaneous Approximation Terms) are general numerical methods from the finite difference community. Cheng et al. applied them to FDTD subgridding.
|
|
15
|
+
|
|
16
|
+
## Harminv / Matrix Pencil Method
|
|
17
|
+
- **FDM reference**: V. A. Mandelshtam and H. S. Taylor, "Harmonic inversion of time signals and its applications", J. Chem. Phys. 107, 6756, 1997.
|
|
18
|
+
- **MPM reference**: T. K. Sarkar and O. Pereira, "Using the Matrix Pencil Method to Estimate the Parameters of a Sum of Complex Exponentials", IEEE Antennas and Propagation Magazine, Feb 1995.
|
|
19
|
+
- **License**: Both are published algorithms; implementation is original rfx code (MIT)
|
|
20
|
+
- **Note**: Meep uses Harminv (Steven G. Johnson, MIT License) which implements FDM. rfx implements MPM independently — different algorithm, same purpose.
|
|
21
|
+
|
|
22
|
+
## Subpixel Smoothing
|
|
23
|
+
- **Reference**: A. Farjadpour et al., "Improving accuracy by subpixel smoothing in the finite-difference time domain", Optics Letters, 31(20), 2006.
|
|
24
|
+
- **License**: Algorithm from published paper; implementation is original (MIT)
|
|
25
|
+
|
|
26
|
+
## Near-to-Far-Field Transform
|
|
27
|
+
- **Reference**: A. Taflove and S. C. Hagness, "Computational Electrodynamics: The Finite-Difference Time-Domain Method", 3rd edition, Chapter 8.
|
|
28
|
+
- **License**: Standard FDTD technique; implementation is original (MIT)
|
|
29
|
+
|
|
30
|
+
## Thin Wire Model
|
|
31
|
+
- **Reference**: R. Holland, "Finite-Difference Analysis of EMP Coupling to Thin Struts and Wires", IEEE EMC, 1981.
|
|
32
|
+
- **License**: Published algorithm; implementation is original (MIT)
|
|
33
|
+
|
|
34
|
+
## Software Dependencies
|
|
35
|
+
- **JAX** (Google): Apache 2.0 License
|
|
36
|
+
- **NumPy**: BSD 3-Clause License
|
|
37
|
+
- **SciPy**: BSD 3-Clause License
|
|
38
|
+
- **matplotlib**: PSF License (BSD-compatible)
|
|
39
|
+
- **pyvista** (optional): MIT License
|
|
40
|
+
|
|
41
|
+
## rfx License
|
|
42
|
+
rfx is released under the **MIT License**.
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
- Primary development: Claude Opus 4.6 (Anthropic) + Codex (OpenAI)
|
|
46
|
+
- Supervision: Prof. Byungkwan Kim, REMI Lab, Chungnam National University
|
rfx_fdtd-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Byungkwan Kim, REMI Lab, Chungnam National University
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rfx_fdtd-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: rfx-fdtd
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: JAX-native 3D FDTD electromagnetic simulator for RF engineering
|
|
5
|
+
Author-email: REMI Lab <byungkwan.kim@cnu.ac.kr>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: fdtd,electromagnetics,jax,rf,simulation
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: jax>=0.4.20
|
|
20
|
+
Requires-Dist: jaxlib>=0.4.20
|
|
21
|
+
Requires-Dist: numpy>=1.24
|
|
22
|
+
Requires-Dist: scipy>=1.11
|
|
23
|
+
Requires-Dist: matplotlib>=3.7
|
|
24
|
+
Requires-Dist: h5py>=3.8
|
|
25
|
+
Provides-Extra: optimization
|
|
26
|
+
Requires-Dist: optax>=0.1.7; extra == "optimization"
|
|
27
|
+
Provides-Extra: visualization
|
|
28
|
+
Requires-Dist: matplotlib>=3.7; extra == "visualization"
|
|
29
|
+
Requires-Dist: pillow; extra == "visualization"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff; extra == "dev"
|
|
34
|
+
Provides-Extra: all
|
|
35
|
+
Requires-Dist: rfx[dev,optimization,visualization]; extra == "all"
|
|
36
|
+
|
|
37
|
+
# rfx
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
██████╗ ███████╗██╗ ██╗
|
|
41
|
+
██╔══██╗██╔════╝╚██╗██╔╝
|
|
42
|
+
██████╔╝█████╗ ╚███╔╝
|
|
43
|
+
██╔══██╗██╔══╝ ██╔██╗
|
|
44
|
+
██║ ██║██║ ██╔╝ ██╗
|
|
45
|
+
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Differentiable 3D FDTD electromagnetic simulator for RF and microwave engineering — powered by JAX.**
|
|
49
|
+
|
|
50
|
+
**v1.0.0** -- Production-stable release with 260+ tests and 0.000% cross-validation agreement vs OpenEMS.
|
|
51
|
+
|
|
52
|
+
[](LICENSE)
|
|
53
|
+
[](https://github.com/BK3536/rfx/actions)
|
|
54
|
+
[](https://remilab.ai/rfx/)
|
|
55
|
+
|
|
56
|
+
## v1.0.0 Highlights
|
|
57
|
+
|
|
58
|
+
- **Non-uniform z mesh** via `dz_profile` for thin substrates
|
|
59
|
+
- **SBP-SAT subgridding** research path with JIT support
|
|
60
|
+
- **Lumped RLC elements** (series / parallel)
|
|
61
|
+
- **Via** and **CurvedPatch** geometry helpers
|
|
62
|
+
- **Oblique-incidence TFSF** plane-wave source
|
|
63
|
+
- **Field animation export** via `save_field_animation`
|
|
64
|
+
- **Auto-configuration** from geometry + frequency range
|
|
65
|
+
- **260+ tests** with strong cavity/waveguide benchmarking and active antenna validation work
|
|
66
|
+
|
|
67
|
+
## At a Glance
|
|
68
|
+
|
|
69
|
+
| | |
|
|
70
|
+
|---|---|
|
|
71
|
+
| **GPU-accelerated** | ~3,000 Mcells/s on RTX 4090 via `jax.lax.scan` JIT |
|
|
72
|
+
| **Differentiable** | `jax.grad` through full time-stepping for inverse design |
|
|
73
|
+
| **Benchmarked** | Strong agreement vs Meep/OpenEMS on core cavity and waveguide cases |
|
|
74
|
+
| **Non-uniform mesh** | Graded z-profiles for thin substrates without global refinement |
|
|
75
|
+
| **Auto-configuration** | `auto_configure()` derives dx, domain, CPML, timesteps from geometry |
|
|
76
|
+
| **Lumped RLC** | Series, parallel, and shunt lumped elements in any cell |
|
|
77
|
+
| **Via & curved patch** | First-class geometry primitives for PCB and antenna design |
|
|
78
|
+
| **Animation** | Time-domain field animation export (MP4/GIF) |
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# From source (recommended)
|
|
84
|
+
git clone https://github.com/BK3536/rfx.git
|
|
85
|
+
cd rfx
|
|
86
|
+
pip install -e ".[dev]"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> **GPU:** Complete the [JAX GPU setup](https://jax.readthedocs.io/en/latest/installation.html) for your platform before running large simulations.
|
|
90
|
+
|
|
91
|
+
## Quick Start
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from rfx import Simulation, Box, GaussianPulse
|
|
95
|
+
import numpy as np
|
|
96
|
+
|
|
97
|
+
# PEC cavity with dielectric slab — simulate up to 10 GHz
|
|
98
|
+
sim = Simulation(freq_max=10e9, domain=(0.048, 0.032, 0.032), boundary="pec")
|
|
99
|
+
sim.add_material("slab", eps_r=2.2)
|
|
100
|
+
sim.add(Box((0.016, 0, 0), (0.032, 0.032, 0.032)), material="slab")
|
|
101
|
+
|
|
102
|
+
# Lumped port + probe
|
|
103
|
+
sim.add_port(
|
|
104
|
+
(0.006, 0.016, 0.016),
|
|
105
|
+
"ez",
|
|
106
|
+
impedance=50.0,
|
|
107
|
+
waveform=GaussianPulse(f0=5e9, bandwidth=0.8),
|
|
108
|
+
)
|
|
109
|
+
sim.add_probe((0.042, 0.016, 0.016), "ez")
|
|
110
|
+
|
|
111
|
+
result = sim.run(num_periods=30)
|
|
112
|
+
|
|
113
|
+
# S11
|
|
114
|
+
s11_dB = 20 * np.log10(np.abs(result.s_params[0, 0, :]) + 1e-12)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Patch Antenna with Non-Uniform Mesh
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from rfx import Simulation, Box, GaussianPulse, auto_configure
|
|
121
|
+
import numpy as np
|
|
122
|
+
|
|
123
|
+
# Auto-configure from geometry and frequency range
|
|
124
|
+
geometry = [
|
|
125
|
+
(Box((0, 0, 0), (0.06, 0.06, 0.0016)), "fr4"),
|
|
126
|
+
(Box((0, 0, 0), (0.06, 0.06, 0)), "pec"),
|
|
127
|
+
(Box((0.015, 0.011, 0.0016), (0.0444, 0.049, 0.0016)), "pec"),
|
|
128
|
+
]
|
|
129
|
+
materials = {"fr4": {"eps_r": 4.4, "sigma": 0.025}, "pec": {"eps_r": 1.0, "sigma": 1e10}}
|
|
130
|
+
config = auto_configure(geometry, (1e9, 4e9), materials=materials, accuracy="standard")
|
|
131
|
+
print(config.summary()) # Shows dx, non-uniform dz, CPML, n_steps
|
|
132
|
+
|
|
133
|
+
# Build simulation from auto-config
|
|
134
|
+
sim = Simulation(**config.to_sim_kwargs())
|
|
135
|
+
sim.add_material("fr4", eps_r=4.4, sigma=0.025)
|
|
136
|
+
for shape, mat in geometry:
|
|
137
|
+
sim.add(shape, material=mat)
|
|
138
|
+
sim.add_source((0.025, 0.03, 0.0008), "ez", waveform=GaussianPulse(f0=2.4e9))
|
|
139
|
+
sim.add_probe((0.025, 0.03, 0.0008), "ez")
|
|
140
|
+
|
|
141
|
+
result = sim.run(n_steps=config.n_steps)
|
|
142
|
+
modes = result.find_resonances(freq_range=(1.5e9, 3.5e9))
|
|
143
|
+
for m in modes:
|
|
144
|
+
print(f"f={m.freq/1e9:.4f} GHz, Q={m.Q:.0f}")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Inverse Design
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from rfx import Simulation, Box, GaussianPulse
|
|
151
|
+
from rfx.optimize import DesignRegion, optimize
|
|
152
|
+
from rfx.optimize_objectives import minimize_s11
|
|
153
|
+
|
|
154
|
+
sim = Simulation(freq_max=10e9, domain=(0.048, 0.032, 0.032), boundary="pec")
|
|
155
|
+
sim.add_port((0.006, 0.016, 0.016), "ez", impedance=50.0,
|
|
156
|
+
waveform=GaussianPulse(f0=5e9, bandwidth=0.8))
|
|
157
|
+
|
|
158
|
+
region = DesignRegion(
|
|
159
|
+
corner_lo=(0.016, 0.008, 0.008),
|
|
160
|
+
corner_hi=(0.032, 0.024, 0.024),
|
|
161
|
+
eps_range=(1.0, 4.4),
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
result = optimize(sim, region, minimize_s11, n_iters=40, lr=0.05)
|
|
165
|
+
print(f"Final loss: {result.loss_history[-1]:.4f}")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Key Features
|
|
169
|
+
|
|
170
|
+
### Simulation Engine
|
|
171
|
+
- 3D/2D Yee solver with CFS-CPML absorbing boundaries
|
|
172
|
+
- True PEC mask (component-specific tangential zeroing)
|
|
173
|
+
- Non-uniform z mesh for thin substrates
|
|
174
|
+
- SBP-SAT subgridding research path
|
|
175
|
+
- Periodic boundaries and oblique-incidence TFSF plane-wave source
|
|
176
|
+
- Auto-configuration: `auto_configure()` derives dx, domain, CPML, timesteps, and source recommendation
|
|
177
|
+
- Lumped RLC elements (series and parallel topologies)
|
|
178
|
+
|
|
179
|
+
### Geometry
|
|
180
|
+
- CSG primitives: Box, Sphere, Cylinder
|
|
181
|
+
- CurvedPatch for staircase-approximated curved antenna layouts
|
|
182
|
+
- Via for PCB through-hole / plated interconnect modeling
|
|
183
|
+
|
|
184
|
+
### Sources & Ports
|
|
185
|
+
- GaussianPulse, ModulatedGaussian, CW, custom waveforms
|
|
186
|
+
- Soft sources and polarized sources
|
|
187
|
+
- Lumped ports and multi-cell wire ports (conductor-to-conductor)
|
|
188
|
+
- Waveguide ports with modal decomposition (eigenmode solver)
|
|
189
|
+
- Polarized sources (Jones vector: circular, LHCP, slant45)
|
|
190
|
+
|
|
191
|
+
### Materials
|
|
192
|
+
- Dispersive: Debye, Lorentz/Drude
|
|
193
|
+
- Magnetic (`mu_r` validated)
|
|
194
|
+
- Thin conductors with subcell correction
|
|
195
|
+
- Subpixel smoothing (Farjadpour/Kottke)
|
|
196
|
+
- Built-in library: `pec`, `fr4`, `rogers4003c`, `copper`, `alumina`, `ptfe`, `water_20c`, and others
|
|
197
|
+
|
|
198
|
+
### Analysis
|
|
199
|
+
- S-parameters: lumped, wire (JIT-DFT), waveguide (N-port matrix)
|
|
200
|
+
- Harminv resonance extraction (Matrix Pencil Method)
|
|
201
|
+
- NTFF far-field, radiation patterns, RCS
|
|
202
|
+
- Far-field polarization (axial ratio, tilt, sense)
|
|
203
|
+
- Touchstone I/O, HDF5 checkpoints, VTK export
|
|
204
|
+
- Time-domain field animation (MP4/GIF via `save_field_animation`)
|
|
205
|
+
|
|
206
|
+
### Optimization
|
|
207
|
+
- Design regions with `jax.grad` through full simulation
|
|
208
|
+
- Adam optimizer, gradient checkpointing
|
|
209
|
+
- Objective library: `minimize_s11`, `maximize_s21`, `target_impedance`, `maximize_bandwidth`, `maximize_directivity`
|
|
210
|
+
|
|
211
|
+
## Benchmark Snapshot
|
|
212
|
+
|
|
213
|
+
Core benchmark areas currently documented most strongly:
|
|
214
|
+
|
|
215
|
+
| Geometry | rfx vs Meep | rfx vs OpenEMS | rfx vs Analytical |
|
|
216
|
+
|----------|-------------|----------------|-------------------|
|
|
217
|
+
| PEC cavity TM110 | 0.010% | **0.000%** | 0.013% |
|
|
218
|
+
| FR4 cavity (eps=4.4) | 0.006% | — | 0.013% |
|
|
219
|
+
| Rogers (eps=3.55) | 0.007% | — | 0.026% |
|
|
220
|
+
| PTFE (eps=2.2) | 0.004% | — | 0.004% |
|
|
221
|
+
| Alumina (eps=9.8) | 0.005% | — | 0.038% |
|
|
222
|
+
|
|
223
|
+
Patch/microstrip resonance workflows are also active, but feed/port
|
|
224
|
+
interpretation should be documented more carefully than the cavity/waveguide
|
|
225
|
+
benchmarks.
|
|
226
|
+
|
|
227
|
+
## GPU Performance (RTX 4090)
|
|
228
|
+
|
|
229
|
+
| Grid | Steps | Time | Throughput |
|
|
230
|
+
|------|-------|------|------------|
|
|
231
|
+
| 23^3 | 200 | 0.087s | 28 Mcells/s |
|
|
232
|
+
| 33^3 | 300 | 0.086s | 125 Mcells/s |
|
|
233
|
+
| 43^3 | 400 | 0.103s | 310 Mcells/s |
|
|
234
|
+
| 63^3 | 500 | 0.095s | 1,310 Mcells/s |
|
|
235
|
+
|
|
236
|
+
Gradient (reverse-mode AD): ~0.31s for all grid sizes.
|
|
237
|
+
|
|
238
|
+
## Documentation
|
|
239
|
+
|
|
240
|
+
Full documentation: **[remilab.ai/rfx](https://remilab.ai/rfx/)** and
|
|
241
|
+
repo-local guides under [`docs/guide/`](docs/guide/index.md).
|
|
242
|
+
|
|
243
|
+
- [User Guide](https://remilab.ai/rfx/guide/) — Installation, API, materials, sources, probes
|
|
244
|
+
- [AI Agent Guide](https://remilab.ai/rfx/agent/) — Auto-configuration, prompt templates, design workflows
|
|
245
|
+
|
|
246
|
+
## Citation
|
|
247
|
+
|
|
248
|
+
```bibtex
|
|
249
|
+
@software{kim_rfx_2026,
|
|
250
|
+
author = {Byungkwan Kim},
|
|
251
|
+
title = {rfx: JAX-based differentiable 3D FDTD simulator},
|
|
252
|
+
institution = {REMI Lab, Chungnam National University},
|
|
253
|
+
year = {2026},
|
|
254
|
+
url = {https://github.com/BK3536/rfx}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## License
|
|
259
|
+
|
|
260
|
+
MIT License. See [LICENSE](LICENSE).
|
|
261
|
+
|
|
262
|
+
## Acknowledgments
|
|
263
|
+
|
|
264
|
+
Developed by [Byungkwan Kim](https://remilab.cnu.ac.kr) at the **Radar & ElectroMagnetic Intelligence (REMI) Laboratory**, Chungnam National University.
|
|
265
|
+
|
|
266
|
+
AI-assisted development: Claude (Anthropic), Codex (OpenAI).
|
rfx_fdtd-1.0.0/README.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# rfx
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
██████╗ ███████╗██╗ ██╗
|
|
5
|
+
██╔══██╗██╔════╝╚██╗██╔╝
|
|
6
|
+
██████╔╝█████╗ ╚███╔╝
|
|
7
|
+
██╔══██╗██╔══╝ ██╔██╗
|
|
8
|
+
██║ ██║██║ ██╔╝ ██╗
|
|
9
|
+
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Differentiable 3D FDTD electromagnetic simulator for RF and microwave engineering — powered by JAX.**
|
|
13
|
+
|
|
14
|
+
**v1.0.0** -- Production-stable release with 260+ tests and 0.000% cross-validation agreement vs OpenEMS.
|
|
15
|
+
|
|
16
|
+
[](LICENSE)
|
|
17
|
+
[](https://github.com/BK3536/rfx/actions)
|
|
18
|
+
[](https://remilab.ai/rfx/)
|
|
19
|
+
|
|
20
|
+
## v1.0.0 Highlights
|
|
21
|
+
|
|
22
|
+
- **Non-uniform z mesh** via `dz_profile` for thin substrates
|
|
23
|
+
- **SBP-SAT subgridding** research path with JIT support
|
|
24
|
+
- **Lumped RLC elements** (series / parallel)
|
|
25
|
+
- **Via** and **CurvedPatch** geometry helpers
|
|
26
|
+
- **Oblique-incidence TFSF** plane-wave source
|
|
27
|
+
- **Field animation export** via `save_field_animation`
|
|
28
|
+
- **Auto-configuration** from geometry + frequency range
|
|
29
|
+
- **260+ tests** with strong cavity/waveguide benchmarking and active antenna validation work
|
|
30
|
+
|
|
31
|
+
## At a Glance
|
|
32
|
+
|
|
33
|
+
| | |
|
|
34
|
+
|---|---|
|
|
35
|
+
| **GPU-accelerated** | ~3,000 Mcells/s on RTX 4090 via `jax.lax.scan` JIT |
|
|
36
|
+
| **Differentiable** | `jax.grad` through full time-stepping for inverse design |
|
|
37
|
+
| **Benchmarked** | Strong agreement vs Meep/OpenEMS on core cavity and waveguide cases |
|
|
38
|
+
| **Non-uniform mesh** | Graded z-profiles for thin substrates without global refinement |
|
|
39
|
+
| **Auto-configuration** | `auto_configure()` derives dx, domain, CPML, timesteps from geometry |
|
|
40
|
+
| **Lumped RLC** | Series, parallel, and shunt lumped elements in any cell |
|
|
41
|
+
| **Via & curved patch** | First-class geometry primitives for PCB and antenna design |
|
|
42
|
+
| **Animation** | Time-domain field animation export (MP4/GIF) |
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# From source (recommended)
|
|
48
|
+
git clone https://github.com/BK3536/rfx.git
|
|
49
|
+
cd rfx
|
|
50
|
+
pip install -e ".[dev]"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> **GPU:** Complete the [JAX GPU setup](https://jax.readthedocs.io/en/latest/installation.html) for your platform before running large simulations.
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from rfx import Simulation, Box, GaussianPulse
|
|
59
|
+
import numpy as np
|
|
60
|
+
|
|
61
|
+
# PEC cavity with dielectric slab — simulate up to 10 GHz
|
|
62
|
+
sim = Simulation(freq_max=10e9, domain=(0.048, 0.032, 0.032), boundary="pec")
|
|
63
|
+
sim.add_material("slab", eps_r=2.2)
|
|
64
|
+
sim.add(Box((0.016, 0, 0), (0.032, 0.032, 0.032)), material="slab")
|
|
65
|
+
|
|
66
|
+
# Lumped port + probe
|
|
67
|
+
sim.add_port(
|
|
68
|
+
(0.006, 0.016, 0.016),
|
|
69
|
+
"ez",
|
|
70
|
+
impedance=50.0,
|
|
71
|
+
waveform=GaussianPulse(f0=5e9, bandwidth=0.8),
|
|
72
|
+
)
|
|
73
|
+
sim.add_probe((0.042, 0.016, 0.016), "ez")
|
|
74
|
+
|
|
75
|
+
result = sim.run(num_periods=30)
|
|
76
|
+
|
|
77
|
+
# S11
|
|
78
|
+
s11_dB = 20 * np.log10(np.abs(result.s_params[0, 0, :]) + 1e-12)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Patch Antenna with Non-Uniform Mesh
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from rfx import Simulation, Box, GaussianPulse, auto_configure
|
|
85
|
+
import numpy as np
|
|
86
|
+
|
|
87
|
+
# Auto-configure from geometry and frequency range
|
|
88
|
+
geometry = [
|
|
89
|
+
(Box((0, 0, 0), (0.06, 0.06, 0.0016)), "fr4"),
|
|
90
|
+
(Box((0, 0, 0), (0.06, 0.06, 0)), "pec"),
|
|
91
|
+
(Box((0.015, 0.011, 0.0016), (0.0444, 0.049, 0.0016)), "pec"),
|
|
92
|
+
]
|
|
93
|
+
materials = {"fr4": {"eps_r": 4.4, "sigma": 0.025}, "pec": {"eps_r": 1.0, "sigma": 1e10}}
|
|
94
|
+
config = auto_configure(geometry, (1e9, 4e9), materials=materials, accuracy="standard")
|
|
95
|
+
print(config.summary()) # Shows dx, non-uniform dz, CPML, n_steps
|
|
96
|
+
|
|
97
|
+
# Build simulation from auto-config
|
|
98
|
+
sim = Simulation(**config.to_sim_kwargs())
|
|
99
|
+
sim.add_material("fr4", eps_r=4.4, sigma=0.025)
|
|
100
|
+
for shape, mat in geometry:
|
|
101
|
+
sim.add(shape, material=mat)
|
|
102
|
+
sim.add_source((0.025, 0.03, 0.0008), "ez", waveform=GaussianPulse(f0=2.4e9))
|
|
103
|
+
sim.add_probe((0.025, 0.03, 0.0008), "ez")
|
|
104
|
+
|
|
105
|
+
result = sim.run(n_steps=config.n_steps)
|
|
106
|
+
modes = result.find_resonances(freq_range=(1.5e9, 3.5e9))
|
|
107
|
+
for m in modes:
|
|
108
|
+
print(f"f={m.freq/1e9:.4f} GHz, Q={m.Q:.0f}")
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Inverse Design
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from rfx import Simulation, Box, GaussianPulse
|
|
115
|
+
from rfx.optimize import DesignRegion, optimize
|
|
116
|
+
from rfx.optimize_objectives import minimize_s11
|
|
117
|
+
|
|
118
|
+
sim = Simulation(freq_max=10e9, domain=(0.048, 0.032, 0.032), boundary="pec")
|
|
119
|
+
sim.add_port((0.006, 0.016, 0.016), "ez", impedance=50.0,
|
|
120
|
+
waveform=GaussianPulse(f0=5e9, bandwidth=0.8))
|
|
121
|
+
|
|
122
|
+
region = DesignRegion(
|
|
123
|
+
corner_lo=(0.016, 0.008, 0.008),
|
|
124
|
+
corner_hi=(0.032, 0.024, 0.024),
|
|
125
|
+
eps_range=(1.0, 4.4),
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
result = optimize(sim, region, minimize_s11, n_iters=40, lr=0.05)
|
|
129
|
+
print(f"Final loss: {result.loss_history[-1]:.4f}")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Key Features
|
|
133
|
+
|
|
134
|
+
### Simulation Engine
|
|
135
|
+
- 3D/2D Yee solver with CFS-CPML absorbing boundaries
|
|
136
|
+
- True PEC mask (component-specific tangential zeroing)
|
|
137
|
+
- Non-uniform z mesh for thin substrates
|
|
138
|
+
- SBP-SAT subgridding research path
|
|
139
|
+
- Periodic boundaries and oblique-incidence TFSF plane-wave source
|
|
140
|
+
- Auto-configuration: `auto_configure()` derives dx, domain, CPML, timesteps, and source recommendation
|
|
141
|
+
- Lumped RLC elements (series and parallel topologies)
|
|
142
|
+
|
|
143
|
+
### Geometry
|
|
144
|
+
- CSG primitives: Box, Sphere, Cylinder
|
|
145
|
+
- CurvedPatch for staircase-approximated curved antenna layouts
|
|
146
|
+
- Via for PCB through-hole / plated interconnect modeling
|
|
147
|
+
|
|
148
|
+
### Sources & Ports
|
|
149
|
+
- GaussianPulse, ModulatedGaussian, CW, custom waveforms
|
|
150
|
+
- Soft sources and polarized sources
|
|
151
|
+
- Lumped ports and multi-cell wire ports (conductor-to-conductor)
|
|
152
|
+
- Waveguide ports with modal decomposition (eigenmode solver)
|
|
153
|
+
- Polarized sources (Jones vector: circular, LHCP, slant45)
|
|
154
|
+
|
|
155
|
+
### Materials
|
|
156
|
+
- Dispersive: Debye, Lorentz/Drude
|
|
157
|
+
- Magnetic (`mu_r` validated)
|
|
158
|
+
- Thin conductors with subcell correction
|
|
159
|
+
- Subpixel smoothing (Farjadpour/Kottke)
|
|
160
|
+
- Built-in library: `pec`, `fr4`, `rogers4003c`, `copper`, `alumina`, `ptfe`, `water_20c`, and others
|
|
161
|
+
|
|
162
|
+
### Analysis
|
|
163
|
+
- S-parameters: lumped, wire (JIT-DFT), waveguide (N-port matrix)
|
|
164
|
+
- Harminv resonance extraction (Matrix Pencil Method)
|
|
165
|
+
- NTFF far-field, radiation patterns, RCS
|
|
166
|
+
- Far-field polarization (axial ratio, tilt, sense)
|
|
167
|
+
- Touchstone I/O, HDF5 checkpoints, VTK export
|
|
168
|
+
- Time-domain field animation (MP4/GIF via `save_field_animation`)
|
|
169
|
+
|
|
170
|
+
### Optimization
|
|
171
|
+
- Design regions with `jax.grad` through full simulation
|
|
172
|
+
- Adam optimizer, gradient checkpointing
|
|
173
|
+
- Objective library: `minimize_s11`, `maximize_s21`, `target_impedance`, `maximize_bandwidth`, `maximize_directivity`
|
|
174
|
+
|
|
175
|
+
## Benchmark Snapshot
|
|
176
|
+
|
|
177
|
+
Core benchmark areas currently documented most strongly:
|
|
178
|
+
|
|
179
|
+
| Geometry | rfx vs Meep | rfx vs OpenEMS | rfx vs Analytical |
|
|
180
|
+
|----------|-------------|----------------|-------------------|
|
|
181
|
+
| PEC cavity TM110 | 0.010% | **0.000%** | 0.013% |
|
|
182
|
+
| FR4 cavity (eps=4.4) | 0.006% | — | 0.013% |
|
|
183
|
+
| Rogers (eps=3.55) | 0.007% | — | 0.026% |
|
|
184
|
+
| PTFE (eps=2.2) | 0.004% | — | 0.004% |
|
|
185
|
+
| Alumina (eps=9.8) | 0.005% | — | 0.038% |
|
|
186
|
+
|
|
187
|
+
Patch/microstrip resonance workflows are also active, but feed/port
|
|
188
|
+
interpretation should be documented more carefully than the cavity/waveguide
|
|
189
|
+
benchmarks.
|
|
190
|
+
|
|
191
|
+
## GPU Performance (RTX 4090)
|
|
192
|
+
|
|
193
|
+
| Grid | Steps | Time | Throughput |
|
|
194
|
+
|------|-------|------|------------|
|
|
195
|
+
| 23^3 | 200 | 0.087s | 28 Mcells/s |
|
|
196
|
+
| 33^3 | 300 | 0.086s | 125 Mcells/s |
|
|
197
|
+
| 43^3 | 400 | 0.103s | 310 Mcells/s |
|
|
198
|
+
| 63^3 | 500 | 0.095s | 1,310 Mcells/s |
|
|
199
|
+
|
|
200
|
+
Gradient (reverse-mode AD): ~0.31s for all grid sizes.
|
|
201
|
+
|
|
202
|
+
## Documentation
|
|
203
|
+
|
|
204
|
+
Full documentation: **[remilab.ai/rfx](https://remilab.ai/rfx/)** and
|
|
205
|
+
repo-local guides under [`docs/guide/`](docs/guide/index.md).
|
|
206
|
+
|
|
207
|
+
- [User Guide](https://remilab.ai/rfx/guide/) — Installation, API, materials, sources, probes
|
|
208
|
+
- [AI Agent Guide](https://remilab.ai/rfx/agent/) — Auto-configuration, prompt templates, design workflows
|
|
209
|
+
|
|
210
|
+
## Citation
|
|
211
|
+
|
|
212
|
+
```bibtex
|
|
213
|
+
@software{kim_rfx_2026,
|
|
214
|
+
author = {Byungkwan Kim},
|
|
215
|
+
title = {rfx: JAX-based differentiable 3D FDTD simulator},
|
|
216
|
+
institution = {REMI Lab, Chungnam National University},
|
|
217
|
+
year = {2026},
|
|
218
|
+
url = {https://github.com/BK3536/rfx}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## License
|
|
223
|
+
|
|
224
|
+
MIT License. See [LICENSE](LICENSE).
|
|
225
|
+
|
|
226
|
+
## Acknowledgments
|
|
227
|
+
|
|
228
|
+
Developed by [Byungkwan Kim](https://remilab.cnu.ac.kr) at the **Radar & ElectroMagnetic Intelligence (REMI) Laboratory**, Chungnam National University.
|
|
229
|
+
|
|
230
|
+
AI-assisted development: Claude (Anthropic), Codex (OpenAI).
|