NanoComp / meep

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

Cylindrical LDOS EE tutorial does not converge with resolution #2469

Open smartalecH opened 1 year ago

smartalecH commented 1 year ago

I tried running the LDOS EE tutorial in cylindrical coordinates at various resolutions, but the EE does not seem to converge with resolution (or at least is converging rather slowly...):

resolution EE
25 26.09%
50 31.78%
100 46.88%
200 43.30%

200 pixels/wavelength seems like overkill for an all-dielectric structure...

I ran all simulations for the same amount of meep time units (until=400, which is much longer than when the fields consistently seemed to decay below a 1e-8 threshold) and made the domain smaller to speed up the experiment (L=1.0). Everything else is the same as the tutorial.

I haven't tried running the same experiment in 3D cartesian, but I imagine that since the tutorial's example demonstrated consistent results, the cartesian experiment will probably also align (although I'll double check).

In other words, I don't think it's something unique to cylindrical coordinates (e.g. the incorrect grid weights). Rather, it's probably something wrong with the setup itself, like the LDOS hack. I'm going to try a few more experiments to nail this down further.

(Edit: I also changed the refractive index to n = 3.4 to see how sensitive things were to index contrast etc.)

oskooi commented 1 year ago

A couple of suggestions:

  1. It would be good to plot the relative error vs. resolution on a log-log plot with the reference result from a 3d calculation.

  2. Since the results become more accurate the further the point source is from $r = 0$ as demonstrated in #2108 (comment), it would be useful to perform the convergence analysis for point-source locations at large $r$. Note that this will require increasing L (the cell size in the $R$ direction) to ensure the point-source is not affected by the PML. Unfortunately, a large $r$ will also require additional m-simulations for the Fourier-series expansion to converge.

smartalecH commented 1 year ago

It would be good to plot the relative error vs. resolution on a log-log plot with the reference result from a 3d calculation.

I don't think this is a cylindrical vs cartesian thing... I think it's a problem with the EE setup itself (in both domains). Consequently, I don't think that looking at the error by assuming 3d cartesian is the "ground truth" is the right thing to do here.

To show this, even the 3D calculations are swinging wildly with resolution:

resolution Cylindrical EE 3D EE
25 26.09% 37.31%
50 31.78% 34.60%
100 46.88% 45.37%
200 43.30% 45.06%
oskooi commented 1 year ago

The extraction-efficiency values from the cylindrical and 3d simulations seem to be converging to the same result.

The large changes in the extraction efficiency with resolution is perhaps expected given the strong interference effects intrinsic to this LED setup. Note that the dielectric layer thickness is subwavelength and the dipole is positioned within a subwavelength distance of the ground plane:

https://github.com/NanoComp/meep/blob/b415cbf7651203b1118f86640359b1eed827d719/python/examples/point_dipole_cyl.py#L115-L116

As a check, we can try increasing layer_thickness to e.g. 5.0 * wvl / n.

smartalecH commented 1 year ago

The extraction-efficiency values from the cylindrical and 3d simulations seem to be converging to the same result.

Yes I agree they are converging together... this should be expected as the error with the weights vanishes with resolution (even if it's a first-order error). But the fact that they are swinging even with extraordinarily high resolutions is a bit puzzling (again, this is all dielectric).

As a check, we can try increasing layer_thickness to e.g. 5.0 * wvl / n

Here's what I get at a dipole height dmat = 0.1 (same as before) and layer_thickness = 5.0 * wvl / n:

resolution EE
25 1.77%
50 2.64%
100 2.88%
200 1.80%

Still a fair bit of swing (almost 40% from smallest to largest... and there's no second-order trend with resolution).

within a subwavelength distance of the ground plane

This is effectively just a symmetry condition though. I'm sure this induces some coherent inteference effects, but the swings still seem to be a bit large for my intuition (which could be completely off...).