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/54253004beaa03d88b4a3915f01cae6badcb3f9ed1ff270a032b65d8cf6730d0.png ../_images/81fe4a2544d51ecad43b7a07e4b602b9d5015e71a269bd4acc7cf8436bb9a5e2.png ../_images/cc13dccc8e5a74421d2ba7ba816665d061d0e20d681234babc45b2da13287dc7.png ../_images/01ab4f4538ef334176415a1eb7b5514e56f09510d425300bab81430237a690ba.png ../_images/022e6264205af56c856aec7eb8ac28c228d41cc39cb9db994dd802b32653b145.png ../_images/9b6897a11927cf4192170c0733af13e493cccbc04553904aec73e3b6122d05f4.png ../_images/7b7861aa31e940e3f44480d5d874ffe0f481cc14d3016362dc5d948c93a4ccfe.png ../_images/5f9d2f8184775f02d37ea40037c3317cc02b284b1f0963f9d367213d7c3ce7d8.png
S, pm = mw.compute_s_matrix(modes, cells)
mw.visualize((abs(S), pm))
../_images/ffded44d7cee51e5ebac133d78b15c1b4786ffdf53bf2d295c70d727cca497f9.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/28b2bf7f0b162886744dbf77312b90c89817f0f4843d3df4a959bfcfa6ad900a.png