Tidy3D mode solver#

Tidy3d comes with an open source FDFD mode solver

Materials#

You can define materials as a material spec (float, string, tuple[string,string]).

import matplotlib.pyplot as plt
import numpy as np

import gplugins.tidy3d as gt

nm = 1e-3
print(gt.materials.MaterialSpecTidy3d)
float | int | str | tidy3d.components.medium.Medium | tidy3d.components.medium.CustomMedium | tidy3d.components.medium.PoleResidue | tuple[float, float] | tuple[str, str]
gt.materials.get_index(
    3.4
)  # get the index of a material with a given refractive index float
3.4
# get the index of a material with a name string, for the case that the refractive index has only one variant
gt.materials.get_index("AlxOy")
1.7830851366538996
# get the index of a material with a name string, for the case that the refractive index has more than one variant
gt.materials.get_index(("cSi", "Li1993_293K"))
3.4750055639285913

Waveguides#

Guided Electromagnetic modes are the ones that have an effective index larger than the cladding of the waveguide

Here is a waveguide of Silicon (n=3.4) surrounded by SiO2 (n=1.44) cladding

For a 220 nm height x 450 nm width the effective index is 2.466

For defining the waveguide materials you can use a float indicating the refractive index.

strip = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=0.5,
    core_thickness=0.22,
    slab_thickness=0.0,
    core_material=3.47,
    clad_material=1.44,
)
strip.plot_index()
<matplotlib.collections.QuadMesh at 0x7f08e49a5f50>
../_images/2606c13013dc7d079fdf44f67335701375ce1edd35b3a9f14fd5c577b3a9b54e.png

You can also use materials from the default materials.

strip = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=0.5,
    core_thickness=0.22,
    slab_thickness=0.0,
    core_material="si",
    clad_material="sio2",
)
strip.plot_index()
<matplotlib.collections.QuadMesh at 0x7f08e2690c10>
../_images/045fc27a2cce6bd73b3641b0555ed823c4966cc66d1acb728bb14612d46684ef.png
strip.plot_grid()
../_images/86c33c6591cb0a293749b2b4562658f9a566339fc939ff8067e5c4b454770e40.png
strip.plot_field(field_name="Ex", mode_index=0)  # TE
10:33:48 UTC WARNING: The group index was not computed. To calculate group      
             index, pass 'group_index_step = True' in the 'ModeSpec'.           
2024-05-10 10:33:48.967 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_952c1242c33b6ca3.npz.
<matplotlib.collections.QuadMesh at 0x7f08e25def90>
../_images/fc4771062a6f34d735a7a052dcb3d09b655e6a23bb27323de00ad318e7c21047.png
strip.plot_field(field_name="Ex", mode_index=0, value="dB")  # TE
<matplotlib.collections.QuadMesh at 0x7f08e20ea450>
../_images/459ae44b784fdbf308fa6450bcebaf636a32a52cd4eb9795963e45f58449a4e2.png
strip.plot_field(field_name="Ey", mode_index=1)  # TM
<matplotlib.collections.QuadMesh at 0x7f08e1f56f90>
../_images/85b748b64ac5e31a3f045ede7ad8876bfcc41a5230ba64f062896ef2e8cf2e5e.png
strip.n_eff
array([2.51134734+4.42777628e-05j, 1.86463643+2.09422901e-04j])
rib = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=0.5,
    core_thickness=0.22,
    slab_thickness=0.15,
    core_material="si",
    clad_material="sio2",
)
rib.plot_index()
rib.n_eff
10:33:50 UTC WARNING: Mode field at frequency index 0, mode index 1 does not    
             decay at the plane boundaries.                                     
2024-05-10 10:33:50.577 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_726ead3c1d0a1bf3.npz.
array([2.67427418+3.10179974e-05j, 2.50854926+4.47861069e-05j])
../_images/d7249d8e4d9217533e5f5161f53abbf3e3c2de19fd8cccb3fed11e151396e4c2.png
rib.plot_field(field_name="Ex", mode_index=0)  # TE
<matplotlib.collections.QuadMesh at 0x7f08e1dded50>
../_images/779160cccbdea42a753062c77a1d73a7154bce01099734013e62c75401e33f79.png
nitride = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=1.0,
    core_thickness=400 * nm,
    slab_thickness=0.0,
    core_material="sin",
    clad_material="sio2",
)
nitride.plot_index()
nitride.n_eff
2024-05-10 10:33:51.645 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_93a010d591ee1827.npz.
array([1.64461788+8.05914278e-05j, 1.57796343+1.42713228e-04j])
../_images/29a0cea9ce29f5d2a915699e683ee597b7c0b5c517185cd8a879086ae9ed427c.png
nitride.plot_field(field_name="Ex", mode_index=0)  # TE
<matplotlib.collections.QuadMesh at 0x7f08e1b4bc50>
../_images/8fe658bc3459d9e6b0677047a00eddf7a938a5754f44625806d651c8bb1f7902.png

