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/5da7636f51de596fd67766cff6e029265388117ab6ddee9b1ade1ce2bc808256.png ../_images/c7aba793138a882495b516265618d00e091215ce78dd8e0048b2e2467583d005.png ../_images/d1fe0938b6faa04dae4e0c3b9a17cdaff3bfdb49de245e80ab7711d11d5988fc.png ../_images/1fafb2421968826a7a21fa0efb0febd3788a9a611882f04c7eb96e0d30a901aa.png ../_images/d35c487e39268e53b59df36fbe7edc10703e80141403891df86c696f63527439.png ../_images/f5c26cdab1662dda50cc88f25eed861b268fbc688d85a496f5d4b8e5b2104d29.png ../_images/1ca8e46d2ac5336f6815671a58f9c008e30ef58b2f3625eaee7c39b4c23887c8.png ../_images/6c4784c79db48adf71b69fabb557aa5ca29aa824b27a86fc6e4ed8e3836fe897.png
S, pm = mw.compute_s_matrix(modes, cells)
mw.visualize((abs(S), pm))
../_images/4ddfab39dba5e93bd548aa8a98796d61aaacb8881e1ec13fd697fee2931b2bb1.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/76e558587ed8d2e3a5f67befbfafb36e532faba53ad3799622429ca2b3f4b11f.png