Thermally tuned waveguide#

In this example we use Tidy3Dā€™s heat solver to investigate tuning of a straight rectangular waveguide using a heating strip.

[1]:
import numpy as np
from matplotlib import pyplot as plt

import tidy3d as td
import tidy3d.web as web

Setup Simulation Scene#

The simulation setup consists of a silicon waveguide in a silicon dioxide cladding on top of a silicon wafer. The heating strip is placed in the cladding above the waveguide. Let us define basic geometric parameters of simulated structures.

[2]:
# in um

w_sim = 16  # simulation width
h_buffer = 1  # vertical simulation buffer

h_clad = 2.8  # thickness of cladding
h_box = 2  # thickness of buried oxide
h_wafer = 0.5  # wafer thickness

# waveguide parameters
w_core = 0.5
h_core = 0.22

# heater parameters
h_heater = 0.14
w_heater = 2
d_heater = 2  # distance between heater and waveguide

We will place the waferā€™s top surface at location \(z=0\). Let us define vertical locations of each structure. Note that we will model buried oxide and cladding as a single structure since they are made of the same material.

[3]:
z_wafer = -h_wafer / 2
z_core = h_box + h_core / 2
z_heater = h_box + h_core + d_heater + h_heater / 2

box_clad_max = h_box + h_clad
box_clad_min = (
    -h_wafer / 2
)  # make structures overlap to ensure no gaps due to numerical roundoff errors
h_box_clad = box_clad_max - box_clad_min
z_box_clad = (box_clad_max + box_clad_min) / 2

z_sim = (h_box + h_clad - h_wafer) / 2
h_sim = h_box + h_clad + h_wafer + 2 * h_buffer

Define optic and thermal properties of materials.

[4]:
Si_n = 3.4777  # Si refraction index
Si_n_slope = 1.86e-4  # Si thermo-optic coefficient dn/dT, 1/K
Si_k = 148e-12  # Si thermal conductivity, W / (um * K)
Si_s = 0.71 * 2.33e-12  # Si volumetric heat capacity, J / (um^3 * K)

SiO2_n = 1.444  # SiO2 refraction index
SiO2_n_slope = 1e-5  # SiO2 thermo-optic coefficient dn/dT, 1/K
SiO2_k = 1.38e-12  # SiO2 thermal conductivity, W/(um*K)
SiO2_s = 0.709 * 2.203e-12  # SiO2 volumetric heat capacity, J / (um^3 * K)

TiN_k = 28e-12  # TiN thermal conductivity W/(um*K)
TiN_s = 0.598 * 5240e-12  # TiN volumetric heat capacityJ / (um^3 * K)
TiN_sigma = 2.3e6  # Electric conductivity of TiN, S/m

Convert refraction indices into permittivity values.

[5]:
Si_eps = Si_n**2
Si_eps_slope = 2 * Si_n * Si_n_slope

SiO2_eps = SiO2_n**2
SiO2_eps_slope = 2 * SiO2_n * SiO2_n_slope

Create material classes containing relevant information for each medium. Note that we use class PerturbationMedium to specify sensitivity of optic properties to temperature and field heat_spec to specify thermal properties. Optic characteristics of the heating strip material is modeled as a perfect electric conductor.

[6]:
Si = td.PerturbationMedium(
    permittivity=Si_eps,
    permittivity_perturbation=td.ParameterPerturbation(
        heat=td.LinearHeatPerturbation(coeff=Si_eps_slope, temperature_ref=300)
    ),
    heat_spec=td.SolidSpec(
        conductivity=Si_k,
        capacity=Si_s,
    ),
    name="Si",
)

SiO2 = td.PerturbationMedium(
    permittivity=SiO2_eps,
    permittivity_perturbation=td.ParameterPerturbation(
        heat=td.LinearHeatPerturbation(coeff=SiO2_eps_slope, temperature_ref=300)
    ),
    heat_spec=td.SolidSpec(
        conductivity=SiO2_k,
        capacity=SiO2_s,
    ),
    name="SiO2",
)