Sweep width#

You can sweep the waveguide width and compute the modes.

By increasing the waveguide width, the waveguide supports many more TE and TM modes. Where TE modes have a dominant Ex field and TM modes have larger Ey fields.

Notice that waveguides wider than 0.450 um support more than one TE mode. Therefore the maximum width for single mode operation is 0.450 um.

strip = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=1.0,
    slab_thickness=0.0,
    core_material="si",
    clad_material="sio2",
    core_thickness=220 * nm,
    num_modes=4,
)
w = np.linspace(400 * nm, 1000 * nm, 7)
n_eff = gt.modes.sweep_n_eff(strip, core_width=w)
fraction_te = gt.modes.sweep_fraction_te(strip, core_width=w)

for i in range(4):
    plt.plot(w, n_eff.sel(mode_index=i).real, c="k")
    plt.scatter(
        w, n_eff.sel(mode_index=i).real, c=fraction_te.sel(mode_index=i), vmin=0, vmax=1
    )
plt.axhline(y=1.44, color="k", ls="--")
plt.colorbar().set_label("TE fraction")
plt.xlabel("Width of waveguide (µm)")
plt.ylabel("Effective refractive index")
plt.title("Effective index sweep")
10:33:53 UTC WARNING: Mode field at frequency index 0, mode index 3 does not    
             decay at the plane boundaries.                                     
2024-05-10 10:33:53.428 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_d72800855e87d64d.npz.
10:33:55 UTC WARNING: Mode field at frequency index 0, mode index 3 does not    
             decay at the plane boundaries.                                     
2024-05-10 10:33:55.100 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_f6d805f8eed6e5e6.npz.
2024-05-10 10:33:56.999 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_5c1f9fd9c1dc2337.npz.
2024-05-10 10:33:58.312 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_b52e704c98787794.npz.
2024-05-10 10:33:59.566 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_64a02432ce60ee16.npz.
2024-05-10 10:34:00.727 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_e0d05a23783270d1.npz.
2024-05-10 10:34:01.770 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_ed43cf17cc242135.npz.
2024-05-10 10:34:01.783 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/Waveguide_d72800855e87d64d.npz.
2024-05-10 10:34:01.785 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/Waveguide_f6d805f8eed6e5e6.npz.
2024-05-10 10:34:01.787 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/Waveguide_5c1f9fd9c1dc2337.npz.
2024-05-10 10:34:01.788 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/Waveguide_b52e704c98787794.npz.
2024-05-10 10:34:01.790 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/Waveguide_64a02432ce60ee16.npz.
2024-05-10 10:34:01.791 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/Waveguide_e0d05a23783270d1.npz.
2024-05-10 10:34:01.792 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/Waveguide_ed43cf17cc242135.npz.
Text(0.5, 1.0, 'Effective index sweep')
../_images/84acf6d76935da372c10f1fbc3c1405aa71fa8460beefcb3f1afb486c59bdff5.png

Exercises

  • What is the maximum width to support a single TE mode at 1310 nm?

  • For a Silicon Nitride (n=2) 400nm thick waveguide surrounded by SiO2 (n=1.44), what is the maximum width to support a single TE mode at 1550 nm?

  • For two 500x220nm Silicon waveguides surrounded by SiO2, what is the coupling length (100% coupling) for 200 nm gap?

Group index#

You can also compute the group index for a waveguide.

nm = 1e-3

strip = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=500 * nm,
    slab_thickness=0.0,
    core_material="si",
    clad_material="sio2",
    core_thickness=220 * nm,
    num_modes=4,
    group_index_step=10 * nm,
)
print(strip.n_group)
10:34:06 UTC WARNING: Mode field at frequency index 0, mode index 3 does not    
             decay at the plane boundaries.                                     
10:34:07 UTC WARNING: Mode field at frequency index 1, mode index 3 does not    
             decay at the plane boundaries.                                     
             WARNING: Mode field at frequency index 2, mode index 3 does not    
             decay at the plane boundaries.                                     
2024-05-10 10:34:07.079 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_652749366badba01.npz.
[4.17803969 4.08299706 2.71577378 1.50332985]

Bend modes#

You can compute bend modes specifying the bend radius.

strip_bend = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=500 * nm,
    core_thickness=220 * nm,
    slab_thickness=0.0,
    bend_radius=4,
    core_material="si",
    clad_material="sio2",
)
strip_bend.plot_field(field_name="Ex", mode_index=0)  # TE
10:34:10 UTC WARNING: Mode field at frequency index 0, mode index 1 does not    
             decay at the plane boundaries.                                     
2024-05-10 10:34:10.150 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_b5e165b81e641338.npz.
<matplotlib.collections.QuadMesh at 0x7f08e09b52d0>
../_images/99980b030abef8949918fba754f7d581d11091fc609b7ff62cad932705a10abf.png

Bend loss#

You can also compute the losses coming from the mode mismatch from the bend into a straight waveguide. To compute the bend loss due to mode mismatch you can calculate the mode overlap of the straight mode and the bent mode. Because there are two mode mismatch interfaces the total loss due to mode mismatch will be squared (from bend to straight and from straight to bend).

from paper

radii = np.arange(4, 7)
bend = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=500 * nm,
    core_thickness=220 * nm,
    core_material="si",
    clad_material="sio2",
    num_modes=1,
    bend_radius=radii.min(),
)
mismatch = gt.modes.sweep_bend_mismatch(bend, radii)

plt.plot(radii, 10 * np.log10(mismatch))
plt.title("Strip waveguide bend")
plt.xlabel("Radius (μm)")
plt.ylabel("Mismatch (dB)")
Text(0, 0.5, 'Mismatch (dB)')
../_images/4bea4f0d7dc32cf72c43070fdb7d3dbc5305b688cfca537c0c3d74c384d16c08.png
dB_cm = 2  # dB/cm
length = 2 * np.pi * radii * 1e-6
propagation_loss = dB_cm * length * 1e2
propagation_loss

plt.title("Bend90 loss for TE polarization")
plt.plot(radii, -10 * np.log10(mismatch), ".", label="mode loss")
plt.plot(radii, propagation_loss, ".", label="propagation loss")
plt.xlabel("bend radius (um)")
plt.ylabel("Loss (dB)")
plt.legend()
<matplotlib.legend.Legend at 0x7f08e1f00bd0>
../_images/e1e2ffaf3bd4367fceb5a9f9883eeaa9265f155adf6c82310b933c3aad3fa18a.png
rib = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=1000 * nm,
    core_thickness=220 * nm,
    slab_thickness=110 * nm,
    bend_radius=15,
    core_material="si",
    clad_material="sio2",
)
rib.plot_field(field_name="Ex", mode_index=0)  # TE
2024-05-10 10:34:15.913 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_e1b8d2a571c11c59.npz.
<matplotlib.collections.QuadMesh at 0x7f08e1e937d0>
../_images/f2a49a9108915a5534ef7636182e499569e96d554532956336223091e394b88e.png
nitride_bend = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=1000 * nm,
    core_thickness=400 * nm,
    slab_thickness=0.0,
    bend_radius=30,
    core_material="sin",
    clad_material="sio2",
)
nitride_bend.plot_field(field_name="Ex", mode_index=0, value="abs")  # TE
10:34:27 UTC WARNING: Mode field at frequency index 0, mode index 0 does not    
             decay at the plane boundaries.                                     
             WARNING: Mode field at frequency index 0, mode index 1 does not    
             decay at the plane boundaries.                                     
2024-05-10 10:34:27.936 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/Waveguide_64a4d7e824828167.npz.
<matplotlib.collections.QuadMesh at 0x7f08e0879650>
../_images/8012f9141574b402fb3551850ef50531b19ff672d65db446a915c67ff3d69f46.png
radii = np.array([30, 35, 40])
bend = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=1000 * nm,
    core_thickness=400 * nm,
    core_material="sin",
    clad_material="sio2",
    num_modes=1,
    bend_radius=radii.min(),
)
mismatch = gt.modes.sweep_bend_mismatch(bend, radii)
dB_cm = 2  # dB/cm
length = 2 * np.pi * radii * 1e-6
propagation_loss = dB_cm * length * 1e2
propagation_loss

plt.title("Bend90 loss for TE polarization")
plt.plot(radii, -10 * np.log10(mismatch), ".", label="mode loss")
plt.plot(radii, propagation_loss, ".", label="propagation loss")
plt.xlabel("bend radius (um)")
plt.ylabel("Loss (dB)")
plt.legend()
<matplotlib.legend.Legend at 0x7f08e1d5cb10>
../_images/ce221da132e786b25d7006a6d450696c60dc8ac9aab4cfea81460a303d30913c.png

Exercises

  • For a 500nm wide 220nm thick Silicon waveguide surrounded by SiO2, what is the minimum bend radius to have less than 0.04dB loss for TE polarization at 1550nm?

  • For a 500nm wide 220nm thick Silicon waveguide surrounded by SiO2, what is the minimum bend radius to have 99% power transmission for TM polarization at 1550nm?

