A Rust-based 2D Maxwell solver designed for large-scale band diagram sweeps. Outperforms MIT's MPB in TM polarizations and high-throughput workloads.
Try it in your browser — no installation required (WebAssembly).
# Clone and test
git clone https://github.com/RnLe/blaze2d.git
cd blaze2d
cargo test
# Run a simulation
cargo run --release -- --lattice square --eps-bg 13.0 --radius 0.3 --polarization TM --resolution 24
# Reproduce benchmarks (requires conda/mamba for MPB)
cd benchmarks
make setup-env # one-time: creates mpb-reference environment
make quick # ~2 min validation runBlaze2D offers two interfaces:
| Interface | Best For | Documentation |
|---|---|---|
| CLI flags | Quick single runs, scripting | CLI Reference |
| TOML files | Reproducible simulations, parameter sweeps | TOML Reference |
# Using CLI flags
blaze2d --lattice square --eps-bg 13.0 --radius 0.3 --polarization TM --resolution 24
# Using a TOML file
blaze2d run examples/square_eps13_r0p3_tm_res24.tomlThe solver compiles to WebAssembly, enabling browser-based simulations without installation:
https://rnle.github.io/blaze2d/blaze/
Features:
- Interactive band diagram visualization
- Real-time parameter adjustment
- Export results as CSV/JSON
Comparative benchmarks against MPB under matched conditions (same tolerance, resolution, band count).
→ Technical Report with Full Results
pip install blaze2dgit clone https://github.com/RnLe/blaze2d.git
cd blaze2d
cargo build --releaseThe binary will be at target/release/blaze2d.
- Rust 1.91+ (for building from source)
- Python 3.9+ (for Python bindings)
Blaze2D is currently CPU-bound with a straightforward LOBPCG implementation. Significant performance gains are achievable through:
| Optimization | Expected Impact |
|---|---|
| Optimized preconditioners | up to 2–3× fewer iterations |
| Dynamic subspace deflation | Reduced dense matrix ops; faster convergence |
| Advanced BLAS/LAPACK integration | Faster dense operations; speedup potential 1–3x |
| GPU acceleration (CUDA/Metal) | 10–100× for large grids; linear scaling (!) |
GPU support is expected to provide substantial speedups even at modest resolutions (64×64), where memory transfer overhead is amortized across many eigenvalue iterations.
Licensed under the MIT License. See LICENSE for details.
If you use Blaze2D in academic work, please cite this repository.