tidy3d.HeatChargeSimulationData#
- class HeatChargeSimulationData[source]#
Bases:
AbstractHeatChargeSimulationDataStores results of a
HeatChargeSimulation.- Parameters:
simulation (
HeatChargeSimulation) – OriginalHeatChargeSimulationassociated with the data.data (tuple[Union[
TemperatureData,SteadyPotentialData,SteadyFreeCarrierData,SteadyElectricFieldData,SteadyEnergyBandData,SteadyCapacitanceData,SteadyCurrentDensityData], …]) – List ofMonitorDatainstances associated with the monitors of the originalSimulation.log (Optional[str] = None) – A string containing the log information from the simulation run.
device_characteristics (Optional[
DeviceCharacteristics] = None) – Data characterizing the deviceDeviceCharacteristics.
Example
>>> import tidy3d as td >>> import numpy as np >>> temp_mnt = td.TemperatureMonitor(size=(1, 2, 3), name="sample", unstructured=True) >>> 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
simulationlogMethods
plot_field(monitor_name[, field_name, val, ...])Plot the data for a monitor with simulation structures overlaid.
- 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, cmap=None, **sel_kwargs)[source]#
Plot the data for a monitor with simulation structures overlaid.
- Parameters:
monitor_name (str) – Name of
HeatChargeMonitorto plot.field_name (Optional[Literal["temperature", "potential"]] = None) – Name of
fieldcomponent 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 property to plot (heat conductivity or electric conductivity depending on the type of monitor). 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.
cmap (Optional[Union[str, Colormap]] = None) – Colormap for visualizing the field values.
Noneuses the default which infers it from the data.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, orz).
- Returns:
The supplied or created matplotlib axes.
- Return type:
matplotlib.axes._subplots.Axes