11# micromode
22
3- A minimal FDFD electromagnetic mode solver for rasterized waveguide cross sections with a Rust core made to be a standard plugin for FDTD engines.
3+ A high-performance electromagnetic mode solver.
4+ It uses the FDFD method on a regular Yee-grid and is written in native Rust.
45
56[ ![ License] ( https://img.shields.io/github/license/QuentinWach/micromode )] ( LICENSE )
67[ ![ Tests] ( https://img.shields.io/github/actions/workflow/status/QuentinWach/micromode/tests.yml?branch=main&label=tests )] ( https://github.com/QuentinWach/micromode/actions/workflows/tests.yml )
@@ -10,73 +11,21 @@ A minimal FDFD electromagnetic mode solver for rasterized waveguide cross sectio
1011pip install micromode
1112```
1213
13- ## Supported Platforms
14-
15- The Python package uses the portable Rust sparse backend. It does not require
16- external native sparse-solver libraries at install time.
17-
18- Published wheels are built for:
19-
20- - Linux, CPython 3.10-3.13
21- - macOS Intel and Apple Silicon, CPython 3.10-3.13
22-
23- Source builds should work on platforms with a supported Rust toolchain and
24- Python 3.10-3.13. Windows source builds use the same portable backend, but
25- Windows wheels are not release-tested yet.
26-
27- ## Source Builds
28-
29- For the portable backend, install Rust and build normally:
30-
31- ``` bash
32- pip install .
33- ```
34-
35- or, for local development:
36-
37- ``` bash
38- uv sync --all-extras
39- uv run maturin develop
40- ```
41-
42- ## Performance
43-
44- MicroMode is designed to make high-performance mode solving available without
45- requiring users to install external solver stacks. The production backend is a
46- portable Rust sparse shift-invert eigensolver, so source installs and wheels do
47- not depend on ARPACK, UMFPACK, SuiteSparse, BLAS/LAPACK, or a Fortran compiler.
48- That matters for simulation workflows that need to run in CI, notebooks,
49- container images, FDTD plugins, and cross-platform design tools.
50-
51- The native solver is not a dense fallback. It uses sparse finite-difference
52- operators throughout, applies AMD fill-reducing ordering before sparse LU
53- factorization, stores LU factors in a packed format for repeated triangular
54- solves, and runs an Arnoldi iteration targeted around the requested effective
55- index. The Arnoldi stage uses shift-invert, adaptive Ritz-pair checkpointing,
56- early stopping once requested modes are stable, and selective Ritz vector
57- reconstruction so work is spent on the modes that will actually be returned.
58-
59- On the repository benchmark problem, the pure Rust backend solves larger grids
60- in the same performance class as the previous optional UMFPACK-backed path while
61- remaining much easier to install and distribute. For example, a release build on
62- an Apple Silicon development machine solves an ` 80x50 ` diagonal benchmark grid
63- in roughly ` 90 ms ` for two modes with residuals around ` 1e-12 ` . Exact timings
64- depend on hardware and problem shape, but the important point is architectural:
65- MicroMode keeps the deployability of a pure Rust package without giving up the
66- sparse-solver performance expected for practical waveguide grids.
6714
6815## Why Use It?
6916
70- - Grid-first API: pass arrays directly, with no required geometry model.
71- - Fast, portable Rust sparse backend: one production solve path.
72- - Practical outputs: fields, ` n_eff ` , ` k_eff ` , mode area, polarization fractions,
17+ - ** Grid-first API** : pass arrays directly, with no required geometry model.
18+ - ** Fast** , portable Rust sparse backend: one production solve path.
19+ - ** Practical** outputs: fields, ` n_eff ` , ` k_eff ` , mode area, polarization fractions,
7320 Lorentz overlaps, plotting, dataframe export, and HDF5 save/load.
74- - Tensor-aware: supports scalar, diagonal anisotropic, and full tensor material
21+ - ** Tensor-aware** : supports scalar, diagonal anisotropic, and full tensor material
7522 grids.
76- - Works for both 2D cross sections and 1D slices.
23+ - Works for both ** 2D cross sections and 1D slices** .
7724
7825You give it a material grid. It returns guided modes: effective indices, six-component fields, polarization metrics, mode area, overlaps, diagnostics, plots, and HDF5 output. MicroMode is intentionally not a CAD or geometry package. It is the solver piece you use after geometry has already been rasterized onto a mode-plane grid.
7926
27+ _ Micromode is the ** default mode solver** in the [ BEAMZ FDTD engine] ( https://github.com/beamzorg/beamz ) ._
28+
8029
8130## Quick Start
8231
@@ -106,3 +55,44 @@ print(data.n_eff.values)
10655data.plot_field(" Ex" , mode_index = 0 )
10756data.to_hdf5(" modes.h5" )
10857```
58+
59+
60+ ## High Performance
61+
62+ MicroMode is designed to make high-performance mode solving available without
63+ requiring users to install external solver stacks. The production backend is a
64+ ** portable Rust [ sparse] ( https://en.wikipedia.org/wiki/Sparse_matrix )
65+ [ shift-invert] ( https://en.wikipedia.org/wiki/Preconditioner#Spectral_transformation )
66+ [ eigensolver] ( https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors ) ** , so
67+ source installs and wheels do ** not** depend on
68+ [ ARPACK] ( https://en.wikipedia.org/wiki/ARPACK ) ,
69+ [ UMFPACK] ( https://en.wikipedia.org/wiki/UMFPACK ) ,
70+ [ SuiteSparse] ( https://en.wikipedia.org/wiki/SuiteSparse ) ,
71+ [ BLAS] ( https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms ) /
72+ [ LAPACK] ( https://en.wikipedia.org/wiki/LAPACK ) , or a Fortran compiler.
73+ That matters for simulation workflows that need to run in CI, notebooks,
74+ container images, FDTD plugins, and cross-platform design tools.
75+
76+ The native solver is ** not a dense fallback** . It uses
77+ [ sparse] ( https://en.wikipedia.org/wiki/Sparse_matrix )
78+ [ finite-difference] ( https://en.wikipedia.org/wiki/Finite_difference_method )
79+ operators throughout, applies
80+ [ AMD fill-reducing ordering] ( https://en.wikipedia.org/wiki/Minimum_degree_algorithm )
81+ before sparse [ LU factorization] ( https://en.wikipedia.org/wiki/LU_decomposition ) ,
82+ stores LU factors in a packed format for repeated triangular solves, and runs an
83+ [ Arnoldi iteration] ( https://en.wikipedia.org/wiki/Arnoldi_iteration ) targeted
84+ around the requested effective index. The Arnoldi stage uses
85+ ** shift-invert** , adaptive
86+ [ Ritz-pair] ( https://en.wikipedia.org/wiki/Ritz_method ) checkpointing, early
87+ stopping once requested modes are stable, and selective Ritz vector
88+ reconstruction so work is spent on the modes that will actually be returned.
89+
90+ On the repository benchmark problem, the ** pure Rust backend** solves larger grids
91+ in the same performance class as the previous optional UMFPACK-backed path while
92+ remaining much easier to install and distribute. For example, a release build on
93+ an Apple Silicon development machine solves an ` 80x50 ` diagonal benchmark grid
94+ in roughly ** ` 90 ms ` for two modes** with residuals around ** ` 1e-12 ` ** . Exact
95+ timings depend on hardware and problem shape, but the important point is
96+ architectural: MicroMode keeps the ** deployability of a pure Rust package**
97+ without giving up the sparse-solver performance expected for practical
98+ waveguide grids.
0 commit comments