NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.17k stars 598 forks source link

Launching planewave sources with negative propagation wavevector using `DiffractedPlanewave` #2641

Open oskooi opened 10 months ago

oskooi commented 10 months ago

Based on the current setup of the DiffractedPlanewave and EigenModeSource objects, it is not possible to launch planewave sources (by passing a DiffractedPlanewave object as the eig_band property of an EigenModeSource) with a negative propagation constant $\beta$ (the wavevector component in the direction perpendicular to the source plane).

$\beta$ is always chosen to be positive on line 660 of fields::get_eigenmode:

https://github.com/NanoComp/meep/blob/b065eae0491a7987983779c16115200acf0085d2/src/mpb.cpp#L649-L661

This missing property of DiffractedPlanewave sources is necessary for the adjoint solver (#2054).

(Note: for mode decomposition, obtaining the mode coefficient for the $-\beta$ mode is simply a matter of choosing the second of two elements of the third dimension of the alpha array returned by get_eigenmode_coefficient.)