google / ceviche-challenges

A suite of photonic inverse design challenge problems for topology optimization benchmarking
https://doi.org/10.1021/acsphotonics.2c00313
Apache License 2.0
94 stars 13 forks source link

fix: correction on mode eigenvalue equation #1

Closed lucasgrjn closed 2 years ago

lucasgrjn commented 2 years ago

This PR corrects a minor mistake on the electric-field mode solver equation and introduces a correction factor for the magnetic field calculated. (All the explanations will be documented below to avoid any misunderstanding and to prevent any error from my side).

Justification :

(I already sign the CLA.)

ianwilliamson commented 2 years ago

The complete Maxwell equation without a source can be written as ∇×μ−1∇×E−ω2ϵE=0. By using the free space magnetic permeability, it leads us to ∇×∇×E−ω2μ0ϵ0ϵrE and thus ∇×∇×E−k2ϵrE. The first curl (on left) will be associated to the magnetic field : using the Maxwell–Faraday equation, we replace the value of the magnetic field on the Ampère's circuital law. Using the fact that on the Yee-grid, magnetic field is associated to backward differencies whereas electric field is associated to forward differencies, we obtain dxb×dxf×E−k2ϵrE if we use the naming convention of the script.

This is not the correct way to derive the order of the derivative operators in the eigenmode operator. Also, the terms dxb and dxf implement derivatives along the x-direction, not curls, meaning that

dxb×dxf×E−k2ϵrE

is not quite right with the "×".

The matrix we use for this calculation matches what we do in Ceviche:

https://github.com/fancompute/ceviche/blob/5da9df12cb2b15cc25ca1a3d4b5eb827eb89e195/ceviche/fdfd.py#L172-L185