Replies: 7 comments
-
Meep supports arbitrary shapes already — via polygonal prisms, combinations of geometric objects, and user-defined functions. Is there a specific input format that you want Meep to support? |
Beta Was this translation helpful? Give feedback.
-
Thanks for answering. I need the simulation of the bend waveguilde structure in Lumerical. How to construct a bend waveguide with a polygonal prisms?I can't find a suitable solution, please help me give an idea.The diagram of the bend waveguide is given in the attachment. |
Beta Was this translation helpful? Give feedback.
-
You just discretize the bend into a large number of vertices. You can do this on your own with a simple Python function, or you can use a CAD program to make your geometry and save it as a GDSII file, which can be imported into Meep. |
Beta Was this translation helpful? Give feedback.
-
Thanks.I sampled multiple points on the Bezier curve, and then constructed a cube with a fixed size cross section, taking each point as the center and the distance between every two points as the height, thus constructing the bend.I wonder why the width is inconsistent. |
Beta Was this translation helpful? Give feedback.
-
Probably you made a math mistake. |
Beta Was this translation helpful? Give feedback.
-
You might try https://gdsfactory.github.io/gdsfactory/index.html to create the bend, then output a GDSII file |
Beta Was this translation helpful? Give feedback.
-
@Sun52585 this may help, import meep as mp
import numpy as np
import matplotlib.pyplot as plt
'''Sim parameters'''
resolution = 16
dpml = 1.0
sx, sy, sz = 12, 12, 4
cell_size = mp.Vector3(sx, sy, sz)
pml_layers = [mp.PML(dpml)]
'''Waveguide parameters'''
n_waveguide = 3.45
waveguide_material = mp.Medium(index=n_waveguide)
waveguide_width = 1.0
waveguide_height = 0.5
bend_radius = 4.0
arc_segments = 30
geometry = []
'''Straight horizontal'''
geometry.append(mp.Block(
size=mp.Vector3(sx/2+0.05, waveguide_width, waveguide_height),
center=mp.Vector3(-sx/4, -bend_radius, waveguide_height / 2),
material=waveguide_material
))
''' Straight vertical '''
geometry.append(mp.Block(
size=mp.Vector3(waveguide_width, sy/2+0.05, waveguide_height),
center=mp.Vector3(bend_radius, sy/4, waveguide_height / 2),
material=waveguide_material
))
''' Arc bend (quarter-circle ) '''
theta = np.linspace(-np.pi/2, 0, arc_segments)
r_out = bend_radius + waveguide_width / 2
r_in = bend_radius - waveguide_width / 2
outer_arc = [mp.Vector3(r_out * np.cos(t), r_out * np.sin(t)) for t in theta]
inner_arc = [mp.Vector3(r_in * np.cos(t), r_in * np.sin(t)) for t in reversed(theta)]
arc_vertices = outer_arc + inner_arc
geometry.append(mp.Prism(vertices=arc_vertices,
height=waveguide_height,
material=waveguide_material))
wavelength = 1.55
fcen = 1 / wavelength
sources = [mp.Source(
src=mp.ContinuousSource(frequency=fcen),
component=mp.Ez,
center=mp.Vector3(-sx/2 + dpml, -bend_radius, waveguide_height / 2),
size=mp.Vector3(0, waveguide_width, waveguide_height)
)]
sim = mp.Simulation(
cell_size=cell_size,
geometry=geometry,
sources=sources,
boundary_layers=pml_layers,
resolution=resolution,
default_material=mp.air,
dimensions=3
)
sim.run(mp.at_beginning(mp.output_epsilon),until=50)
'''2D slice visualization at z=waveguide_height / 2'''
eps = sim.get_array(center=mp.Vector3(z=waveguide_height / 2), size=mp.Vector3(sx, sy, 0), component=mp.Dielectric)
ez = sim.get_array(center=mp.Vector3(z=waveguide_height / 2), size=mp.Vector3(sx, sy, 0), component=mp.Ez)
plt.figure(dpi=50)
plt.imshow(eps.T, interpolation='spline36', cmap='binary', origin='lower')
plt.imshow(ez.T, interpolation='spline36', cmap='RdBu', alpha=0.7, origin='lower')
plt.title("Quarter-Arc Waveguide (Ez, z=waveguide_height / 2 slice)")
plt.axis('off')
plt.show()
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Meep developers and community,
I'm a regular user of Meep for electromagnetic simulations, and I greatly appreciate its flexibility and open-source nature. However, I've encountered a scenario where I need to simulate waveguide structures with complex shapes (e.g., tapered, bent, or custom cross-sectional waveguides) that are commonly supported in Lumerical's Waveguide tools. Currently, it is diffcult to set up such structures in Meep. So hope to support the simulation of bend waveguilde structure
Beta Was this translation helpful? Give feedback.
All reactions