TiN = td.PECMedium(
    heat_spec=td.SolidSpec(
        conductivity=TiN_k,
        capacity=TiN_s,
    ),
    name="TiN",
)

air = td.Medium(heat_spec=td.FluidSpec(), name="air")

Create structures representing waveguide, heater, cladding, and wafer.

[7]:
core = td.Structure(
    geometry=td.Box(center=(0, 0, z_core), size=(w_core, td.inf, h_core)),
    medium=Si,
)

heater = td.Structure(
    geometry=td.Box(center=(0, 0, z_heater), size=(w_heater, td.inf, h_heater)),
    medium=TiN,
    name="heater",
)

box_clad = td.Structure(
    geometry=td.Box(center=(0, 0, z_box_clad), size=(td.inf, td.inf, h_box_clad)),
    medium=SiO2,
)

wafer = td.Structure(
    geometry=td.Box(center=(0, 0, z_wafer), size=(td.inf, td.inf, h_wafer)),
    medium=Si,
    name="wafer",
)

Pack structures into a simulation scene.

[8]:
scene = td.Scene(
    medium=air,
    structures=[box_clad, core, heater, wafer],
)

Visual validation of the setup.

[9]:
scene.plot(
    y=0, hlim=[-w_sim / 2, w_sim / 2], vlim=[z_sim - h_sim / 2, z_sim + h_sim / 2]
)
plt.show()

../_images/notebooks_MetalHeaterPhaseShifter_17_0.png

Setup Heat Simulation#

We assume that the bottom of the wafer is maintained at temperature \(T=300\) K and ignore heat transfer at the cladding/air boundary. In this simulation setup these boundary conditions can be set using MediumMediumInterface placement. Note since no other boundary conditions are specified, the other sides of the simulation box will be treated as insulating boundary conditions.

Convective cooling/heating at the cladding/air boundary can be easily taken into account using ConvectionBC boundary conditions.

[10]:
bc_bottom = td.HeatBoundarySpec(
    placement=td.MediumMediumInterface(mediums=["Si", "air"]),
    condition=td.TemperatureBC(temperature=300),
)

bc_top = td.HeatBoundarySpec(
    placement=td.MediumMediumInterface(mediums=["SiO2", "air"]),
    condition=td.HeatFluxBC(flux=0),
)

Create a uniform heat source inside the heater structure equivalent to electrical current of \(7.3 \times 10^{-3}\) A.

[11]:
current = 7.4e-3  # A
heat_rate = (current / h_heater / w_heater) ** 2 / TiN_sigma  # convert into power
heater_source = td.UniformHeatSource(rate=heat_rate, structures=[heater.name])

We will measure temperature distribution in the entire cross section of the simulation setup. Note that in this example we request to return heat solver results on the original unstructured grid. Moreover, we request the monitor plane to be meshed conformally.

[12]:
temp_mnt = td.TemperatureMonitor(size=(td.inf, 0, td.inf), name="temperature", unstructured=True, conformal=True)

For spatial discretization we will use a distance-based meshing specifying that solid-solid material interfaces should be discretized with mesh size equal to the heater height h_heater divided by 3 and away from interfaces the grid should coarsen to four times of that size. Setting distance_interface to three of minimal mesh size will create approximately three layers of cells with the minimal size around interfaces. Cells outside of this region will have sizes according to linear relation dl_interface * (1 - ratio(d)) + dl_interface * ratio(d), where ratio(d) = (d - distance_interface) / (distance_bulk - distance_interface) and d is the distance to the closest material interface. We choose this transition to happen on the order of 2 * d_heater. We will also exclude using the higher mesh resolution around the wafer since that region is of less interest.

[13]:
# parameters for meshing
dl_min = h_heater / 3
dl_max = 4 * dl_min

