Repository navigation
First public release of StableRCWA: a header-only C++17 RCWA (rigorous coupled-wave analysis / Fourier modal method) solver for 1-D and 2-D periodic gratings that stays accurate at high truncation orders.
首个公开版本:只有头文件的 C++17 RCWA 求解器,用于一维、二维周期光栅,高截断阶数下依然算得准。
Highlights
- Stable at high orders. Layer eigenproblems use a unitary Hessenberg-QR iteration (EISPACK CORTH/COMQR2 lineage). S-matrix propagation. Exact handling of zero propagation constants (1-D TE/TM) and Schur-basis propagation for degenerate conical layers.
- No dependencies. Include the headers; only the C++ standard library is used.
- Features: 1-D TE/TM, conical incidence with 2×2 Jones matrices per order, 2-D crossed gratings, six-component near fields and phase, absorbing media.
- Three ways to use it: C++ headers, a JSON-in/JSON-out CLI (
rcwa_json,rcwa_fields), and a local web GUI (Python + NumPy/SciPy/Matplotlib). - Independently checked against COMSOL FEM (2-D models for conical incidence, 3-D for crossed gratings), comparing complex amplitudes, plus closed-form and exact-identity tests. See
docs/validation.zh-CN.md.
Tested on
- macOS arm64, Apple clang 17: all 25 CTest entries pass.
- Windows, MinGW g++ 13.1 and MSVC 19.34: the 21 test programs pass.
- Linux: covered by the GitHub Actions workflow only.
Known limitations
- Program output, the GUI and source comments are in Chinese; the README and API are usable without Chinese.
- You must check convergence in
Myourself. 2-D converges more slowly than 1-D. - The incidence medium must be lossless; in conical incidence the exit medium must be lossless too.
- The GUI routes 2-D models to the Python solver by default (
RCWA_2D_BACKEND=cppswitches to C++). - Multi-threaded eigen solves are verified bitwise identical to single-threaded ones only with FMA contraction off (
-ffp-contract=off).
Assets
StableRCWA-0.1.0.zip is the same tree as the tag; its SHA-256 is in StableRCWA-0.1.0.zip.sha256.
License: MIT.