NanoComp / meep

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

Increase initial number of grid points used in phi quadrature for near-to-far field transformation in cylindrical coordinates #2766

Closed oskooi closed 8 months ago

oskooi commented 8 months ago

Closes #2764.

Rather than make the number of grid points in the $\phi$ quadrature a user parameter in get_farfields, it is simpler just to increase the hard-coded value for N0 set internally in greencyl. The impact of integrating over a larger number of grid points should be insignificant when compared to the accuracy improvements enabled by this modification as this integral converges exponentially fast.

stevengj commented 8 months ago

128 might be a little on the large side for e.g. m=0?

Probably it should increase proportional to m.

Would e.g. 16 + int(4*abs(m)) be sufficient here?

oskooi commented 8 months ago

Would e.g. 16 + int(4*abs(m)) be sufficient here?

Verified that this produces nearly the same results in #2726 (comment) as N0 = 128.