0% found this document useful (0 votes)
30 views

backup.py

Uploaded by

adnansami987606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

backup.py

Uploaded by

adnansami987606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import tidy3d as td

import numpy as np
import gdstk
from tidy3d_lambda import entrypoint

@entrypoint
def generate_object(param):
# parameters
x0=0 # x coordinate of directional coupler center (um)
y0=0 # y coordinate of directional coupler center (um)
z0=0 # z coordinate of directional coupler center (um)
wg_width=0.5 # width of the waveguide (um)
wg_thickness=0.22 # thickness of the waveguide (um)
wg_spacing_in=0 # spacing between the input straight waveguides (um)
wg_spacing_coup=1.0 # gap size of the coupling region (um)
wg_length=4 # length of the input straight waveguides (um)
coup_length=4 #length of the coupling region (um)
bend_length=4 # length of the bending (um)
sidewall_angle=0 # side wall angle of the waveguide (rad)
# medium of the waveguide
medium=td.material_library["cSi"]["Li1993_293K"]
cell = gdstk.Cell("dc") # define a gds cell

# define a path
coup = gdstk.RobustPath(
(-wg_length - bend_length - coup_length / 2 + x0, wg_spacing_in / 2 + y0),
wg_width,
layer=1,
datatype=0,
)

# add a curved segment instead of a straight one


coup.arc(radius=.85*bend_length, initial_angle=np.pi, final_angle=0)

A = (wg_spacing_in - wg_spacing_coup - wg_width) / 4

coup.segment(
(-coup_length /2 + x0, wg_spacing_in / 2 + y0), offset=lambda u: A/100 *
2*np.cos(np.pi * u) - A
)

# Modify this part to create a full circular loop replacing the blue-marked
portion.
coup.arc(radius=coup_length/1.5, initial_angle=-np.pi/2, final_angle=
0.05*np.pi/2)

# add path to the cell


cell.add(coup)

# add the mirrored path to the cell


cell.add(coup.copy().mirror((x0 + 1, y0), (x0, y0)))

# define geometry from the gds cell


dc_geo = td.PolySlab.from_gds(
cell,
gds_layer=1,
axis=2,
slab_bounds=(z0 - wg_thickness / 2, z0 + wg_thickness / 2),
sidewall_angle=sidewall_angle,
)

# define tidy3d structure of the bend


dc = td.Structure(geometry=td.GeometryGroup(geometries=dc_geo), medium=medium)

return [dc]

You might also like