tidy3d.plugins.smatrix.TerminalComponentModeler#
- class TerminalComponentModeler[source]#
Bases:
AbstractComponentModeler
[str
,tuple
[str
,str
]]Tool for modeling two-terminal multiport devices and computing port parameters with lumped and wave ports.
- 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 anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.json()
.name (str =) β simulation : Simulation Simulation describing the device without any sources present.
ports (Tuple[Union[LumpedPort, CoaxialLumpedPort, WavePort], ...] = ()) β Collection of lumped and wave ports associated with the network. For each port, one simulation will be run with a source that is associated with the port.
freqs (Union[tuple[float, ...], 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 toFalse
results in an unmodified Gaussian pulse spectrum which can have a nonzero DC component.run_only (Optional[Tuple[IndexType, ...]] = 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[~ElementType, ~ElementType, Union[tidy3d.components.types.base.tidycomplex, tidy3d.components.types.base.ComplexNumber]], ...] = ()) β 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.radiation_monitors (Tuple[DirectivityMonitor, ...] = ()) β Facilitates the calculation of figures-of-merit for antennas. These monitor will be included in every simulation and record the radiated fields.
assume_ideal_excitation (bool = False) β If
True
, only the excited port is assumed to have a nonzero incident wave amplitude power. This choice simplifies the calculation of the scattering matrix. IfFalse
, every entry in the vector of incident wave amplitudes (a) is calculated explicitly. This choice requires a matrix inversion when calculating the scattering matrix, but may lead to more accurate scattering parameters when there are reflections from simulation boundaries.s_param_def (Literal['pseudo', 'power'] = pseudo) β Whether to compute scattering parameters using the βpseudoβ or βpowerβ wave definitions.
Notes
References
Attributes
The base simulation with all grid refinement options, port loads (if present), and monitors added, which is only missing the source excitations.
Tuple of all the possible matrix indices.
Dictionary associating each unique
NetworkIndex
to a port and mode index.Generate all the
Simulation
objects for the port parameter calculation.ports
Methods
get_radiation_monitor_by_name
(monitor_name)Find and return a
DirectivityMonitor
monitor by its name.network_index
(port[,Β mode_index])Converts the port, and a
mode_index
when the port is aWavePort
, to a unique string specifier.plot_sim
([x,Β y,Β z,Β ax])Plot a
Simulation
with all sources and absorbers.plot_sim_eps
([x,Β y,Β z,Β ax])Plot permittivity of the
Simulation
.Inherited Common Usage
- ports#
- radiation_monitors#
- assume_ideal_excitation#
- s_param_def#
- plot_sim(x=None, y=None, z=None, ax=None, **kwargs)[source]#
Plot a
Simulation
with all sources and absorbers.This is a convenience method to visualize the simulation setup for troubleshooting. It shows all sources and absorbers for each port.
- Parameters:
x (float, optional) β x-coordinate for the cross-section.
y (float, optional) β y-coordinate for the cross-section.
z (float, optional) β z-coordinate for the cross-section.
ax (matplotlib.axes.Axes, optional) β Axes to plot on.
**kwargs β Keyword arguments passed to
Simulation.plot()
.
- Returns:
The axes with the plot.
- Return type:
matplotlib.axes.Axes
- plot_sim_eps(x=None, y=None, z=None, ax=None, **kwargs)[source]#
Plot permittivity of the
Simulation
.This method shows the permittivity distribution of the simulation with all sources and absorbers added for each port.
- Parameters:
x (float, optional) β x-coordinate for the cross-section.
y (float, optional) β y-coordinate for the cross-section.
z (float, optional) β z-coordinate for the cross-section.
ax (matplotlib.axes.Axes, optional) β Axes to plot on.
**kwargs β Keyword arguments passed to
Simulation.plot_eps()
.
- Returns:
The axes with the plot.
- Return type:
matplotlib.axes.Axes
- static network_index(port, mode_index=None)[source]#
Converts the port, and a
mode_index
when the port is aWavePort
, to a unique string specifier.- Parameters:
port (
TerminalPortType
) β The port to convert to an index.mode_index (Optional[int]) β Selects a single mode from those supported by the
port
, which is only used when theport
is aWavePort
- Returns:
A unique string that is used to identify the row/column of the scattering matrix.
- Return type:
NetworkIndex
- property network_dict#
Dictionary associating each unique
NetworkIndex
to a port and mode index.
- property matrix_indices_monitor#
Tuple of all the possible matrix indices.
- property sim_dict#
Generate all the
Simulation
objects for the port parameter calculation.
- property base_sim#
The base simulation with all grid refinement options, port loads (if present), and monitors added, which is only missing the source excitations.
- get_radiation_monitor_by_name(monitor_name)[source]#
Find and return a
DirectivityMonitor
monitor by its name.- Parameters:
monitor_name (str) β Name of the monitor to find.
- Returns:
The monitor matching the given name.
- Return type:
- Raises:
Tidy3dKeyError β If no monitor with the given name exists.
- __hash__()#
Hash method.