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

Bad interpolation of DFT fields at `r = 0` in cylindrical coordinates #2604

Closed oskooi closed 8 months ago

oskooi commented 11 months ago

As described in #2538 (comment), there seems to be a bug in the interpolation of the DFT fields to the center of the voxel at $r = 0$ in cylindrical coordinates. This bug appears in cases involving $E_\phi$ and $H_r$ at $r = 0$ for $|m| = 1$ simulation (which have special boundary conditions), e.g get_dft_array and Poynting-flux calculations (via add_flux) in the $z$ direction. It also affects the time-domain fields obtained via get_array since this routine also interpolates fields to the center of the voxel.

For flux calculations involving $r = 0$, a workaround is to compute the flux manually in post processing using a near-to-far field transformation (via add_near2far) since this routine does not involve any interpolation. See #2538 (comment) and the modified function ext_eff_cyl in test_ldos.py of #2538 for an example.

cc @mochen4

oskooi commented 8 months ago

Replaced by #2704.