tidy3d.plugins.smatrix.WavePort#

class WavePort[source]#

Bases: AbstractTerminalPort, Box

Class representing a single wave port

Parameters:
  • attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, attrs are mutable. For example, the following is allowed for setting an attr obj.attrs['foo'] = bar. Also note that Tidy3D will raise a TypeError if attrs contain objects that can not be serialized. One can check if attrs are serializable by calling obj.json().

  • center (Union[tuple[Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box]], Box] = (0.0, 0.0, 0.0)) – [units = um]. Center of object in x, y, and z.

  • size (Union[tuple[Union[pydantic.v1.types.NonNegativeFloat, autograd.tracer.Box], Union[pydantic.v1.types.NonNegativeFloat, autograd.tracer.Box], Union[pydantic.v1.types.NonNegativeFloat, autograd.tracer.Box]], Box]) – [units = um]. Size in x, y, and z directions.

  • name (ConstrainedStrValue) – Unique name for the port.

  • direction (Literal['+', '-']) – ‘+’ or ‘-’, defining which direction is considered ‘input’.

  • mode_spec (MicrowaveModeSpec = MicrowaveModeSpec(attrs={}, type='MicrowaveModeSpec', num_modes=1, target_neff=None, num_pml=(0,, 0), filter_pol=None, angle_theta=0.0, angle_phi=0.0, precision='double', bend_radius=None, bend_axis=None, angle_rotation=False, track_freq=None, group_index_step=False, sort_spec=ModeSortSpec(attrs={},, filter_key=None,, filter_reference=0.0,, filter_order='over',, sort_key=None,, sort_reference=None,, sort_order='ascending',, track_freq='central',, type='ModeSortSpec'), impedance_specs=AutoImpedanceSpec(attrs={},, type='AutoImpedanceSpec'))) – Parameters to feed to mode solver which determine modes and how transmission line quantities, e.g., charateristic impedance, are computed.

  • num_grid_cells (Optional[ConstrainedIntValue] = 5) – Number of mesh grid cells in the transverse plane of the WavePort. Used in generating the suggested list of MeshOverrideStructure objects. Must be greater than or equal to 3. When set to None, no grid refinement is performed.

  • conjugated_dot_product (bool = False) – Use conjugated or non-conjugated dot product for mode decomposition.

  • frame (Optional[PECFrame] = PECFrame(attrs={}, length=2, type='PECFrame')) – Add a thin frame around the source during FDTD run for an improved injection.

  • absorber (Union[bool, ABCBoundary, ModeABCBoundary] = True) – Place a mode absorber in the port. If True, an automatically generated mode absorber is placed in the port. If ABCBoundary or ModeABCBoundary, a mode absorber is placed in the port with the specified boundary conditions.

  • extrude_structures (bool = False) – Extrudes structures that intersect the wave port plane by a few grid cells when True, improving mode injection accuracy.

  • mode_index (Optional[NonNegativeInt] = None) – Index into the collection of modes returned by mode solver. Specifies which mode to inject using this port. Deprecated. Use the ‘mode_selection’ field instead.

  • mode_selection (Optional[Tuple[int, ...]] = None) – Selects specific mode(s) to use from the mode solver. Can be a single integer for one mode, or a tuple of integers for multiple modes. If None (default), all modes from the mode_spec are used. Indices must be non-negative and less than mode_spec.num_modes.

Attributes

injection_axis

Injection axis of the port.

transverse_axes

Transverse axes of the port.

attrs

Methods

compute_current(sim_data)

Helper to compute current flowing through the port.

compute_voltage(sim_data)

Helper to compute voltage across the port.

get_port_impedance(sim_mode_data, mode_index)

Retrieve the characteristic impedance of the port for a specific mode.

to_absorber([snap_center, freq_spec])

Create an internal absorber from the wave port.

to_mesh_overrides()

Creates a list of MeshOverrideStructure for mesh refinement in the transverse plane of the port.

to_mode_solver(simulation, freqs)

Helper to create a ModeSolver instance.

to_monitors(freqs[, snap_center, grid])

The wave port uses a MicrowaveModeMonitor to compute the characteristic impedance and the port voltages and currents.

to_source(source_time[, snap_center, mode_index])

Create a mode source from the wave port.

Inherited Common Usage

direction#
mode_spec#
num_grid_cells#
conjugated_dot_product#
frame#
absorber#
extrude_structures#
mode_index#
mode_selection#
property injection_axis#

Injection axis of the port.

property transverse_axes#

Transverse axes of the port.

to_source(source_time, snap_center=None, mode_index=0)[source]#

Create a mode source from the wave port.

to_monitors(freqs, snap_center=None, grid=None)[source]#

The wave port uses a MicrowaveModeMonitor to compute the characteristic impedance and the port voltages and currents.

to_mode_solver(simulation, freqs)[source]#

Helper to create a ModeSolver instance.

to_absorber(snap_center=None, freq_spec=None)[source]#

Create an internal absorber from the wave port.

compute_voltage(sim_data)[source]#

Helper to compute voltage across the port.

compute_current(sim_data)[source]#

Helper to compute current flowing through the port.

get_port_impedance(sim_mode_data, mode_index)[source]#

Retrieve the characteristic impedance of the port for a specific mode.

The port impedance is computed from the transmission line mode characteristics, which should ideally be TEM (Transverse Electromagnetic) or at least quasi-TEM. The impedance is extracted from the transmission line data computed by the mode solver.

Parameters:
  • sim_mode_data (Union[SimulationData, MicrowaveModeData]) – Simulation data containing the mode monitor results, or the mode data directly. If SimulationData is provided, the mode data is extracted using the port’s mode monitor name.

  • mode_index (int) – Index of the mode for which to compute the impedance. This selects a specific mode from the mode spectrum computed by the mode solver.

Returns:

Frequency-dependent characteristic impedance Z0 for the specified mode. The impedance is complex-valued and varies with frequency.

Return type:

FreqModeDataArray

to_mesh_overrides()[source]#

Creates a list of MeshOverrideStructure for mesh refinement in the transverse plane of the port. The mode source requires at least 3 grid cells in the transverse dimensions, so these mesh overrides will be added to the simulation to ensure that this requirement is satisfied.

__hash__()#

Hash method.