tidy3d.plugins.smatrix.AbstractComponentModeler#

class AbstractComponentModeler[source]#

Bases: ABC, Tidy3dBaseModel

Tool for modeling devices and computing port parameters.

Parameters:
  • name (str =)

  • simulation (Simulation) – Simulation describing the device without any sources present.

  • ports (tuple[Union[Port, LumpedPort, CoaxialLumpedPort, WavePort, TerminalWavePort], …] = ()) – Collection of ports describing the scattering matrix elements. For each input mode, one simulation will be run with a modal source.

  • freqs (ArrayLike[dtype=float, ndim=1]) – [units = Hz]. Array or list of frequencies at which to compute port parameters.

  • remove_dc_component (bool = True) – Whether to remove the DC component in the Gaussian pulse spectrum. If True, the Gaussian pulse is modified at low frequencies to zero out the DC component, which is usually desirable so that the fields will decay. However, for broadband simulations, it may be better to have non-vanishing source power near zero frequency. Setting this to False results in an unmodified Gaussian pulse spectrum which can have a nonzero DC component.

  • run_only (Optional[tuple[Union[tuple[str, NonNegativeInt], str], ...]] = None) – Set of matrix indices that define the simulations to run. If None, simulations will be run for all indices in the scattering matrix. If a tuple is given, simulations will be run only for the given matrix indices.

  • element_mappings (tuple[tuple[Union[tuple[tuple[str, NonNegativeInt], tuple[str, NonNegativeInt]], tuple[str, str]], Union[tuple[tuple[str, NonNegativeInt], tuple[str, NonNegativeInt]], tuple[str, str]], complex], ...] = ()) – Tuple of S matrix element mappings, each described by a tuple of (input_element, output_element, coefficient), where the coefficient is the element_mapping coefficient describing the relationship between the input and output matrix element. If all elements of a given column of the scattering matrix are defined by element_mappings, the simulation corresponding to this column is skipped automatically.

  • custom_source_time (Optional[Union[GaussianPulse, ContinuousWave, CustomSourceTime, BroadbandPulse, BasebandStep, BasebandGaussianPulse, BasebandRectangularPulse, BasebandCustomSourceTime]] = None) – If provided, this will be used as specification of the source time-dependence in simulations. Otherwise, a default source time will be constructed.

Attributes

matrix_indices_monitor

Abstract property for all matrix indices that will be used to collect data.

matrix_indices_run_sim

Tuple of all the matrix indices that will be used to run simulations.

matrix_indices_source

Tuple of all the source matrix indices, which may be less than the total number of ports.

name

simulation

ports

freqs

remove_dc_component

run_only

element_mappings

custom_source_time

Methods

get_port_by_name(port_name)

Get the port from the name.

get_task_name(port[, mode_index, terminal_label])

Generates a standardized task name from a port object.

run([path_dir, folder_name, callback_url, ...])

unique_port_names(val, info)

make sure each element of val has a unique name (if specified).

validate_pre_upload()

Validate the modeler before upload.

name#
simulation#
ports#
freqs#
remove_dc_component#
run_only#
element_mappings#
custom_source_time#
static get_task_name(port, mode_index=None, terminal_label=None)[source]#

Generates a standardized task name from a port object.

This method creates a unique string identifier for a simulation task based on a port and, if applicable, a specified mode index.

Parameters:
  • port (PortType) – The port object from which to derive the base name.

  • mode_index (Optional[int], optional) – If provided, this index is appended to the port name (e.g., ‘port_1@1’). Defaults to None, in which case the first mode is chosen by default.

  • terminal_label (Optional[str], optional) – If provided, this label is appended to the port name (e.g., ‘port_1@terminal_1’). Defaults to None, in which case an error is raised if the port is a TerminalWavePort.

Returns:

The formatted task name string.

Return type:

str

Raises:

ValueError – If mode_index is specified for a lumped port.

get_port_by_name(port_name)[source]#

Get the port from the name.

abstract property matrix_indices_monitor#

Abstract property for all matrix indices that will be used to collect data.

property matrix_indices_source#

Tuple of all the source matrix indices, which may be less than the total number of ports.

property matrix_indices_run_sim#

Tuple of all the matrix indices that will be used to run simulations.

classmethod unique_port_names(val, info)#

make sure each element of val has a unique name (if specified).

run(path_dir='.', *, folder_name='default', callback_url=None, verbose=True, solver_version=None, pay_type='AUTO', priority=None, local_gradient=False, max_num_adjoint_per_fwd=None)[source]#
validate_pre_upload()[source]#

Validate the modeler before upload.