grid_spec = td.DistanceUnstructuredGrid(
    dl_interface=dl_min,
    dl_bulk=dl_max,
    distance_interface=3 * dl_min,
    distance_bulk=2 * d_heater,
    non_refined_structures=["wafer"],  # do not refine near wafer
)

Pack components into a heat simulation specification. Note that from the heat transfer perspective the problem is symmetric around \(x=0\). Thus, we can set symmetry specification to (1, 0, 0) to reduce simulation size and cost.

Given that the problem is two-dimensional we will use a small simulation size along the invariant \(y\)-direction.

[14]:
heat_sim = td.HeatSimulation.from_scene(
    scene=scene,
    center=(0, 0, z_sim),
    size=(w_sim, dl_min, h_sim),
    boundary_spec=[bc_bottom, bc_top],
    sources=[heater_source],
    monitors=[temp_mnt],
    symmetry=(1, 0, 0),
    grid_spec=grid_spec,
)

[15]:
heat_sim.plot(y=0.01)
plt.show()

../_images/notebooks_MetalHeaterPhaseShifter_28_0.png

Mesh Inspection#

Before proceeding to submitting a parameter sweep batch we run one simulation and inspect its mesh and solution.

[16]:
job = web.Job(simulation=heat_sim, task_name="heat_sim_check_mesh")
heat_sim_data = job.run()

17:51:49 CST Created task 'heat_sim_check_mesh' with task_id
             'he-83e9de1d-7b1a-479f-b544-8ffd427fc359' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
17:51:50 CST Heat solver status: queued
17:51:54 CST Heat solver status: preprocess
17:52:21 CST Heat solver status: running
17:52:25 CST Heat solver status: postprocess
17:52:33 CST Heat solver status: success
17:52:34 CST loading simulation from simulation_data.hdf5

Since while setting up the temperature monitor we requested to return data on unstructured grid, we can plot the associated monitor data to visualize both the solver mesh and the solution.

[17]:
_, ax = plt.subplots(3, 1, figsize=(10, 10))

heat_sim.plot_structures_heat_conductivity(y=0, alpha=0.5, ax=ax[0])
heat_sim_data["temperature"].temperature.plot(ax=ax[0], field=False)
ax[0].set_xlim([-8, 8])

heat_sim_data["temperature"].temperature.plot(ax=ax[1], grid=False)
ax[1].set_xlim([-8, 8])

heat_sim_data["temperature"].temperature.plot(ax=ax[2])
ax[2].set_xlim([-8, 8])

plt.show()
../_images/notebooks_MetalHeaterPhaseShifter_32_0.png

Batch Processing of Heat Simulations#

Having ensured that the simulation mesh is suitable for this simulation setup, let us perform a sweep through several values of electric current in the heating strip. To do this we create a dictionary of simulations with different source definitions.

[18]:
currents = np.linspace(1e-10, 7.4e-3, 10)
heat_sims = {}

for ind, current in enumerate(currents):
    heat_rate = (current / h_heater / w_heater) ** 2 / TiN_sigma
    heater_source = td.UniformHeatSource(rate=heat_rate, structures=[heater.name])

    heat_sim_new = heat_sim.updated_copy(sources=[heater_source])
    heat_sims[f"heat_wg_current_{ind}"] = heat_sim_new

And submit this dictionary using Batch functionality.

[19]:
batch = web.Batch(simulations=heat_sims)

17:52:36 CST Created task 'heat_wg_current_0' with task_id
             'he-340a245b-4263-4e8a-badf-bc3cd5b68353' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
             Created task 'heat_wg_current_1' with task_id
             'he-83c3a534-98ee-49bc-aa6d-41c6cd33f2c3' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
17:52:37 CST Created task 'heat_wg_current_2' with task_id
             'he-15c043fa-383a-42ac-aa25-efea35b7356f' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
