tidy3d.HeatChargeSimulation#
- class HeatChargeSimulation[source]#
Bases:
AbstractSimulationDefines thermoelectric simulations.
- Parameters:
center (Optional[tuple[Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box]]] = None) – [units = um]. Center of object in x, y, and z.
size (tuple[Union[NonNegativeFloat, autograd.tracer.Box], Union[NonNegativeFloat, autograd.tracer.Box], Union[NonNegativeFloat, autograd.tracer.Box]]) – [units = um]. Size in x, y, and z directions.
medium (Union[
MultiPhysicsMedium,Medium,AnisotropicMedium,PECMedium,PMCMedium,PoleResidue,Sellmeier,Lorentz,Debye,Drude,FullyAnisotropicMedium,CustomMedium,CustomPoleResidue,CustomSellmeier,CustomLorentz,CustomDebye,CustomDrude,CustomAnisotropicMedium,PerturbationMedium,PerturbationPoleResidue,LossyMetalMedium,Medium2D,AnisotropicMediumFromMedium2D,FluidSpec,SolidSpec,SolidMedium,FluidMedium,ChargeConductorMedium,ChargeInsulatorMedium,SemiconductorMedium] = Medium()) – Background medium of simulation, defaults to a standard dispersion-lessMediumif 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[Union[
HeatSource,HeatFromElectricSource,UniformHeatSource], …] = ()) – List of heat and/or charge sources.boundary_spec (tuple[Union[
HeatChargeBoundarySpec,HeatBoundarySpec], …] = ()) – List of boundary condition specifications.monitors (tuple[Union[
TemperatureMonitor,SteadyPotentialMonitor,SteadyFreeCarrierMonitor,SteadyEnergyBandMonitor,SteadyElectricFieldMonitor,SteadyCapacitanceMonitor,SteadyCurrentDensityMonitor], …] = ()) – Monitors in the simulation.grid_spec (Union[
UniformUnstructuredGrid,DistanceUnstructuredGrid]) – Grid specification for heat-charge simulation.version (str = 2.11.0.dev2) – String specifying the front end version number.
plot_length_units (Optional[Literal['nm', 'μm', 'um', 'mm', 'cm', 'm', 'mil', 'in']] = μm) – When set to a supported
LengthUnit, plots will be produced with proper scaling of axes and include the desired unit specifier in labels.structure_priority_mode (Literal['equal', 'conductor'] = equal) – This field only affects structures of priority=None. If equal, the priority of those structures is set to 0; if conductor, the priority of structures made of
LossyMetalMediumis set to 90,PECMediumto 100, and others to 0.analysis_spec (Optional[Union[
SteadyChargeDCAnalysis,IsothermalSteadyChargeDCAnalysis,SSACAnalysis,IsothermalSSACAnalysis,UnsteadyHeatAnalysis]] = None) – The analysis_spec is used to specify the type of simulation. Currently, it is used to specify Charge simulations or transient Heat simulations.
Notes
A
HeatChargeSimulationsupports different types of simulations. It solves the heat and conduction equations using the Finite-Volume (FV) method. This solver determines the required computation physics according to the simulation scene definition. This is implemented in this way due to the strong multi-physics coupling.The
HeatChargeSimulationcan solve multiple physics and the intention is to enable close thermo-electrical coupling.Currently, this solver supports steady-state heat conduction where \(q\) is the heat flux, \(k\) is the thermal conductivity, and \(T\) is the temperature.
\[-\nabla \cdot (-k \nabla T) = q\]It is also possible to run transient heat simulations by specifying
analysis_spec=UnsteadyHeatAnalysis(...). This adds the temporal terms to the above equations:\[\frac{\partial \rho c_p T}{\partial t} -\nabla \cdot (k \nabla(T)) = q\]where \(\rho\) is the density and \(c_p\) is the specific heat capacity of the medium.
The steady-state electrical
Conductionequation depends on the electric conductivity (\(\sigma\)) of a medium, and the electric field (\(\mathbf{E} = -\nabla(\psi)\)) derived from electrical potential (\(\psi\)). Currently, in this type of simulation, no current sources or sinks are supported.\[\text{div}(\sigma \cdot \nabla(\psi)) = 0\]For further details on what equations are solved in
Chargesimulations, refer to theSemiconductorMedium.Let’s understand how the physics solving is determined:
Simulation Type
Example Configuration Settings
HeatThe heat equation is solved with specified heat sources, boundary conditions, etc. Structures should incorporate materials with defined heat properties.
ConductionThe electrical conduction equation is solved with specified boundary conditions such as
VoltageBC,CurrentBC, …ChargeDrift-diffusion equations are solved for structures containing a defined
SemiconductorMedium. Insulators with aChargeInsulatorMediumcan also be included. For these, only the electric potential field is calculated.Examples
To run a thermal (
Heat🔥) simulation with a solid conductive structure:>>> import tidy3d as td >>> heat_sim = td.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=[td.TemperatureMonitor(size=(1, 2, 3), name="sample", unstructured=True)], ... )
To run a drift-diffusion (
Charge⚡) system:>>> import tidy3d as td >>> air = td.FluidMedium( ... name="air" ... ) >>> intrinsic_Si = td.material_library['cSi'].variants['Si_MultiPhysics'].medium.charge >>> Si_n = intrinsic_Si.updated_copy(N_d=[td.ConstantDoping(concentration=1e16)], name="Si_n") >>> Si_p = intrinsic_Si.updated_copy(N_a=[td.ConstantDoping(concentration=1e16)], name="Si_p") >>> n_side = td.Structure( ... geometry=td.Box(center=(-0.5, 0, 0), size=(1, 1, 1)), ... medium=Si_n, ... name="n_side" ... ) >>> p_side = td.Structure( ... geometry=td.Box(center=(0.5, 0, 0), size=(1, 1, 1)), ... medium=Si_p, ... name="p_side" ... ) >>> bc_v1 = td.HeatChargeBoundarySpec( ... condition=td.VoltageBC(source=td.DCVoltageSource(voltage=[-1, 0, 0.5])), ... placement=td.MediumMediumInterface(mediums=[air.name, Si_n.name]), ... ) >>> bc_v2 = td.HeatChargeBoundarySpec( ... condition=td.VoltageBC(source=td.DCVoltageSource(voltage=0)), ... placement=td.MediumMediumInterface(mediums=[air.name, Si_p.name]), ... ) >>> charge_sim = td.HeatChargeSimulation( ... structures=[n_side, p_side], ... medium=td.Medium(heat_spec=td.FluidSpec(), name="air"), ... monitors=[td.SteadyFreeCarrierMonitor( ... center=(0, 0, 0), size=(td.inf, td.inf, 0), name="charge_mnt", unstructured=True ... )], ... center=(0, 0, 0), ... size=(3, 3, 3), ... grid_spec=td.UniformUnstructuredGrid(dl=0.05), ... boundary_spec=[bc_v1, bc_v2], ... analysis_spec=td.IsothermalSteadyChargeDCAnalysis( ... tolerance_settings=td.ChargeToleranceSpec(rel_tol=1e5, abs_tol=3e3, max_iters=400), ... convergence_dv=10), ... )
Coupling between
Heatand electricalConductionsimulations is currently limited to 1-way. This is specified by defining a heat source of typeHeatFromElectricSource. With this coupling, joule heating is calculated as part of the solution to aConductionsimulation and translated into theHeatsimulation.- Two common scenarios can use this coupling definition:
- One in which BCs and sources are specified for both
HeatandConductionsimulations. In this case one mesh will be generated and used for both the
ConductionandHeatsimulations.
- One in which BCs and sources are specified for both
- Only heat BCs/sources are provided. In this case, only the
Heatequation will be solved. Before the simulation starts, it will try to load the heat source from file so a previously run
Conductionsimulations must have run previously. Since the Conduction andHeatmeshes may differ, an interpolation between them will be performed prior to starting theHeatsimulation.
- Only heat BCs/sources are provided. In this case, only the
Additional heat sources can be defined, in which case, they will be added on top of the coupling heat source.
Attributes
Background medium of simulation, defaults to a standard dispersion-less
Mediumif not specified.structuresTuple of structures present in simulation.
versionplot_length_unitsstructure_priority_modeValidating setup
sizecenterMethods
from_scene(scene, **kwargs)Create a simulation from a
Sceneinstance.plot([x, y, z, ax, source_alpha, ...])Plot each of simulation's components on a plane defined by one nonzero x,y,z coordinate.
plot_boundaries([x, y, z, property, 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, ...])DEPRECATED: Method added for backwards compatibility with
HeatSimulation.plot_heat_conductivity.plot_property([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, property, hlim, ...])Plot each of simulation's sources on a plane defined by one nonzero x,y,z coordinate.
source_bounds([property])Compute range of heat sources present in the simulation.
- medium#
Background medium of simulation, defaults to a standard dispersion-less
Mediumif not specified.
- sources#
- monitors#
- boundary_spec#
- grid_spec#
- symmetry#
- analysis_spec#
- plot(x=None, y=None, z=None, ax=None, source_alpha=None, monitor_alpha=None, hlim=None, vlim=None, fill_structures=True, **patch_kwargs)[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.
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.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.
fill_structures (bool = True) – Whether to fill structures with color or just draw outlines.
- Returns:
The supplied or created matplotlib axes.
- Return type:
matplotlib.axes._subplots.Axes
- plot_property(x=None, y=None, z=None, ax=None, alpha=None, source_alpha=None, monitor_alpha=None, property='heat_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.property (str = "heat_conductivity") – Specified the type of simulation for which the plot will be tailored. Options are [“heat_conductivity”, “electric_conductivity”, “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_heat_conductivity(x=None, y=None, z=None, ax=None, alpha=None, source_alpha=None, monitor_alpha=None, colorbar='conductivity', hlim=None, vlim=None, **kwargs)[source]#
DEPRECATED: Method added for backwards compatibility with
HeatSimulation.plot_heat_conductivity. 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, property='heat_conductivity', 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.
property (str = None) – Specified the type of simulation for which the plot will be tailored. Options are [“heat_conductivity”, “electric_conductivity”]
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, property='heat_conductivity', 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.
property (str = None) – Specified the type of simulation for which the plot will be tailored. Options are [“heat_conductivity”, “electric_conductivity”]
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
Noneuses 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
- source_bounds(property='heat_conductivity')[source]#
Compute range of heat sources present in the simulation.
- classmethod from_scene(scene, **kwargs)[source]#
Create a simulation from a
Sceneinstance. Must provide additional parameters to define a valid simulation (for example,size,grid_spec, etc).- Parameters:
scene (
Scene) – Scene containing structures information.**kwargs – Other arguments
Example
>>> from tidy3d import Scene, Medium, Box, Structure, UniformUnstructuredGrid, TemperatureMonitor >>> box = Structure( ... geometry=Box(center=(0, 0, 0), size=(1, 2, 3)), ... medium=Medium(permittivity=5), ... name="box" ... ) >>> scene = Scene( ... structures=[box], ... medium=Medium( ... permittivity=3, ... heat_spec=SolidMedium( ... conductivity=1, capacity=1, ... ), ... ), ... ) >>> sim = HeatChargeSimulation.from_scene( ... scene=scene, ... center=(0, 0, 0), ... size=(5, 6, 7), ... grid_spec=UniformUnstructuredGrid(dl=0.4), ... boundary_spec=[ ... HeatChargeBoundarySpec( ... placement=StructureBoundary(structure="box"), ... condition=TemperatureBC(temperature=500), ... ) ... ], ... monitors=[TemperatureMonitor(name="temp_monitor", center=(0, 0, 0), size=(1, 1, 1), unstructured=True)], ... )