Skip to content

FEM QNM inverse design

fem-qnm-invdes is an executable, three-dimensional finite-element reference implementation for inverse design of high-local-density-of-states optical resonators. It begins with fixed-frequency LDOS optimization, acquires a source-coupled quasinormal mode (QNM), and then follows that pole using the shifted objective from Shaker et al.

Scope

The implementation currently provides:

  • first-order tetrahedral Nedelec H(curl) elements with anisotropic transformation-optics PML;
  • regularized electric-current dipoles, normalized LDOS, density filtering, and smooth projection;
  • assembled and element-local CPU/CUDA driven and adjoint solves;
  • non-Hermitian generalized QNM eigensolves, physical-mode selection, and mode tracking;
  • fixed-frequency acquisition followed by shifted pole-tracking optimization; and
  • checkpoints plus JSON, YAML, NPZ, and ParaView VTU output.

The matrix-free backends use an assembled low-order ILU preconditioner as a reference component. They validate the operator and GPU execution model, but they are not yet a production-scale partial-assembly or multilevel Maxwell solver. Read Implementation status before interpreting an optimization result as a device claim.

Quick start

uv sync --extra test --extra gpu
uv run pytest
uv run fem-qnm solve configs/tiny.yaml --output artifacts/tiny-solve
uv run fem-qnm gradient-check configs/tiny.yaml
uv run fem-qnm qnm configs/tiny.yaml --output artifacts/tiny-qnm
uv run fem-qnm optimize configs/tiny.yaml --output artifacts/tiny-opt

Use configs/workstation.yaml only after the tiny verification case has passed. The validation commands below deliberately return a nonzero status when their tolerances are missed:

uv run fem-qnm validate-pml configs/tiny.yaml --output artifacts/pml
uv run fem-qnm validate-mesh configs/validation.yaml --refinement-factors 1 2 --skip-qnm --output artifacts/mesh
uv run fem-qnm validate-linewidth configs/tiny.yaml --output artifacts/linewidth

Reading the results

The tiny configuration is an integration test, not a reportable device. A scientific result must pass independent mesh, polynomial-order, air-buffer, PML-thickness, PML-strength, and driven-linewidth checks. The solver records driven, adjoint, and QNM residuals with its result artifacts.

For the governing equations, sign conventions, and adjoint/QNM bilinear forms, see Mathematical conventions.