Waveguide coupler#

You can also compute the modes of a waveguide coupler.

       ore_width[0]  core_width[1]
        <------->     <------->
         _______       _______   _
        |       |     |       | |
        |       |     |       |
        |       |_____|       | | core_thickness
        |slab_thickness       |
        |_____________________| |_
                <----->
                  gap


c = gt.modes.WaveguideCoupler(
    wavelength=1.55,
    core_width=(500 * nm, 500 * nm),
    gap=200 * nm,
    core_thickness=220 * nm,
    slab_thickness=100 * nm,
    core_material="si",
    clad_material="sio2",
)
c.plot_index()
<matplotlib.collections.QuadMesh at 0x7f08e01c3050>
../_images/ac9b9540e8286dd38be5511647b91a655a4ea673a02e1738ee751c6f788771eb.png
c.plot_field(field_name="Ex", mode_index=0)  # even mode
2024-05-10 10:34:37.213 | INFO     | gplugins.tidy3d.modes:_data:305 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_79c6a39de0ac47bc.npz.
<matplotlib.collections.QuadMesh at 0x7f08dbebea90>
../_images/7eb22928af19b7d71d25d5f1ebb96e64a9b7c4427cd659bec13f5e4ec9d84a78.png
c.plot_field(field_name="Ex", mode_index=1)  # odd mode
<matplotlib.collections.QuadMesh at 0x7f08e065df50>
../_images/9aa375524b756101f1065c576d45cde5981d2891bb1becb66777db12e227f285.png
coupler = gt.modes.WaveguideCoupler(
    wavelength=1.55,
    core_width=(450 * nm, 450 * nm),
    core_thickness=220 * nm,
    core_material="si",
    clad_material="sio2",
    num_modes=4,
    gap=0.1,
)

print("\nCoupler:", coupler)
print("Effective indices:", coupler.n_eff)
print("Mode areas:", coupler.mode_area)
print("Coupling length:", coupler.coupling_length())

gaps = np.linspace(0.05, 0.15, 11)
lengths = gt.modes.sweep_coupling_length(coupler, gaps)

_, ax = plt.subplots(1, 1)
ax.plot(gaps, lengths)
ax.set(xlabel="Gap (μm)", ylabel="Coupling length (μm)")
ax.legend(["TE", "TM"])
ax.grid()
Coupler: WaveguideCoupler(wavelength=array(1.55), core_width=['0.45', '0.45'], core_thickness='0.22', core_material='si', clad_material='sio2', box_material=None, slab_thickness='0.0', clad_thickness=None, box_thickness=None, side_margin=None, sidewall_angle='0.0', sidewall_thickness='0.0', sidewall_k='0.0', surface_thickness='0.0', surface_k='0.0', bend_radius=None, num_modes='4', group_index_step='False', precision='double', grid_resolution='20', max_grid_scaling='1.2', cache_path='/home/runner/.gdsfactory/modes', overwrite='False', model_config={'extra': 'forbid'}, gap='0.1')
2024-05-10 10:34:37.544 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_82b844a6e8c147c7.npz.
Effective indices: [2.4637647 +6.57552457e-05j 2.39007229+5.06214923e-05j
 1.9225165 +1.99036730e-04j 1.71420814+2.37015946e-04j]
Mode areas: [0.31003254 0.33258301 0.57286555 0.59002858]
Coupling length: [10.5166863   3.72044606]
2024-05-10 10:34:37.552 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_1cea3050b3d0c7ec.npz.
2024-05-10 10:34:37.554 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_f0bef047b52f4b28.npz.
2024-05-10 10:34:37.556 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_56b7c6012ee18b1b.npz.
2024-05-10 10:34:37.557 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_6c568eedf951f059.npz.
2024-05-10 10:34:37.559 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_e83519c7a06e4279.npz.
2024-05-10 10:34:37.560 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_82e63a3d868d244f.npz.
2024-05-10 10:34:37.562 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_ccf1ffc94f9670f3.npz.
2024-05-10 10:34:37.563 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_15448997f7363457.npz.
2024-05-10 10:34:37.565 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_4963b30bfc0685ac.npz.
2024-05-10 10:34:37.566 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_28607a1061ef8e2c.npz.
2024-05-10 10:34:37.568 | INFO     | gplugins.tidy3d.modes:_data:265 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_f9023893ce41b2d6.npz.
../_images/b156b5d72cb78b6bca70907c3e64e14c02583342ae32bf251bd9fd6d128c541e.png