View on GitHub

EMpy

ElectroMagnetic Python — Computational Electromagnetics & Photonics Suite

Methodology, Verification & Literature References

On this page: Electrodynamic Conventions · Implemented Algorithms · Verification Strategy · Literature References


Electrodynamic & Numerical Conventions

All solvers and helper utilities in EMpy 3.0 enforce a unified set of electrodynamic conventions:

  1. Harmonic Phase & Passive Loss (\(\exp(+i\omega t - i\mathbf{k}\cdot\mathbf{r})\)):
    • Plane-wave and modal propagation along \(+z\) vary as \(\exp(+i\omega t - i k_z z)\) and \(\exp(+i\omega t - i\beta z)\).
    • Passive absorbing materials have complex refractive index \(n = n_r - i\kappa\) (\(\kappa \ge 0\), \(\operatorname{Im}(n) \le 0\)), so forward-propagating and evanescently decaying waves satisfy \(\operatorname{Re}(k_z) \ge 0\) and \(\operatorname{Im}(k_z) \le 0\).
    • EMpy.utils.rix2losses, loss_cm2rix, loss_m2rix, and loss_dBcm2rix convert consistently between \(n = n_r - i\kappa\) and Beer–Lambert power attenuation \(P(z) = P(0)\exp(-\alpha z)\).
  2. Passive Helmholtz Square-Root Branch Selection:
    • Across snell, transfer_matrix, RCWA, FD (VFDModeSolver, SVFDModeSolver), and scattering, normal wavevector roots \(k_z = \pm\sqrt{k_z^2}\) use the passive branch cut along the positive imaginary axis (\(\operatorname{Re}(k_z) - \operatorname{Im}(k_z) \ge 0\)), remaining continuous across propagating, total-internal-reflection (TIR), lossy-superstrate (\(\operatorname{Im}(k_x) < 0\)), and plasmonic (\(\operatorname{Re}(n) = 0, \operatorname{Im}(n) < 0\)) regimes.
  3. Complex-Symmetric vs. Hermitian Linear Algebra:
    • Reciprocal lossy dielectric tensors (\(\boldsymbol{\varepsilon} = \boldsymbol{\varepsilon}^T\)) and symmetric lossy grating Toeplitz matrices are complex symmetric (\(M = M^T\)), not Hermitian (\(M \ne M^H\)). EMpy uses general complex solvers (numpy.linalg.solve, scipy.linalg.eig) and applies complex conjugation strictly where required by the time-averaged Poynting vector \(\mathbf{S} = \tfrac{1}{2}\operatorname{Re}(\mathbf{E} \times \mathbf{H}^*)\).
  4. Bounded Passive Cascading:
    • Thick evanescent layers, high diffraction orders, and sub-cutoff waveguides are cascaded strictly in bounded passive variables (\(\lvert \exp(-i k_z d) \rvert \le 1\), \(\lvert \exp(-i\beta L) \rvert \le 1\)) via Enhanced Transmittance Matrix (ETM) recursion (RCWA) and Redheffer star-product S-matrices (GenericDevice), preventing exponential overflow.

Implemented Algorithms

1. Transfer Matrix Method (EMpy.transfer_matrix)

2. Rigorous Coupled-Wave Analysis (EMpy.RCWA)

3. Waveguide Mode Solvers & S-Matrix Circuits (EMpy.modesolvers)

4. Photonic Devices, Liquid Crystals, Materials & Scattering


Testing & Verification Strategy

EMpy’s test suite (tests/, 104 tests) continuously verifies physical invariants and analytical limits across Python 3.10–3.14 and lowest-direct dependency bounds:

  1. Conservation Laws, Passivity & Reciprocity:
    • Lossless structures (\(\kappa = 0\)): Energy conservation and unitarity (\(R + T = 1\), \(\sum (\mathrm{DE}_1 + \mathrm{DE}_3) = 1\), \(S^H S = I\), \(\lvert \mathrm{THRU} \rvert^2 + \lvert \mathrm{DROP} \rvert^2 = 1\)).
    • Passive lossy structures (\(\kappa > 0\)): Strict passivity (\(R + T \le 1\), \(\lVert S \rVert_2 \le 1\), \(\lvert \exp(-i\beta L) \rvert < 1\)) and Lorentz reciprocity (\(S = S^T\) whenever \(\boldsymbol{\varepsilon} = \boldsymbol{\varepsilon}^T\)).
  2. Degenerate-Limit Continuity:
    • Anisotropic → Isotropic (\(\Delta n \to 0\)): Every anisotropic solver (AnisotropicMaterial, LiquidCrystalCell, AnisotropicTransferMatrix, AnisotropicRCWA, 5-component VFDModeSolver) is verified against its isotropic counterpart both via explicit isotropic tensors (\(\boldsymbol{\varepsilon} = \varepsilon_0 n^2 I_3\)) and along weak-birefringence sequences (\(\Delta n \in \{10^{-4}, 10^{-8}, 0\}\)) with 3D Euler rotations, conical diffraction, and optic-axis degeneracies.
    • Lossy → Lossless (\(\kappa \to 0^+\)): Lossy code paths are verified at complex zero-loss dtype (n = n_r + 0.0j) and along continuous \(\kappa \to 0^+\) sequences across propagating, TIR, PML, and sub-cutoff regimes.
  3. Analytical & Cross-Solver Benchmarks:
    • Cross-checked against Fresnel/Brewster/Airy equations, Kretschmann SPR dips, Jones calculus, Gooch–Tarry twisted-nematic transmission, de Vries cholesteric Bragg bands, Rytov effective-medium theory, 1D guided/leaky slab dispersion relations, 2D Gauss–Legendre quadrature, Fraunhofer Airy diffraction, and pointwise Maxwell curl/divergence residuals.

Literature References