Skip to content

flex_rf.tidy3d.ModeSolver

Type: class Base(s): Tidy3dBaseModel

Interface for solving electromagnetic eigenmodes in a 2D plane with translational invariance in the third dimension.

simulation [MODE_SIMULATION_TYPE]

Simulation or EMESimulation defining all structures and mediums.

plane [MODE_PLANE_TYPE]

Cross-sectional plane in which the mode will be computed.

mode_spec [ModeSpecType]

Container with specifications about the modes to be solved for.

freqs [FreqArray]

A list of frequencies at which to solve.

direction [Direction] = '+'

Direction of waveguide mode propagation along the axis defined by its normal dimension.

colocate [bool] = True

Toggle whether fields should be colocated to grid cell boundaries (i.e. primal grid nodes). Default is True.

use_colocated_integration [bool] = True

Only takes effect when colocate=False. If True, dot products and overlap integrals still use fields interpolated to grid cell boundaries (colocated), even though the field data is stored at native Yee grid positions. Experimental feature that can give improved accuracy by avoiding interpolation of fields to Yee cell positions for integration.

conjugated_dot_product [bool] = True

Use conjugated or non-conjugated dot product for mode decomposition.

fields [tuple[EMField, ...]] = ['Ex', 'Ey', 'Ez', 'Hx', 'Hy', 'Hz']

Collection of field components to store in the monitor. Note that some methods like flux, dot require all tangential field components, while others like mode_area require all E-field components.

as_fdtd_mode_solver()

Construct a new ModeSolver by converting simulation from a EMESimulation to an FDTD Simulation. Only used as a workaround until EMESimulation is natively supported in the ModeSolver webapi.

bend_axis_3d()

Converts the 2D bend axis into its corresponding 3D axis for a bend structure. For a straight waveguide, the rotated axis is equivalent to the bend axis and can be determined using angle_phi.

bend_center()

Computes the bend center based on plane center, angle_theta and angle_phi.

data()

ModeSolverData containing the field and effective index data.

data_raw()

ModeSolverData containing the field and effective index on unexpanded grid.

grid_snapped()

The output grid snapped to the plane normal and to simulation 0-sized dims if any.

is_plane(val: MODE_PLANE_TYPE)

Raise validation error if not planar.

normal_axis()

Axis normal to the mode plane.

normal_axis_2d()

Axis normal to the mode plane in a 2D plane that is normal to the bend_axis_3d.

plane_center_tangential(plane: MODE_PLANE_TYPE)

Mode lane center in the tangential axes.

plane_in_sim_bounds()

Check that the plane is at least partially inside the simulation bounds.

plot(ax: Ax = None, hlim: tuple[float, float] | None = None, vlim: tuple[float, float] | None = None, fill_structures: bool = True, **patch_kwargs: Any)

Plot the mode plane simulation’s components.

plot_3d(width: int = 800, height: int = 800)

Render 3D plot of ModeSolver (in jupyter notebook only). Parameters ---------- width : float = 800 width of the 3d view dom’s size height : float = 800 height of the 3d view dom’s size

plot_eps(freq: float | None = None, alpha: float | None = None, ax: Ax = None)

Plot the mode plane simulation’s components. The permittivity is plotted in grayscale based on its value at the specified frequency.

plot_field(field_name: str, val: Literal['real', 'imag', 'abs'] = 'real', scale: PlotScale = 'lin', eps_alpha: float = 0.2, robust: bool = True, vmin: float | None = None, vmax: float | None = None, ax: Ax = None, cmap: str | Colormap | None = None, **sel_kwargs: Any)

Plot the field for a ModeSolverData with Simulation plot overlaid.

plot_field_components(field_names: str | tuple[str, ...], mode_indices: int | tuple[int, ...] | None = None, val: Literal['real', 'imag', 'abs'] = 'real', scale: PlotScale = 'lin', eps_alpha: float = 0.2, robust: bool = True, vmin: float | None = None, vmax: float | None = None, ax: Any = None, cmap: str | Colormap | None = None, figsize: tuple[float, float] | None = None, titles: bool = True, show_n_eff: bool = False, **sel_kwargs: Any)

Plot multiple field components for one or more modes in a single call.

plot_grid(ax: Ax = None, **kwargs: Any)

Plot the mode plane cell boundaries as lines.

plot_pml(ax: Ax = None)

Plot the mode plane absorbing boundaries.

plot_structures_eps(freq: float | None = None, alpha: float | None = None, cbar: bool = True, reverse: bool = False, ax: Ax = None)

Plot the mode plane simulation’s components. The permittivity is plotted in grayscale based on its value at the specified frequency.

reduced_simulation_copy()

Strip objects not used by the mode solver from simulation object. This might significantly reduce upload time in the presence of custom mediums.

rotated_bend_center()

Calculate the center at the rotated bend such that the modal plane is normal to the azimuthal direction of the bend.

rotated_mode_solver_data()
rotated_structures_copy()

Create a copy of the original ModeSolver with rotated structures to the simulation and updates the ModeSpec to disable bend correction and reset angles to normal.

sim_data()

SimulationData object containing the ModeSolverData for this object.

sim_with_mode_solver_monitor(name: str)

Creates Simulation from a ModeSolver. Creates a copy of the ModeSolver’s original simulation with a mode solver monitor added corresponding to the ModeSolver parameters.

sim_with_monitor(freqs: list[float] | None = None, name: str | None = None)

Creates Simulation from a ModeSolver. Creates a copy of the ModeSolver’s original simulation with a mode monitor added corresponding to the ModeSolver parameters.

sim_with_source(source_time: SourceTime, direction: Direction = None, mode_index: NonNegativeInt = 0)

Creates Simulation from a ModeSolver. Creates a copy of the ModeSolver’s original simulation with a ModeSource added corresponding to the ModeSolver parameters.

solve()

ModeSolverData containing the field and effective index data.

solver_symmetry()

Get symmetry for solver for propagation along self.normal axis.

theta_reference()

Computes the azimutal angle of the reference modal plane.

to_fdtd_mode_solver()

Construct a new ModeSolver by converting simulation from a EMESimulation to an FDTD Simulation. Only used as a workaround until EMESimulation is natively supported in the ModeSolver webapi.

to_mode_solver_monitor(name: str, colocate: bool | None = None, mode_spec: ModeSpec | None = None, freqs: list[float] | None = None)

Creates ModeSolverMonitor from a ModeSolver instance.

to_monitor(freqs: list[float] | None = None, name: str | None = None)

Creates ModeMonitor from a ModeSolver instance plus additional specifications.

to_source(source_time: SourceTime, direction: Direction = None, mode_index: NonNegativeInt = 0, num_freqs: PositiveInt = 1, **kwargs: Any)

Creates ModeSource from a ModeSolver instance plus additional specifications.

validate_pre_upload()

Validate the fully initialized mode solver is ok for upload to our servers.