How do I run the mode solver locally?#
Date |
Category |
|---|---|
2023-12-18 17:27:21 |
Mode Solver |
You can run the local version of mode solver through the .solve() method. For example:
from tidy3d.plugins.mode import ModeSolver
# Build the mode solver.
freq0 = tidy3d.C_0 / 1.55
mode_solver = ModeSolver(
simulation=sim,
plane=plane,
mode_spec=mode_spec,
freqs=[freq0],
)
# Run the local mode solver.
mode_data = mode_solver.solve()
This means that the solver will run on your own computer and will not require any credits. By default, the local version does not include subpixel smoothing. However, if the tidy3d-extras package is installed (pip install “tidy3d[extras]”), local subpixel averaging is automatically enabled, significantly improving accuracy. You can control this with config.simulation.use_local_subpixel: set to True to force it on, False to force it off, or leave it as None (the default) to automatically enable it when tidy3d-extras is available. For more details on how to set up, run, and visualize the solver results, please refer to this notebook.