17:52:38 CST Created task 'heat_wg_current_3' with task_id
             'he-f6b5ed8f-5115-48fe-8b47-7af3c8a04c3a' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
             Created task 'heat_wg_current_4' with task_id
             'he-f049aff1-fbe6-4878-831d-98397e336448' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
17:52:39 CST Created task 'heat_wg_current_5' with task_id
             'he-cb4d8fae-289e-41e3-805f-02278f0aa7a8' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
17:52:40 CST Created task 'heat_wg_current_6' with task_id
             'he-e83b1887-4a9a-41f9-825e-cd7faad36543' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
17:52:41 CST Created task 'heat_wg_current_7' with task_id
             'he-f09905b0-271d-489b-bcc3-12bf127da4e9' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
17:52:42 CST Created task 'heat_wg_current_8' with task_id
             'he-123daf5e-5b7d-4303-96b5-8ec9efbd2f3f' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
             Created task 'heat_wg_current_9' with task_id
             'he-a5325c88-c8aa-47ac-9bcb-1fc888b3e078' and task_type 'HEAT'.
             Tidy3D's heat solver is currently in the beta stage. All heat
             simulations are charged a flat fee of 0.025 FlexCredit.
[20]:
batch_data = batch.run()

17:52:47 CST Started working on Batch.
17:52:50 CST Maximum FlexCredit cost: 0.250 for the whole batch.
             Use 'Batch.real_cost()' to get the billed FlexCredit cost after the
             Batch has completed.
17:54:06 CST Batch complete.

Visualize some of the simulation results.

[21]:
# max temperature value when plotting to enforce the same coloring
temp_max_plot = 340

fig, ax = plt.subplots(1, 3, figsize=(17, 2))

batch_data["heat_wg_current_1"].plot_field("temperature", ax=ax[0], vmax=temp_max_plot)
ax[0].set_title(f"Current I = {currents[1]:1.3} A")

batch_data["heat_wg_current_5"].plot_field("temperature", ax=ax[1], vmax=temp_max_plot)
ax[1].set_title(f"Current I = {currents[5]:1.3} A")

batch_data["heat_wg_current_9"].plot_field("temperature", ax=ax[2], vmax=temp_max_plot)
ax[2].set_title(f"Current I = {currents[9]:1.3} A")

plt.show()

17:54:09 CST loading simulation from
             ./he-83c3a534-98ee-49bc-aa6d-41c6cd33f2c3.hdf5
17:54:15 CST loading simulation from
             ./he-cb4d8fae-289e-41e3-805f-02278f0aa7a8.hdf5
17:54:17 CST loading simulation from
             ./he-a5325c88-c8aa-47ac-9bcb-1fc888b3e078.hdf5
../_images/notebooks_MetalHeaterPhaseShifter_39_12.png

Coupling to Optic Simulations#

Now let us create optic simulations where material properties are modified according to obtained temperature distributions. One can conveniently do that using method .perturbed_mediums_copy() of classes Scene and Simulation. We will use obtained optic simulations only to investigate waveguide modes, thus we are defining neither sources nor monitors, and only provide grid specification.

Recall that in this tutorial we chose to retrieve heat solver results on an unstructured grid. However, currently method .perturbed_mediums_copy() supports only Cartesian arrays SpatialDataArray. Thus, we need to interpolate the unstructured data array onto a suitable Cartesian grid. To this end, we first create an unperturbed optic simulation.

[22]:
wvl_um = 1.55
freq0 = td.C_0 / wvl_um

grid_spec = td.GridSpec.auto(min_steps_per_wvl=50, wavelength=wvl_um)

optic_sim = td.Simulation.from_scene(
    scene=scene,
    center=(0, 0, z_sim),
    size=(w_sim, dl_min, h_sim),
    run_time=1e-15,
    grid_spec=grid_spec,
)

Now we can use its grid as the target grid to interpolate the temperature fields to.

[23]:
target_grid = optic_sim.grid.boundaries
perturb_sims = []

