Unequal Number of Modes

Unequal Number of Modes#

Find the S-matrix of a structure for which each slice has a different number of modes (contributed by @jan-david-black)

import meow as mw
import numpy as np
def create_structures(length=10.0):
    oxide = mw.Structure(
        material=mw.silicon_oxide,
        geometry=mw.Prism(
            poly=np.array([(0, -2.1), (10, -2.1), (10, 2.1), (0, 2.1)]),
            h_min=-3,
            h_max=0,
            axis="y",
        ),
    )

    poly = np.array([(0, -0.45 / 2), (10, -0.5 / 2), (10, 0.5 / 2), (0, 0.45 / 2)])

    core = mw.Structure(
        material=mw.silicon,
        geometry=mw.Prism(
            poly=poly,
            h_min=0,
            h_max=0.22,
            axis="y",
        ),
    )

    structures = [oxide, core]
    return structures
mw.visualize(create_structures())
def create_cells(length=10.0, num_cells=2):
    structures = create_structures(length=length)
    cells = mw.create_cells(
        structures=structures,
        mesh=mw.Mesh2d(
            x=np.linspace(-2, 2, 101),
            y=np.linspace(-2, 2, 101),
            # specify possible conformal mesh specifications here:
            # bend_radius=2.0,
            # bend_axis=1,
        ),
        Ls=np.array([length / num_cells for _ in range(num_cells)]),
    )
    return cells
cells = create_cells(10, 2)
env = mw.Environment(wl=1.55, T=25.0)
css = [mw.CrossSection.from_cell(cell=cell, env=env) for cell in cells]

Equal number of modes#

modes = [mw.compute_modes(cs, num_modes=4) for cs in css]
for ms in modes:
    print(len(ms))
4
4
for ms in modes:
    for m in ms:
        mw.visualize(m)
../_images/400db0d9e48af5ebc65d04663f861e3fab7b6b9e2c0d49c67f4c0a284b6ceab1.png ../_images/937528fbfcc3c31b7b273a5f43b381e882a1ee9f9aefb3f81f62ced78d4428a2.png ../_images/6d9518fc239bd4e3a1b59a3c8bc6f4b024d3834b22a00fd61572b4b7394a12af.png ../_images/9b053f7695ddc0df30b87567aa939da36b1aa68c69625f5a55419e8fac618de3.png ../_images/7695efc711590a4afe7bcc942215bcf97dfe04ca0f0b455ba8c61de9890c74b8.png ../_images/8147d4823b2285a51cde5b863784d62e33f141553e622fc0ba56b93928ebf2b3.png ../_images/2b3d54677a57653015302544243e37d04e89c750b0e0d35e6e0cabc47d452273.png ../_images/a80911f2ab91d9991caf5a0a3322cf09dce3d4be369439e2d536c10b73b99680.png
S, pm = mw.compute_s_matrix(modes, cells)
mw.visualize((abs(S), pm))
../_images/75b8e6c519792db9f95da599477159c8c0cf44cc1774a17c10b782f7e08294f1.png

Unequal number of modes#

modes[0] = modes[0][:2]
modes[-1] = modes[-1][:3]
for ms in modes:
    print(len(ms))
2
3
S, pm = mw.compute_s_matrix(modes, cells)
mw.visualize((abs(S), pm))
../_images/b21e0f0f34dd4c3d31b659685c03635221700a42a81943279d7533e4a86b8bfb.png