Skip to content
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

bug: get_dft_array with symmetry objects #421

Closed
oskooi opened this issue Jul 17, 2018 · 0 comments
Closed

bug: get_dft_array with symmetry objects #421

oskooi opened this issue Jul 17, 2018 · 0 comments

Comments

@oskooi
Copy link
Collaborator

oskooi commented Jul 17, 2018

There is a bug in the get_dft_array routine when used with symmetry objects. This is demonstrated in the following example of a ring resonator which is adapted from the frequency-domain solver tutorial.

import meep as mp
import numpy as np
import matplotlib.pyplot as plt

n = 3.4
w = 1
r = 1
pad = 4
dpml = 2

sxy = 2*(r+w+pad+dpml)
vol = mp.Volume(mp.Vector3(), size=mp.Vector3(sxy-2*dpml,sxy-2*dpml))

c1 = mp.Cylinder(radius=r+w, material=mp.Medium(index=n))
c2 = mp.Cylinder(radius=r)

fcen = 0.118
df = 0.08
src = mp.Source(mp.GaussianSource(fcen,fwidth=df), mp.Ez, mp.Vector3(r+0.1))

sim = mp.Simulation(cell_size=mp.Vector3(sxy,sxy),
                    geometry=[c1,c2],
                    sources=[src],
                    resolution=10,
                    symmetries=[mp.Mirror(mp.Y)],
                    boundary_layers=[mp.PML(dpml)])

dfts = sim.add_dft_fields([mp.Ez], fcen, fcen, 1, where=vol)
sim.run(until_after_sources=100)
ez_dat = np.absolute(sim.get_dft_array(dfts, mp.Ez, 0))

plt.figure(dpi=100)
plt.imshow(ez_dat.transpose(), interpolation='spline36', cmap='Reds')
plt.axis('off')
plt.show()

This simulation script produces the following image of the ring-resonator mode:

ring_sym

When the mirror-symmetry object is removed, the resulting image is correct:

ring_nosym

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant