-
Notifications
You must be signed in to change notification settings - Fork 605
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
symmetry support for mode expansion #294
Comments
* mpb match-freq should only search k in direction d * adjust for bloch-periodic boundaries in get_eigenmode, so that it works for both sources and mode decomposition * allow get_eigenmode to return NULL if mode was not found, clean up a memory leak in mode coefficients * whoops * add parity argument to get_eigenmode_coefficients (fises #294) * add missing get_eigenmode_coefficients parameters, fix defaults
Probably the call to |
First things to try (after above fix).
Once we figure out what is working, we can figure out how to expose this to the user. We want to both have the option to handle arbitrary symmetries (i.e. to drop the S.reduce call if needed) and also still retain the factor-of-2 speedup for flux computation (and for mode computation if mirror symmetries are passed to MPB). |
Partially solved by #417 (still lacking a Python API). Would be good to address point 3, above — verify that we can use the symmetry-reduced Fourier transforms as long as the MPB modes of only the corresponding symmetry are computed, at least for mirror planes. It would be good to have this option in performance-critical situations. |
Symmetry objects seem to be working now. The following test, based on the 2d waveguide example described above, produces the same output with and without the mirror symmetry plane. Script import meep as mp
sx = 10
sy = 5
cell_size = mp.Vector3(sx,sy,0)
geometry = [mp.Block(size=mp.Vector3(mp.inf,1,mp.inf), center=mp.Vector3(), material=mp.Medium(index=3.5))]
dpml = 1
pml_layers = [mp.PML(thickness=dpml)]
fcen = 1
sources = [mp.EigenModeSource(src=mp.GaussianSource(fcen, fwidth=0.2*fcen),
component=mp.Ez,
size=mp.Vector3(0,sy-2*dpml,0),
center=mp.Vector3(-0.5*sx+dpml+0.2),
eig_match_freq=True,
eig_parity=mp.ODD_Z+mp.EVEN_Y)]
symmetries = [mp.Mirror(mp.Y,phase=1)]
sim = mp.Simulation(resolution=30,
cell_size=cell_size,
boundary_layers=pml_layers,
geometry=geometry,
symmetries=symmetries,
sources=sources)
xm = 0.5*sx-dpml-0.2
eig_mon = sim.add_mode_monitor(fcen, 0, 1, mp.FluxRegion(center=mp.Vector3(xm,0,0), size=mp.Vector3(0,sy-2*dpml,0)))
sim.run(until_after_sources=mp.stop_when_fields_decayed(50, mp.Ez, mp.Vector3(xm), 1e-9))
coeffs, vgrps, kpoints = sim.get_eigenmode_coefficients(eig_mon, [1], eig_parity=mp.ODD_Z+mp.EVEN_Y)
print("tran:, {:.8f}".format(abs(coeffs[0,0,0])**2)) Output (with symmetry)
Output (without symmetry)
|
Great, would be good to at least document this as an optimization that people can do when it matters. |
Should work with 5666d2f |
* mpb match-freq should only search k in direction d * adjust for bloch-periodic boundaries in get_eigenmode, so that it works for both sources and mode decomposition * allow get_eigenmode to return NULL if mode was not found, clean up a memory leak in mode coefficients * whoops * add parity argument to get_eigenmode_coefficients (fises NanoComp#294) * add missing get_eigenmode_coefficients parameters, fix defaults
Currently, the mode-expansion calculation doesn't work if there are symmetries bisecting the flux plane. (#293 fixes one problem with symmetry, but there seem to be others.)
Until it is working, as a short-term fix we could exit with an error if you attempt mode expansion in a simulation with symmetries.
Once mode-expansion supports parities (add parity argument to eigenmode coefficients #292), we might want to require (or at least document) that the parity should be consistent with any symmetry bisecting the flux plane.
The text was updated successfully, but these errors were encountered: