tidy3d.plugins.smatrix.TerminalComponentModeler#
- class TerminalComponentModeler[source]#
Bases:
AbstractComponentModeler
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()
.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.folder_name (str = default) – Name of the folder for the tasks on web.
verbose (bool = False) – Whether the
AbstractComponentModeler
should print status and progressbars.callback_url (Optional[str] = None) – Http PUT url to receive simulation finish event. The body content is a json file with fields
{'id', 'status', 'name', 'workUnit', 'solverVersion'}
.path_dir (str = .) – Base directory where data and batch will be downloaded.
solver_version (Optional[str] = None) – batch_cached : Optional[Batch] = None Optional field to specify
batch
. Only used as a workaround internally so thatbatch
is written when.to_file()
and then the proper batch is loaded from.from_file()
. We recommend leaving unset as setting this field along with fields that were not used to create the task will cause errors.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.
Attributes
The reference impedance used at each port for definining power wave amplitudes.
Generate all the
Simulation
objects for the port parameter calculation.ports
Methods
ab_to_s
(a_matrix, b_matrix)Get the scattering matrix given the power wave matrices.
compute_port_VI
(port_out, sim_data)Compute the port voltages and currents.
compute_power_delivered_by_port
(port, sim_data)Compute the power delivered to the network by a lumped port.
compute_power_wave_amplitudes
(port, sim_data)Compute the incident and reflected power wave amplitudes at a lumped port.
Compute the incident and reflected power wave amplitudes at each port.
get_antenna_metrics_data
([port_amplitudes, ...])Calculate antenna parameters using superposition of fields from multiple port excitations.
get_radiation_monitor_by_name
(monitor_name)Find and return a
DirectivityMonitor
monitor by its name.plot_sim
([x, y, z, ax])Plot a
Simulation
with all sources added for each port, for troubleshooting.plot_sim_eps
([x, y, z, ax])Plot permittivity of the
Simulation
with all sources added for each port.s_to_z
(s_matrix, reference)Get the impedance matrix given the scattering matrix and a reference impedance.
Inherited Common Usage
- ports#
- radiation_monitors#
- plot_sim(x=None, y=None, z=None, ax=None, **kwargs)[source]#
Plot a
Simulation
with all sources added for each port, for troubleshooting.
- plot_sim_eps(x=None, y=None, z=None, ax=None, **kwargs)[source]#
Plot permittivity of the
Simulation
with all sources added for each port.
- property sim_dict#
Generate all the
Simulation
objects for the port parameter calculation.
- compute_power_wave_amplitudes_at_each_port(port_reference_impedances, sim_data)[source]#
Compute the incident and reflected power wave amplitudes at each port. The computed amplitudes have not been normalized.
- Parameters:
port_reference_impedances (
PortDataArray
) – Reference impedance at each port.sim_data (
SimulationData
) – Results from the simulation.
- Returns:
Incident (a) and reflected (b) power wave amplitudes at each port.
- Return type:
tuple[
PortDataArray
,PortDataArray
]
- static compute_port_VI(port_out, sim_data)[source]#
Compute the port voltages and currents.
- Parameters:
port_out (
TerminalPortType
) – Port for computing voltage and current.sim_data (
SimulationData
) – Results from simulation containing field data.
- Returns:
Voltage and current values at the port as frequency arrays.
- Return type:
tuple[FreqDataArray, FreqDataArray]
- static compute_power_wave_amplitudes(port, sim_data)[source]#
Compute the incident and reflected power wave amplitudes at a lumped port. The computed amplitudes have not been normalized.
- Parameters:
port (Union[
LumpedPort
,CoaxialLumpedPort
]) – Port for computing voltage and current.sim_data (
SimulationData
) – Results from the simulation.
- Returns:
Incident (a) and reflected (b) power wave amplitude frequency arrays.
- Return type:
tuple[FreqDataArray, FreqDataArray]
- static compute_power_delivered_by_port(port, sim_data)[source]#
Compute the power delivered to the network by a lumped port.
- Parameters:
port (Union[
LumpedPort
,CoaxialLumpedPort
]) – Port for computing voltage and current.sim_data (
SimulationData
) – Results from the simulation.
- Returns:
Power in units of Watts as a frequency array.
- Return type:
FreqDataArray
- static ab_to_s(a_matrix, b_matrix)[source]#
Get the scattering matrix given the power wave matrices.
- static s_to_z(s_matrix, reference)[source]#
Get the impedance matrix given the scattering matrix and a reference impedance.
- property port_reference_impedances#
The reference impedance used at each port for definining power wave amplitudes.
- 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.
- get_antenna_metrics_data(port_amplitudes=None, monitor_name=None)[source]#
Calculate antenna parameters using superposition of fields from multiple port excitations.
The method computes the radiated far fields and port excitation power wave amplitudes for a superposition of port excitations, which can be used to analyze antenna radiation characteristics.
- Parameters:
port_amplitudes (dict[str, complex] = None) – Dictionary mapping port names to their desired excitation amplitudes. For each port,
represents the incident power from that port into the system. If None, uses only the first port without any scaling of the raw simulation data.monitor_name (str = None) – Name of the
DirectivityMonitor
to use for calculating far fields. If None, uses the first monitor in radiation_monitors.
- Returns:
Container with antenna parameters including directivity, gain, and radiation efficiency, computed from the superposition of fields from all excited ports.
- Return type:
- __hash__()#
Hash method.