FDFD mode solver#

We also have a FDFD mode solver.

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

import gdsfactory as gf
import gplugins.tidy3d as gt
import matplotlib.pyplot as plt
import numpy as np
from gdsfactory.generic_tech import get_generic_pdk

gf.config.rich_output()
PDK = get_generic_pdk()
PDK.activate()

nm = 1e-3
wg_width = 0.5
wavelength = 1.55
core_thickness = 0.22
slab_thickness = 0.0
core_material = "si"  # can be a string or a number with the refractive index
clad_material = "sio2"

slab_thickness_rib = 0.15
nitride_thickness = 0.4

strip = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=wg_width,
    core_thickness=core_thickness,
    slab_thickness=slab_thickness,
    core_material=core_material,
    clad_material=clad_material,
    num_modes=2,
    sidewall_angle=np.deg2rad(10),
)

strip.plot_index()
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version!
  warnings.warn(
/tmp/ipykernel_3157/216970206.py:5: DeprecationWarning: The 'gdsfactory.generic_tech' module is deprecated and will be removed in a future version. Please update your imports to use 'gdsfactory.gpdk' instead:
  from gdsfactory.gpdk import LAYER, LAYER_STACK, get_generic_pdk
Or for submodules:
  from gdsfactory.gpdk.layer_map import LAYER
  from gdsfactory.gpdk.layer_stack import LAYER_STACK
  from gdsfactory.generic_tech import get_generic_pdk

<matplotlib.collections.QuadMesh object at 0x7f56d42254f0>

../_images/7804c8655eacb9b13a1196221917b0040fe00157eb2766ca4a57e456fe307b14.png
strip.plot_grid()

../_images/cd0ca0601cae3058bdc3dfd4410883ee68635f0da74bf3b4736a5ce47c48599a.png
strip.plot_field(field_name="Ex", mode_index=0)  # TE
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
13:47:12 UTC WARNING: The group index was not computed. To calculate group      
             index, pass 'group_index_step = True' in the 'ModeSpec'.           
2026-02-24 13:47:12.207 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_cbff739117b5eebc.npz.

<matplotlib.collections.QuadMesh object at 0x7f56d1fd6bd0>

../_images/eb22cd5341a0d40c71f01daacbf0e1a0b6136150e7dee21188418e2151fc8242.png
strip.plot_field(field_name="Ex", mode_index=0, value="dB")  # TE

<matplotlib.collections.QuadMesh object at 0x7f56d1a86bd0>

../_images/494e3fb5eeeea4e4d826a2989701c33174e0d871a7e1d7dee16c5d837963a905.png
strip.plot_field(field_name="Ey", mode_index=1)  # TM

<matplotlib.collections.QuadMesh object at 0x7f56d1aad130>

../_images/aa08d54321cb55c7ab5aa681391690cb786234810dec3f9532b490b6ab06d4f8.png
strip.n_eff

array([2.54959783+4.11062054e-05j, 1.88581037+2.04207812e-04j])
slab_thickness = 0.15

rib = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=wg_width,
    core_thickness=core_thickness,
    slab_thickness=slab_thickness,
    core_material=core_material,
    clad_material=clad_material,
    num_modes=2,
    sidewall_angle=np.deg2rad(10),
)

rib.plot_index()
rib.n_eff
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
13:47:13 UTC WARNING: Mode field at frequency index 0, mode index 1 does not    
             decay at the plane boundaries.                                     
2026-02-24 13:47:13.794 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_c0ce309af07d6106.npz.

array([2.67680485+3.13289436e-05j, 2.50895287+4.47976905e-05j])

../_images/4671a43a1dd7ee5054801b659237e4af307b2da8b26ba045ace1816eb2b39499.png
rib.plot_field(field_name="Ex", mode_index=0)  # TE

<matplotlib.collections.QuadMesh object at 0x7f56d1721b50>

../_images/e355a01586f0b246ad75b5cde43b15ad740621824c8b04713a664b55e1c5c8e1.png
nitride = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=1.0,
    core_thickness=nitride_thickness,
    slab_thickness=0.0,
    core_material="sin",  # can be a string or a number with the refractive index
    clad_material="sio2",
    sidewall_angle=np.deg2rad(10),
)
nitride.plot_index()
nitride.n_eff
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:14.839 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_5d64be3a6cba600c.npz.

array([1.65390492+7.63134331e-05j, 1.58330988+1.40964564e-04j])

../_images/7aa2a86c6572c82c734d9fad88e3814ca4ff2165a4fe0e4f35bbfd00d857a237.png
nitride.plot_field(field_name="Ex", mode_index=0)  # TE

<matplotlib.collections.QuadMesh object at 0x7f56d1666bd0>

../_images/20619067453e70e7d50893fd2fd60edaeaed440ccfd49f4148d1739b736170dc.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.

