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/6d9901460887b1f68a889a148534aba58efc1c64ac68cd85320021574edf8aba.png ../_images/adda66ae26376b800062226cad9e05262d108b0da80dc60aeeb0d70bfa1166d2.png ../_images/ed658a00ae864668f4c84599bd521d863f16b1d7c521785570b602ed1b6cb1a0.png ../_images/9b5b98666ad49ee69b9be5f0b3f4ef6b255e89ed6b9a00d84dc00d6d8b70000d.png ../_images/574a06ca1d1ba7d5dd9bacaceb0d698d785d4bcca4887ba62f3c528323fba2d2.png ../_images/dc9491bfa39b56a3cf80955ad2b9388363c2f104f06722d72fac6591af741d1b.png ../_images/6fc4f47993a36cd1f4a108ff8691232f211f671b977f9fa1068f5ee7b2874648.png ../_images/30b65d0c5cecd3b689e9bc20aa596697e5877cd20be20866f4e0c81632e3ce38.png
S, pm = mw.compute_s_matrix(modes, cells)
mw.visualize((abs(S), pm))
../_images/656d099c844c4d43e5e08062e893f27d5279e52ee31580a3ec58a3711ccc321d.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/358b13cd44c078cb6c956f567086ad34672aee8d15884e72e496de8e8e9ab4b5.png