for _, hs_data in batch_data.items():
    temp_interpolated = hs_data["temperature"].temperature.interp(x=target_grid.x, y=0, z=target_grid.z, fill_value=300)
    psim = optic_sim.perturbed_mediums_copy(temperature=temp_interpolated)
    perturb_sims.append(psim)

17:54:18 CST loading simulation from
             ./he-340a245b-4263-4e8a-badf-bc3cd5b68353.hdf5
             loading simulation from
             ./he-83c3a534-98ee-49bc-aa6d-41c6cd33f2c3.hdf5
17:54:20 CST loading simulation from
             ./he-15c043fa-383a-42ac-aa25-efea35b7356f.hdf5
17:54:21 CST loading simulation from
             ./he-f6b5ed8f-5115-48fe-8b47-7af3c8a04c3a.hdf5
17:54:27 CST loading simulation from
             ./he-f049aff1-fbe6-4878-831d-98397e336448.hdf5
             loading simulation from
             ./he-cb4d8fae-289e-41e3-805f-02278f0aa7a8.hdf5
17:54:29 CST loading simulation from
             ./he-e83b1887-4a9a-41f9-825e-cd7faad36543.hdf5
17:54:30 CST loading simulation from
             ./he-f09905b0-271d-489b-bcc3-12bf127da4e9.hdf5
17:54:35 CST loading simulation from
             ./he-123daf5e-5b7d-4303-96b5-8ec9efbd2f3f.hdf5
17:54:36 CST loading simulation from
             ./he-a5325c88-c8aa-47ac-9bcb-1fc888b3e078.hdf5

Define plane where waveguide modes will be calculated.

[24]:
mode_plane = td.Box(center=(0, 0, z_core), size=(4, 0, 3))

Visual inspection.

[25]:
fig, ax = plt.subplots(1, 1)
perturb_sims[0].plot(y=0, ax=ax)
mode_plane.plot(y=0, ax=ax, alpha=0.5)
plt.show()

../_images/notebooks_MetalHeaterPhaseShifter_48_0.png

We will use Tidy3Dā€™s mode solver plugin.

[26]:
from tidy3d.plugins.mode.web import run as run_mode
from tidy3d.plugins.mode import ModeSolver

Find only the first mode at the frequency corresponding to 1.55 um wavelength.

[27]:
mode_datas = []

for psim in perturb_sims:
    ms = ModeSolver(
        simulation=psim,
        plane=mode_plane,
        mode_spec=td.ModeSpec(num_modes=1, precision="double"),
        freqs=[freq0],
    )

    md = run_mode(ms)

    mode_datas.append(md)

             Mode solver created with
             task_id='fdve-4c513e3f-5760-47df-9260-16578ca30853',
             solver_id='mo-8627fd47-5d2e-4ecb-a00f-a8d0c3342584'.
17:54:45 CST Mode solver status: queued
17:54:56 CST Mode solver status: running
17:55:20 CST Mode solver status: success
17:55:23 CST Mode solver created with
             task_id='fdve-8283f855-901e-463f-8532-ba547c630849',
             solver_id='mo-6b3363c2-b090-4cfb-921f-967e5f5d0d7b'.
17:55:27 CST Mode solver status: queued
17:55:39 CST Mode solver status: running
17:55:58 CST Mode solver status: success
17:56:00 CST Mode solver created with
             task_id='fdve-337f720a-63a5-44fe-bfe8-6305b39d5985',
             solver_id='mo-74d48151-34a1-482b-8f49-685aa37742a8'.
17:56:04 CST Mode solver status: queued
17:56:16 CST Mode solver status: running
17:56:31 CST Mode solver status: success
17:56:34 CST Mode solver created with
             task_id='fdve-e5d47f8a-ce30-4dff-a956-c3a40808c7c9',
             solver_id='mo-73817dbd-008f-4873-88f2-d1f409bb7a66'.