wg_width = 0.5
wavelength = 1.55
core_thickness = 0.22
slab_thickness = 0.0
core_material = "si"  # can be a string or a number with the refractive index
clad_material = "sio2"

strip = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=wg_width,
    core_thickness=core_thickness,
    slab_thickness=slab_thickness,
    core_material=core_material,
    clad_material=clad_material,
    num_modes=4,
    sidewall_angle=np.deg2rad(10),
)

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")
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
13:47:16 UTC WARNING: Mode field at frequency index 0, mode index 3 does not    
             decay at the plane boundaries.                                     
2026-02-24 13:47:16.498 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_2688ef7121b52b61.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
13:47:18 UTC WARNING: Mode field at frequency index 0, mode index 3 does not    
             decay at the plane boundaries.                                     
2026-02-24 13:47:18.180 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_94d65e8aba2d0224.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:19.435 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_b9e3849af2712d5f.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:20.580 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_3a30c675474053a6.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:21.689 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_95af64adee4aa35b.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:22.761 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_b761faec55b3100f.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:23.791 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_26812fc5c4788dc0.npz.
2026-02-24 13:47:23.805 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/Waveguide_2688ef7121b52b61.npz.
2026-02-24 13:47:23.814 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/Waveguide_94d65e8aba2d0224.npz.
2026-02-24 13:47:23.816 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/Waveguide_b9e3849af2712d5f.npz.
2026-02-24 13:47:23.817 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/Waveguide_3a30c675474053a6.npz.
2026-02-24 13:47:23.819 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/Waveguide_95af64adee4aa35b.npz.
2026-02-24 13:47:23.821 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/Waveguide_b761faec55b3100f.npz.
2026-02-24 13:47:23.822 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/Waveguide_26812fc5c4788dc0.npz.

Text(0.5, 1.0, 'Effective index sweep')

../_images/7856a5d8989a61cb6be7185468863e85cf5653b433ecb9254be62acd12b115f3.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
wavelength = 1.55
wg_width = 0.5
core_thickness = 0.22

strip = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=wg_width,
    slab_thickness=0.0,
    core_material="si",
    clad_material="sio2",
    core_thickness=core_thickness,
    num_modes=4,
    group_index_step=10 * nm,
)
print(strip.n_group)
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
13:47:27 UTC WARNING: Mode field at frequency index 0, mode index 3 does not    
             decay at the plane boundaries.                                     
             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.                                     
2026-02-24 13:47:27.957 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_3b006d8abd15cf66.npz.
[4.17803969 4.08299706 2.71577378 1.50333028]

Bend modes#

You can compute bend modes specifying the bend radius.

strip_bend = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=wg_width,
    core_thickness=core_thickness,
    slab_thickness=0.0,
    bend_radius=4,
    core_material="si",
    clad_material="sio2",
)
strip_bend.plot_field(field_name="Ex", mode_index=0)  # TE
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
13:47:28 UTC WARNING: Mode field at frequency index 0, mode index 1 does not    
             decay at the plane boundaries.                                     
2026-02-24 13:47:28.890 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_e06b3ae9eb1905e8.npz.

<matplotlib.collections.QuadMesh object at 0x7f56d16198e0>

../_images/a6d517c0d1b5aa7d7ce8c83cfd65dedf3f22d7a9750f89dde830fd9a5e8404b7.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=wavelength,
    core_width=wg_width,
    core_thickness=core_thickness,
    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)")
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))

Text(0, 0.5, 'Mismatch (dB)')

../_images/eb3f0d884c0397774dcad9431affb89827f652dfd93eca98302e9ff2cc075421.png
dB_cm = 2  # dB/cm
length = 2 * np.pi * radii * 1e-6
propagation_loss = dB_cm * length * 1e2
print(f"Propagation loss for 2πR bend: {propagation_loss} dB")

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()
Propagation loss for 2πR bend: [0.00502655 0.00628319 0.00753982] dB

<matplotlib.legend.Legend object at 0x7f56d180d9a0>

../_images/e7e2080532fdb1f21d2994f751c7fb0f63d89f4756ea5d90f02d1a03ad3e06b6.png
rib = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=wg_width,
    core_thickness=core_thickness,
    slab_thickness=slab_thickness_rib,
    bend_radius=15,
    core_material="si",
    clad_material="sio2",
)
rib.plot_field(field_name="Ex", mode_index=0)  # TE
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
13:47:32 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.                                     
2026-02-24 13:47:32.928 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_f6b2c4d2ac384859.npz.

<matplotlib.collections.QuadMesh object at 0x7f56d19f6d50>

