tidy3d.HeatSimulation#
- class HeatSimulation[source]#
Bases:
AbstractSimulation
Contains all information about heat simulation.
- Parameters:
center (Tuple[float, float, float] = (0.0, 0.0, 0.0)) – [units = um]. Center of object in x, y, and z.
size (Tuple[NonNegativeFloat, NonNegativeFloat, NonNegativeFloat]) – [units = um]. Size in x, y, and z directions.
medium (Union[Medium, AnisotropicMedium, PECMedium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, FullyAnisotropicMedium, CustomMedium, CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomAnisotropicMedium, PerturbationMedium, PerturbationPoleResidue] = Medium(name=None, frequency_range=None, allow_gain=False, nonlinear_spec=None, modulation_spec=None, heat_spec=None, type='Medium', permittivity=1.0, conductivity=0.0)) – Background medium of simulation, defaults to vacuum if not specified.
structures (Tuple[Structure, ...] = ()) – Tuple of structures present in simulation. Note: Structures defined later in this list override the simulation material properties in regions of spatial overlap.
symmetry (Tuple[Literal[0, 1], Literal[0, 1], Literal[0, 1]] = (0, 0, 0)) – Tuple of integers defining reflection symmetry across a plane bisecting the simulation domain normal to the x-, y-, and z-axis at the simulation center of each axis, respectively. Each element can be
0
(symmetry off) or1
(symmetry on).sources (Tuple[UniformHeatSource, ...] = ()) – List of heat sources.
boundary_spec (Tuple[HeatBoundarySpec, ...] = ()) – List of boundary condition specifications.
monitors (Tuple[TemperatureMonitor, ...] = ()) – Monitors in the simulation.
grid_spec (Union[UniformUnstructuredGrid, DistanceUnstructuredGrid]) – Grid specification for heat simulation.
version (str = 2.6.0) – String specifying the front end version number.
Example
>>> from tidy3d import Medium, SolidSpec, FluidSpec, UniformUnstructuredGrid, TemperatureMonitor >>> heat_sim = HeatSimulation( ... size=(3.0, 3.0, 3.0), ... structures=[ ... Structure( ... geometry=Box(size=(1, 1, 1), center=(0, 0, 0)), ... medium=Medium( ... permittivity=2.0, heat_spec=SolidSpec( ... conductivity=1, ... capacity=1, ... ) ... ), ... name="box", ... ), ... ], ... medium=Medium(permittivity=3.0, heat_spec=FluidSpec()), ... grid_spec=UniformUnstructuredGrid(dl=0.1), ... sources=[UniformHeatSource(rate=1, structures=["box"])], ... boundary_spec=[ ... HeatBoundarySpec( ... placement=StructureBoundary(structure="box"), ... condition=TemperatureBC(temperature=500), ... ) ... ], ... monitors=[TemperatureMonitor(size=(1, 2, 3), name="sample")], ... )
Attributes
Compute range of heat sources present in the simulation.
version
Defines the front end version of tidy3d
Methods
Error if structures contain unsupported yet geometries.
check_zero_dim_domain
(val, values)Error if heat domain have zero dimensions.
from_scene
(scene, **kwargs)Create a simulation from a :class:.`Scene` instance.
names_exist_bcs
(val, values)Error if boundary conditions point to non-existing structures/media.
names_exist_grid_spec
(val, values)Warn if UniformUnstructuredGrid points at a non-existing structure.
names_exist_sources
(val, values)Error if a heat source point to non-existing structures.
plot_boundaries
([x, y, z, ax])Plot each of simulation's boundary conditions on a plane defined by one nonzero x,y,z coordinate.
plot_heat_conductivity
([x, y, z, ax, alpha, ...])Plot each of simulation's components on a plane defined by one nonzero x,y,z coordinate.
plot_sources
([x, y, z, hlim, vlim, alpha, ax])Plot each of simulation's sources on a plane defined by one nonzero x,y,z coordinate.
- boundary_spec#
- sources#
- monitors#
- grid_spec#
- symmetry#
- classmethod check_unsupported_geometries(val)[source]#
Error if structures contain unsupported yet geometries.
- classmethod names_exist_bcs(val, values)[source]#
Error if boundary conditions point to non-existing structures/media.
- classmethod names_exist_grid_spec(val, values)[source]#
Warn if UniformUnstructuredGrid points at a non-existing structure.
- classmethod names_exist_sources(val, values)[source]#
Error if a heat source point to non-existing structures.
- plot_heat_conductivity(x=None, y=None, z=None, ax=None, alpha=None, source_alpha=None, monitor_alpha=None, colorbar='conductivity', hlim=None, vlim=None)[source]#
Plot each of simulation’s components on a plane defined by one nonzero x,y,z coordinate.
- Parameters:
x (float = None) – position of plane in x direction, only one of x, y, z must be specified to define plane.
y (float = None) – position of plane in y direction, only one of x, y, z must be specified to define plane.
z (float = None) – position of plane in z direction, only one of x, y, z must be specified to define plane.
ax (matplotlib.axes._subplots.Axes = None) – Matplotlib axes to plot on, if not specified, one is created.
alpha (float = None) – Opacity of the structures being plotted. Defaults to the structure default alpha.
source_alpha (float = None) – Opacity of the sources. If
None
, uses Tidy3d default.monitor_alpha (float = None) – Opacity of the monitors. If
None
, uses Tidy3d default.colorbar (str = "conductivity") – Display colorbar for thermal conductivity (“conductivity”) or heat source rate (“source”).
hlim (Tuple[float, float] = None) – The x range if plotting on xy or xz planes, y range if plotting on yz plane.
vlim (Tuple[float, float] = None) – The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
- Returns:
The supplied or created matplotlib axes.
- Return type:
matplotlib.axes._subplots.Axes
- plot_boundaries(x=None, y=None, z=None, ax=None)[source]#
Plot each of simulation’s boundary conditions on a plane defined by one nonzero x,y,z coordinate.
- Parameters:
x (float = None) – position of plane in x direction, only one of x, y, z must be specified to define plane.
y (float = None) – position of plane in y direction, only one of x, y, z must be specified to define plane.
z (float = None) – position of plane in z direction, only one of x, y, z must be specified to define plane.
ax (matplotlib.axes._subplots.Axes = None) – Matplotlib axes to plot on, if not specified, one is created.
- Returns:
The supplied or created matplotlib axes.
- Return type:
matplotlib.axes._subplots.Axes
- plot_sources(x=None, y=None, z=None, hlim=None, vlim=None, alpha=None, ax=None)[source]#
Plot each of simulation’s sources on a plane defined by one nonzero x,y,z coordinate.
- Parameters:
x (float = None) – position of plane in x direction, only one of x, y, z must be specified to define plane.
y (float = None) – position of plane in y direction, only one of x, y, z must be specified to define plane.
z (float = None) – position of plane in z direction, only one of x, y, z must be specified to define plane.
hlim (Tuple[float, float] = None) – The x range if plotting on xy or xz planes, y range if plotting on yz plane.
vlim (Tuple[float, float] = None) – The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
alpha (float = None) – Opacity of the sources, If
None
uses Tidy3d default.ax (matplotlib.axes._subplots.Axes = None) – Matplotlib axes to plot on, if not specified, one is created.
- Returns:
The supplied or created matplotlib axes.
- Return type:
matplotlib.axes._subplots.Axes
- property source_bounds#
Compute range of heat sources present in the simulation.
- classmethod from_scene(scene, **kwargs)[source]#
Create a simulation from a :class:.`Scene` instance. Must provide additional parameters to define a valid simulation (for example,
size
,grid_spec
, etc).- Parameters:
scene (:class:.`Scene`) – Scene containing structures information.
**kwargs – Other arguments
Example
>>> from tidy3d import Scene, Medium, Box, Structure, UniformUnstructuredGrid >>> box = Structure( ... geometry=Box(center=(0, 0, 0), size=(1, 2, 3)), ... medium=Medium(permittivity=5), ... ) >>> scene = Scene( ... structures=[box], ... medium=Medium(permittivity=3), ... ) >>> sim = HeatSimulation.from_scene( ... scene=scene, ... center=(0, 0, 0), ... size=(5, 6, 7), ... grid_spec=UniformUnstructuredGrid(dl=0.4), ... )
- __hash__()#
Hash method.