GPU-accelerated 3D FDTD electromagnetic solver. This is a toy project built to experiment with Rust + wgpu compute shaders, Python bindings via PyO3, and a Vue.js visualization frontend.
- 3D finite-difference time-domain (FDTD) simulation on the GPU via wgpu
- f16 vectorized field storage (vec4) for reduced memory bandwidth
- Fused source injection in the E-update kernel (2 passes per step instead of 3)
- Gaussian, modulated Gaussian, sinusoidal, and Ricker wavelet sources
- Dielectric/lossy material support with per-cell coefficients
- Geometry primitives (boxes, spheres, cylinders)
- Snapshot-based seeking and replay
- Real-time 3D visualization with volume rendering and 2D slices
lib/ Rust core — wgpu compute shaders, FDTD kernels, simulation facade
src/fdtd/ GPU kernels (WGSL) and simulator
src/gpu/ Device context, buffers, pipelines
src/simulation/ Config, world, facade API
src/python.rs PyO3 bindings
api/ Python FastAPI backend — wraps the Rust lib as a REST API
src/routes/ /simulation/configure, /run, /seek, /fields, etc.
src/services/ Singleton simulation manager
frontend/ Vue 3 + Three.js frontend — 3D visualization and controls
Prerequisites: Rust (2024 edition), Python 3.10+, Node.js
# Start the dev environment (builds lib, starts API + frontend)
./run.sh
# Run all tests
./test.shThe frontend is served at http://localhost:5173, the API at http://localhost:8000 (Swagger UI at http://localhost:8000/docs).