tidy3d.HeatChargeSimulationData#

class HeatChargeSimulationData[source]#

Bases: AbstractSimulationData

Stores results of a HeatChargeSimulation.

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().

  • simulation (HeatChargeSimulation) – Original HeatChargeSimulation associated with the data.

  • data (Tuple[Union[TemperatureData, SteadyPotentialData, SteadyFreeCarrierData, SteadyCapacitanceData], ...]) – List of MonitorData instances associated with the monitors of the original Simulation.

  • log (Optional[str] = None) – A string containing the log information from the simulation run.

  • device_characteristics (Optional[DeviceCharacteristics] = None) – Data characterizing the device. Current characteristics include: ‘steady_dc_hole_capacitance’, ‘steady_dc_electron_capacitance’, and ‘steady_dc_current_voltage’

Example

>>> import tidy3d as td
>>> import numpy as np
>>> temp_mnt = td.TemperatureMonitor(size=(1, 2, 3), name="sample")
>>> heat_sim = HeatChargeSimulation(
...     size=(3.0, 3.0, 3.0),
...     structures=[
...         td.Structure(
...             geometry=td.Box(size=(1, 1, 1), center=(0, 0, 0)),
...             medium=td.Medium(
...                 permittivity=2.0, heat_spec=td.SolidSpec(
...                     conductivity=1,
...                     capacity=1,
...                 )
...             ),
...             name="box",
...         ),
...     ],
...     medium=td.Medium(permittivity=3.0, heat_spec=td.FluidSpec()),
...     grid_spec=td.UniformUnstructuredGrid(dl=0.1),
...     sources=[td.HeatSource(rate=1, structures=["box"])],
...     boundary_spec=[
...         td.HeatChargeBoundarySpec(
...             placement=td.StructureBoundary(structure="box"),
...             condition=td.TemperatureBC(temperature=500),
...         )
...     ],
...     monitors=[temp_mnt],
... )
>>> x = [1,2]
>>> y = [2,3,4]
>>> z = [3,4,5,6]
>>> coords = dict(x=x, y=y, z=z)
>>> temp_array = td.SpatialDataArray(300 * np.abs(np.random.random((2,3,4))), coords=coords)
>>> temp_mnt_data = td.TemperatureData(monitor=temp_mnt, temperature=temp_array)
>>> heat_sim_data = td.HeatChargeSimulationData(
...     simulation=heat_sim, data=[temp_mnt_data],
... )

Attributes

log

Custom logger to avoid the complexities of the logging module

attrs

Methods

plot_field(monitor_name[, field_name, val, ...])

Plot the data for a monitor with simulation plot overlaid.

Inherited Common Usage

simulation#
data#
device_characteristics#
plot_field(monitor_name, field_name=None, val='real', scale='lin', structures_alpha=0.2, robust=True, vmin=None, vmax=None, ax=None, **sel_kwargs)[source]#

Plot the data for a monitor with simulation plot overlaid.

Parameters:
  • field_monitor_name (str) – Name of TemperatureMonitorData to plot.

  • field_name (Optional[Literal["temperature", "potential"]] = None) – Name of field component to plot (eg. ‘temperature’). Not required if monitor data contains only one field.

  • val (Literal['real', 'abs', 'abs^2'] = 'real') – Which part of the field to plot.

  • scale (Literal['lin', 'log']) – Plot in linear or logarithmic scale.

  • structures_alpha (float = 0.2) – Opacity of the structure permittivity. Must be between 0 and 1 (inclusive).

  • robust (bool = True) – If True and vmin or vmax are absent, uses the 2nd and 98th percentiles of the data to compute the color limits. This helps in visualizing the field patterns especially in the presence of a source.

  • vmin (float = None) – The lower bound of data range that the colormap covers. If None, they are inferred from the data and other keyword arguments.

  • vmax (float = None) – The upper bound of data range that the colormap covers. If None, they are inferred from the data and other keyword arguments.

  • ax (matplotlib.axes._subplots.Axes = None) – matplotlib axes to plot on, if not specified, one is created.

  • sel_kwargs (keyword arguments used to perform .sel() selection in the monitor data.) – These kwargs can select over the spatial dimensions (x, y, z), or time dimension (t) if applicable. For the plotting to work appropriately, the resulting data after selection must contain only two coordinates with len > 1. Furthermore, these should be spatial coordinates (x, y, or z).

Returns:

The supplied or created matplotlib axes.

Return type:

matplotlib.axes._subplots.Axes

__hash__()#

Hash method.