-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bad interpolation from Meep grid to MPB during eigenmode calculation #1237
Comments
You need |
Even with
|
I don't think it likes the source extending all the way to the edge. Try |
No, same error again unfortunately. |
If I remove the |
It seems to be a bad interaction with subpixel averaging. Subpixel averaging gives an anisotropic ε on the Yee grid, but we have to interpolate these ε tensor components to get the corresponding MPB values, and that interpolation seems to be destroying positive-definiteness. |
Note that in the case where this does not abort, then there is no need to worry — at worst, some isolated pixels will be messed up, but it will still converge with resolution. |
To quantify the mode mismatch between MPB and Meep, you could compute the backward-propagating flux from an eigenmode source (at the center frequency), which should go to zero with resolution. |
As shown in the results below for the mode at the pulse center frequency of 0.15 in a single mode waveguide, the backward-propagating flux does not seem to be converging to zero with increasing resolution. Rather, it seems to be converging to a constant value. (The results are converged with PML thickness and runtime as well as Is there some other kind of discretization effect involved when calling MPB from Meep that we are overlooking? |
You might need to increase the runtime and the cutoffs for the gaussians to avoid spectral leakage, since you are trying to resolve pretty small backward fluxes here. The difference between Meep and MPB should converge with resolution here, although you'll eventually hit a noise floor due to the eigensolver tolerance, the eigensolver source size, spectral leakage, PML reflections, floating-point roundoff, and other errors. (It's not clear that you've hit a noise floor here since it's still going down, albeit slowly.) |
This code from #919 looks suspicious to me (cc @smartalecH). It takes all of the tensor components from the same Try changing this line to |
There does not seem to be any change in the results to either the |
I agree this is a problem... I totally forgot about this issue at the time. It seems odd to me that we are sampling an already sampled yee grid to generate the MPB grid. This not only makes it incredibly difficult to handle the staggering, but it means that "upsampling" the MPB resolution (e.g. in Why not sample directly from the geometry tree like we do in meep-geom? This would dramatically simplify the code (no more ugly interpolation across grid points by looping through chunks) and it lets us more accurately upsample the mpb grid if desired. It would be easy to parallelize the grid initialization, as we discussed before. Doing things this way may even solve the weird issue with sub-pixel averaging. |
I suppose we could have optional support for |
The following example tries to launch an eigenmode source in a holey waveguide in a 2d simulation but aborts with an error due to MPB. The same error occurs when trying to use mode decomposition for a 2d eigenmode. Neither
EigenModeSource
orget_eigenmode_coefficients
has previously been tested for this type of use case. All the examples in Tutorial/Mode Decomposition and Tutorial/Eigenmode Source are in 1d.The schematic below (obtained using
plot2D
) shows the 2d source (red hatches) and mode monitor (blue hatches).additional info: removing the
symmetries
from theSimulation
constructor does not solve the problem. However, changing thesize
of the source/monitor from a 2d rectangle to a line in y (i.e.size=mp.Vector3(0,sy)
) works fine.output
The text was updated successfully, but these errors were encountered: