NanoComp / meep

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

Incorrect normalization of `Er` source at `r = 0` and `m = ±1` in cylindrical coordinates #2704

Open oskooi opened 8 months ago

oskooi commented 8 months ago

In cylindrical coordinates, $E_r$ is defined at the midpoint of the Yee-grid voxels ($r = 0.5\Delta r$). An $E_r$ point source at $r = 0$ and $m = \pm 1$ requires restriction to $E_r$ grid points at $r = \pm 0.5\Delta r$. There is a bug in the restriction operation for this case which prevents computing quantities such as the extraction efficiency involving the ratio of the Poynting flux (add_flux) to the LDoS (dft_ldos).

Based on the results in #2538 (comment), a simple workaround is to place the $E_r$ point source at $r = 1.5\Delta r$. This ensures restriction does not involve $E_r$ grid points within the $r = 0$ voxels. A source placed anywhere at $r < 1.5\Delta r$ triggers the bug, however. This slight adjustment of the source position incurs a small error which decreases with increasing grid resolution (smaller $\Delta r$).