17:56:37 CST Mode solver status: queued
17:56:47 CST Mode solver status: running
17:57:15 CST Mode solver status: success
17:57:18 CST Mode solver created with
             task_id='fdve-ef2d264b-b69f-4524-84d6-591ed2ce8a83',
             solver_id='mo-c786d3f1-3fc2-4dca-bab7-1b9733253413'.
17:57:22 CST Mode solver status: queued
17:57:32 CST Mode solver status: running
17:57:50 CST Mode solver status: success
17:57:53 CST Mode solver created with
             task_id='fdve-95ed5801-897a-41f2-88fb-0a4c89dfb385',
             solver_id='mo-2acd140d-b938-48f1-b3bc-7bbd0db12731'.
17:57:56 CST Mode solver status: queued
17:58:07 CST Mode solver status: running
17:58:26 CST Mode solver status: success
17:58:29 CST Mode solver created with
             task_id='fdve-a063f26e-75b0-4823-a6fd-a0d2dfc2590e',
             solver_id='mo-f5c2a63c-5691-492e-a62a-b61e6ad00fba'.
17:58:33 CST Mode solver status: queued
17:58:45 CST Mode solver status: running
17:59:11 CST Mode solver status: success
17:59:13 CST Mode solver created with
             task_id='fdve-42b0d92e-99ea-40a9-967a-eec390dba89f',
             solver_id='mo-19b577a4-043d-4943-a694-98c8b4706637'.
17:59:17 CST Mode solver status: queued
17:59:28 CST Mode solver status: running
17:59:44 CST Mode solver status: success
17:59:47 CST Mode solver created with
             task_id='fdve-18a64443-5bff-4fe8-9872-a375ce7ee7e9',
             solver_id='mo-c1de5169-6871-4858-a48c-7469ee9e2879'.
17:59:50 CST Mode solver status: queued
18:00:02 CST Mode solver status: running
18:00:19 CST Mode solver status: success
18:00:24 CST Mode solver created with
             task_id='fdve-1fc81b80-0d70-4c4c-96b7-377012c57ba9',
             solver_id='mo-fcfe4885-90cd-423d-be7c-067d664d4123'.
18:00:30 CST Mode solver status: queued
18:00:44 CST Mode solver status: running
18:01:02 CST Mode solver status: success

Extract found propagation indices into a single array.

[28]:
n_eff = np.array([md.n_eff.isel(f=0, mode_index=0) for md in mode_datas])

We will compare to results obtained using different thermal and mode solvers.

[29]:
currents_ref = np.linspace(0.0, 7.4e-3, 10)
neff_ref = [
    2.4401133396065293,
    2.440149458129956,
    2.440257814666438,
    2.4404384121136413,
    2.4406912552977094,
    2.441016350968344,
    2.441413707791896,
    2.4418833363425283,
    2.4424252490914293,
    2.443039460394046,
]

The absolute values of propagation indices are quite sensitive to the type of solver used and parameters of mode solver solution domain. Thus, we compare changes to the propagation indices rather then their absolute values.

[30]:
print(f"Phase shift over 320um: {2 * np.pi / 1.55 * (n_eff[-1] - n_eff[0]) * 320}")
print(
    f"Phase shift over 320um (ref): {2 * np.pi / 1.55 * (neff_ref[-1] - neff_ref[0]) * 320}"
)
plt.plot(currents * 1e3, n_eff[:] - n_eff[0], "o:")
plt.plot(currents_ref * 1e3, np.array(neff_ref) - neff_ref[0])
plt.xlabel("Current / mA")
plt.ylabel("Change in effective refractive index $n_{eff}$")
plt.legend(["tidy3d", "reference"])
plt.show()

Phase shift over 320um: 3.8078801814836627
Phase shift over 320um (ref): 3.795687048084378
../_images/notebooks_MetalHeaterPhaseShifter_58_1.png
[ ]: