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/e9ac045dd0e48724b0c4b53e45811431f20a063a56944b0ada6c2633221300a9.png ../_images/b4759ad015c978e0dd202f753d32b1d6cd0d7044fcdea96a57ebe4b4f57fb0d0.png ../_images/58657fb160dc8f6bac6025739116f2adf5a61a92b8e6c5f913feaa92f1370678.png ../_images/b48c898b156824e519b603878722bc194036ddc7baa2ca6204d6f87e06d492ed.png ../_images/eccb975c16616b8df4d68b0483ef2b0d2d47bdf2c2c40e850017279723ccad1a.png ../_images/b38cf08b4a71e4e3baf3e877e0eda71884784d735c873cb784c757cb858e4342.png ../_images/441aec4c24209c14f90669bd5db54ae807a46cd15ad6760b7fd1e02ca6bcb626.png ../_images/b15adeb14a95438d2a3149981445952d2b42f85e6d821da5177b36000c0d6b3a.png
S, pm = mw.compute_s_matrix(modes, cells)
mw.visualize((abs(S), pm))
../_images/7b66c52206f36920e59a41182978cb5c7e508751a65e5eaf72f94582026a8ef5.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/77b0392b698630531494ffcd347f67e3683adfcf21346647b32e0676f20906f3.png