../_images/cf0c9cc456256f4649b2d36c7291a98a28b05818b3752aef2b57a02b3e0b22fb.png
nitride_bend = gt.modes.Waveguide(
    wavelength=1.55,
    core_width=1000 * nm,
    core_thickness=nitride_thickness,
    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
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:34.092 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/Waveguide_46f4dee205839a19.npz.

<matplotlib.collections.QuadMesh object at 0x7f56d1e54cb0>

../_images/52effdefe7f4d23ffb3459356f563573c90cd3d495dc7b0dab61662ebbf48ead.png
radii = np.array([30, 35, 40])
bend = gt.modes.Waveguide(
    wavelength=wavelength,
    core_width=1000 * nm,
    core_thickness=nitride_thickness,
    core_material="sin",
    clad_material="sio2",
    num_modes=1,
    bend_radius=radii.min(),
)
mismatch = gt.modes.sweep_bend_mismatch(bend, radii)
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
dB_cm = 2  # dB/cm
length = 2 * np.pi * radii * 1e-6
propagation_loss = dB_cm * length * 1e2
print(f"propagation_loss for 2PI degree bend = {propagation_loss} dB")

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()
propagation_loss for 2PI degree bend = [0.03769911 0.0439823  0.05026548] dB

<matplotlib.legend.Legend object at 0x7f56d429c980>

../_images/cec732c025860b88e5e8fa50a7ace10079c859f547abafb78f5e0e77fb7556fe.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


gap = 200 * nm

c = gt.modes.WaveguideCoupler(
    wavelength=wavelength,
    core_width=(wg_width, wg_width),
    gap=gap,
    core_thickness=core_thickness,
    slab_thickness=slab_thickness,
    core_material="si",
    clad_material="sio2",
)
c.plot_index()

<matplotlib.collections.QuadMesh object at 0x7f56d0256bd0>

../_images/e23822e50a3f73dc8cad90380e2564d982c374f7dbdf4073719f8ecdc04782cd.png
c.plot_field(field_name="Ex", mode_index=0)  # TE
2026-02-24 13:47:38.259 | INFO     | gplugins.tidy3d.modes:_data:266 - load data from /home/runner/.gdsfactory/modes/WaveguideCoupler_46b65ee011b0d3fd.npz.

<matplotlib.collections.QuadMesh object at 0x7f56d1f1ebd0>

../_images/088d8a290bb6fb1594a7a32bcd41a13b5c28cf514c8b854e21659db0775fb549.png
c.plot_field(field_name="Ex", mode_index=1)  # TE

<matplotlib.collections.QuadMesh object at 0x7f56d1fe5970>

../_images/f300ffa1e88c7288bb1202142bd203c55d12980b91e0e4d66c20bebb05ad734f.png
coupler = gt.modes.WaveguideCoupler(
    wavelength=wavelength,
    core_width=(wg_width, wg_width),
    gap=gap,
    core_thickness=core_thickness,
    slab_thickness=slab_thickness,
    core_material="si",
    clad_material="sio2",
    num_modes=4,
)

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.5', '0.5'], 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', gap='0.2')
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:39.753 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_a8cb8556cc805cea.npz.
Effective indices: [2.51642926+4.72655552e-05j 2.49247523+4.48849401e-05j
 1.90917889+2.00702360e-04j 1.80953208+2.20839326e-04j]
Mode areas: [0.26817256 0.26019659 0.65752823 0.60130012]
Coupling length: [32.35363595  7.77746926]
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:40.808 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_6634ee6e8e35dd6c.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:41.835 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_2660348247350916.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:42.841 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_decaf6bf74de2000.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:43.906 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_450e283429860fb7.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:44.965 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_9c56c86799bba186.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:46.017 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_d024f2ff9017b073.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:47.028 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_5452e94ff4493334.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:48.083 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_5c9ca45dc914245c.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:49.167 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_97f8c3663797381c.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:50.279 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_d03f517d4d651769.npz.
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:14: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:27: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dxb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Nx, Nx)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:42: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyf = sp.csr_matrix(sp.diags([-1, 1], [0, 1], shape=(Ny, Ny)))
/home/runner/work/simulation-templates/simulation-templates/.venv/lib/python3.12/site-packages/tidy3d/components/mode/derivatives.py:55: FutureWarning: Input has data type int64, but the output has been cast to float64.  In the future, the output data type will match the input. To avoid this warning, set the `dtype` parameter to `None` to have the output dtype match the input, or set it to the desired output data type.
  dyb = sp.csr_matrix(sp.diags([1, -1], [0, -1], shape=(Ny, Ny)))
2026-02-24 13:47:51.389 | INFO     | gplugins.tidy3d.modes:_data:306 - store data into /home/runner/.gdsfactory/modes/WaveguideCoupler_c7aa2c57810d8b36.npz.

../_images/183a97103757cd75d65f2cced45c9344a7d5e2211aef7b276d7c8badd91fea54.png