-
Notifications
You must be signed in to change notification settings - Fork 630
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
Python interface for slanted prisms #1129
Conversation
Needs documentation as well. Note that we decided to define the |
Some strange artifacts are found in the epsilon profile of a hexagonal prism in the xy plane of a 2d cell whenever the import meep as mp
import numpy as np
import math
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
cell_size = mp.Vector3(2.5,2.5)
resolution = 50
vertices = [mp.Vector3(-1,0),
mp.Vector3(-0.5,math.sqrt(3)/2),
mp.Vector3(0.5,math.sqrt(3)/2),
mp.Vector3(1,0),
mp.Vector3(0.5,-math.sqrt(3)/2),
mp.Vector3(-0.5,-math.sqrt(3)/2)]
geometry = [mp.Prism(vertices,
height=1.5,
center=mp.Vector3(),
sidewall_angle=np.radians(15),
material=mp.Medium(index=3.5))]
sim = mp.Simulation(resolution=resolution,
cell_size=cell_size,
geometry=geometry)
sim.init_sim()
plt.figure()
sim.plot2D()
plt.savefig('prism_sidewall.png') sidewall_angle=0 sidewall_angle=np.radians(15) sidewall_angle=np.radians(27) Note that the size of the cross section is shrinking as the |
The "fuzz" around the edges looks a little suspicious, but I'm fine with merging this as an undocumented "experimental" feature. |
Artifacts along the prism boundaries also appear in 3d. import meep as mp
import numpy as np
import math
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
cell_size = mp.Vector3(3,3,3)
resolution = 50
vertices = [mp.Vector3(-1,0),
mp.Vector3(-0.5,math.sqrt(3)/2),
mp.Vector3(0.5,math.sqrt(3)/2),
mp.Vector3(1,0),
mp.Vector3(0.5,-math.sqrt(3)/2),
mp.Vector3(-0.5,-math.sqrt(3)/2)]
geometry = [mp.Prism(vertices,
axis=mp.Vector3(0,0,1),
height=1.5,
center=mp.Vector3(),
sidewall_angle=np.radians(10),
material=mp.Medium(index=3.5))]
sim = mp.Simulation(resolution=resolution,
cell_size=cell_size,
geometry=geometry)
sim.run(mp.at_beginning(mp.output_epsilon),until=0)
eps-xy.png eps-xz.png eps-yz.png |
From a discussion with @stevengj, a good idea for debugging this may be to check |
Adds
sidewall_angle
parameter to Python prism objects (defaults to zero), allowing them to interface the new slanted-prism feature in libctl 4.5 (NanoComp/libctl#53).