Quick Start#

meow Introduction and Quick Start

Installation#

pip install meow-sim

Quick Start#

1. Structure#

First create the structures to be simulated. A Structure is a collection of a Geometry with a Material.

Note

meow expects the propagation direction to be the z-axis! This makes the zx-plane parallel with the chip and the y-axis perpendicular to the chip. Keep this in mind when creating your structures.

length = 10.0

oxide = mw.Structure(
    material=mw.silicon_oxide,
    geometry=mw.Box(
        x_min=-1.0,
        x_max=1.0,
        y_min=-1.0,
        y_max=0.0,
        z_min=0.0,
        z_max=length,
    ),
)

core = mw.Structure(
    material=mw.silicon,
    geometry=mw.Box(
        x_min=-0.45 / 2,
        x_max=0.45 / 2,
        y_min=0.0,
        y_max=0.22,
        z_min=0,
        z_max=length,
    ),
)

structures = [oxide, core]
mw.visualize(structures)

Note

you can also extrude structures from a gds file. See GdsExtrusionRule.

2. Cells#

Once you have a list of Structure objects, they need to be divided into cells. A Cell is a combination of those structures with 2D meshing info (Mesh2d) and a cell length.

num_cells = 5

cells = mw.create_cells(
    structures=structures,
    mesh=mw.Mesh2d(
        x=np.linspace(-1, 1, 101),
        y=np.linspace(-1, 1, 101),
        # specify possible conformal mesh specifications here:
        # bend_radius=2.0,
        # bend_axis=1,
        ez_interfaces=True,
    ),
    Ls=np.array([length / num_cells for _ in range(num_cells)]),
)

A cell should be a region of (approximate) constant cross section. We can use the visualize() function to show the cross section of a cell:

mw.visualize(cells[0])
../_images/9232a58634d20b36535d95a10b1af066900c3110a1e972679efd249472132375.png

3. Cross Sections#

A Cell contains all the Structure info, but does not take any Environment information (such as temparature or wavelength) into account. This information is important as it influences the refractive index of the CrossSection.

Therefore, combining a Cell with an Environment yields a CrossSection:

env = mw.Environment(wl=1.55, T=25.0)
css = [mw.CrossSection.from_cell(cell=cell, env=env) for cell in cells]
mw.visualize(css[0])
../_images/1ed05440441303b19cfd2b0a8691765c7d21a6442e7c5f1c72cf2ca2a1e293ed.png

4. Find Modes (FDE)#

We can now compute multiple Modes per CrossSection using compute_modes():

num_modes = 4

modes: List[List[mw.Mode]] = []
for cs in css:
    modes_in_cs = mw.compute_modes(cs, num_modes=num_modes)
    modes.append(modes_in_cs)
# show Hx component of the second mode (idx 1)
# of the first cell (idx 0):
mw.visualize(modes[0][0], fields=["Ex"])
mw.visualize(modes[-1][0], fields=["Ex"])
../_images/67939fec6d363a2958eac7497a98be16c39878a02861211f1cbef9618fe9daa0.png ../_images/67939fec6d363a2958eac7497a98be16c39878a02861211f1cbef9618fe9daa0.png

Note

above, the Modes of the CrossSection are calculated sequentially. However, you’re invited to try calculating the modes concurrently as well 😉

5. Calculate S-matrix (EME)#

The S-matrix of a collection of modes can now easily be calculated with compute_s_matrix(). This step uses the sax circuit solver under the hood.

S, port_map = mw.compute_s_matrix(modes, cells)

print(port_map)
mw.visualize((abs(S), port_map))
{'left@0': 0, 'left@1': 1, 'left@2': 2, 'left@3': 3, 'right@0': 4, 'right@1': 5, 'right@2': 6, 'right@3': 7}
../_images/3157673af1a4ef1d46ab99d61d56b138df75f6c00d50dc14837319c658a033df.png

That’s it! this was a quick introduction to the meow library!