fdtdx.compute_mode#
- fdtdx.compute_mode(frequency, inv_permittivities, inv_permeabilities, resolution=None, direction='+', mode_index=0, filter_pol=None, dtype=<class 'jax.numpy.float32'>, bend_radius=None, bend_axis=None, transverse_coords=None)[source]#
Compute optical modes of a waveguide cross-section.
This function uses the Tidy3D mode solver to compute the optical modes of a given waveguide cross-section defined by its permittivity distribution.
By default modes are sorted by their effective index. The mode_index argument indexes this sorted list of modes and returns the desired mode. With filter_pol, it is also possible to only index a specific polarization.
- Parameters:
frequency (float) – Operating frequency in Hz
inv_permittivities (jax.Array) – 3D array of inverse relative permittivity values
inv_permeabilities (jax.Array | float) – 3D array of inverse relative permittivity values or single float for uniform permeability distribution.
resolution (float | None) – Uniform-grid spacing in metres. Required when
transverse_coordsis not provided (uniform-grid path). Ignored whentransverse_coordsis given. Defaults to None.direction (Literal["+", "-"]) – Propagation direction, either “+” or “-“.
mode_index (int, optional) – Index of the mode to compute. Defaults to 0.
filter_pol (Literal["te", "tm"] | None, optional)
dtype (jnp.dtype, optional) – Float dtype of the simulation. Controls whether mode fields are returned as complex64 (float32) or complex128 (float64). Defaults to jnp.float32.
bend_radius (float | None, optional) – Bend radius of the waveguide in meters. Must be set together with bend_axis. When set, the mode solver uses a conformal transformation to account for the bend. Defaults to None (straight waveguide).
bend_axis (int | None, optional) – Physical axis index (0/1/2) pointing from the waveguide toward the center of curvature. Must differ from the propagation axis. Required when bend_radius is set. Defaults to None.
transverse_coords (
Optional[Sequence[Array]]) – Optional pair of physical edge-coordinate arrays, in metres, for the two axes transverse to propagation. Each array must have one more entry than the corresponding transverse cell count. When provided, the Tidy3D mode solver receives the non-uniform rectilinear grid directly. JAX arrays are accepted; the numpy conversion happens inside the tidy3d callback so the function remains compatible withjax.jit.
- Returns:
Tuple of E, H field and the effective index as complex-valued jax arrays.
- Return type:
Tuple[jax.Array, jax.Array, jax.Array]