Simulation.set_mode(source, mode_ind, Nmodes=None, target_neff=None, pml_layers=(0, 0), bend_radius=None, bend_axis=None)

Set the index of the mode to be used by the mode source. To choose which mode to set use compute_modes() and viz_modes(). If provided as input, Nmodes number of modes with effective index closest to target_neff are computed, and the mode with index mode_ind is used. Otherwise, the modes are simply computed in order of decreasing effective index.

  • source (ModeSource) – A mode source in the simulation.

  • mode_ind (int) – Index of the mode to use.

  • Nmodes (None or int, optional) – Number of modes to compute, usually only necessary if target_neff is also provided.

  • target_neff (None or float, optional) – Look for modes with effective index closest to target_neff.

  • pml_layers (tuple, optional) – Number of PML layers to be added in each direction. These are added to the interior of the mode plane, i.e. the mode plane size is not extended. The default boundaries are PEC.

  • bend_radius (float or None, optional) – A curvature radius for simulation of waveguide bends.

  • bend_axis ('x', 'y', 'z' or None, optional) – The axis normal to the plane in which the bend lies. This must be provided if bend_radius is not None, and it must be orthogonal to the axis normal to the mode plane.