tidy3d.components.medium.AbstractMedium#

class AbstractMedium[source]#

Bases: ABC, Tidy3dBaseModel

A medium within which electromagnetic waves propagate.

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

  • name (Optional[str] = None) – Optional unique name for medium.

  • frequency_range (Optional[Tuple[float, float]] = None) – [units = (Hz, Hz)]. Optional range of validity for the medium.

  • allow_gain (bool = False) – Allow the medium to be active. Caution: simulations with a gain medium are unstable, and are likely to diverge.Simulations where ‘allow_gain’ is set to ‘True’ will still be charged even if diverged. Monitor data up to the divergence point will still be returned and can be useful in some cases.

  • nonlinear_spec (Union[NonlinearSpec, NonlinearSusceptibility] = None) – Nonlinear spec applied on top of the base medium properties.

  • modulation_spec (Optional[ModulationSpec] = None) – Modulation spec applied on top of the base medium properties.

  • heat_spec (Union[FluidSpec, SolidSpec, NoneType] = None) – Specification of the medium heat properties. They are used for solving the heat equation via the HeatSimulation interface. Such simulations can be used for investigating the influence of heat propagation on the properties of optical systems. Once the temperature distribution in the system is found using HeatSimulation object, Simulation.perturbed_mediums_copy() can be used to convert mediums with perturbation models defined into spatially dependent custom mediums. Otherwise, the heat_spec does not directly affect the running of an optical Simulation.

Attributes

is_custom

Whether the medium is custom.

is_fully_anisotropic

Whether the medium is fully anisotropic.

is_nonlinear

Whether the medium is nonlinear.

is_pec

Whether the medium is a PEC.

is_spatially_uniform

Whether the medium is spatially uniform.

is_time_modulated

Whether any component of the medium is time modulated.

n_cfl

To ensure a stable FDTD simulation, it is essential to select an appropriate time step size in accordance with the CFL condition.

attrs

Methods

compute_derivatives(derivative_info)

Compute the adjoint derivatives for this object.

derivative_eps_complex_volume(E_der_map, bounds)

Get the derivative w.r.t complex-valued permittivity in the volume.

derivative_eps_sigma_volume(E_der_map, bounds)

Get the derivative w.r.t permittivity and conductivity in the volume.

eps_comp(row, col, frequency)

Single component of the complex-valued permittivity tensor as a function of frequency.

eps_complex_to_eps_loss_tangent(eps_complex)

Convert complex permittivity to permittivity and loss tangent.

eps_complex_to_eps_sigma(eps_complex, freq)

Convert complex permittivity at frequency freq to permittivity and conductivity values.

eps_complex_to_nk(eps_c)

Convert complex permittivity to n, k values.

eps_diagonal(frequency)

Main diagonal of the complex-valued permittivity tensor as a function of frequency.

eps_loss_tangent_to_eps_complex(eps_real, ...)

Convert permittivity and loss tangent to complex permittivity.

eps_model(frequency)

Complex-valued permittivity as a function of frequency.

eps_sigma_to_eps_complex(eps_real, sigma, freq)

convert permittivity and conductivity to complex permittivity at freq

loss_tangent_model(frequency)

Permittivity and loss tangent as a function of frequency.

nk_model(frequency)

Real and imaginary parts of the refactive index as a function of frequency.

nk_to_eps_complex(n[, k])

Convert n, k to complex permittivity.

nk_to_eps_sigma(n, k, freq)

Convert n, k at frequency freq to permittivity and conductivity values.

plot(freqs[, ax])

Plot n, k of a Medium as a function of frequency.

sel_inside(bounds)

Return a new medium that contains the minimal amount data necessary to cover a spatial region defined by bounds.

sigma_model(freq)

Complex-valued conductivity as a function of frequency.

Inherited Common Usage

name#
frequency_range#
allow_gain#
nonlinear_spec#
modulation_spec#
heat_spec#
property is_spatially_uniform#

Whether the medium is spatially uniform.

property is_time_modulated#

Whether any component of the medium is time modulated.

property is_nonlinear#

Whether the medium is nonlinear.

property is_custom#

Whether the medium is custom.

property is_fully_anisotropic#

Whether the medium is fully anisotropic.

abstract eps_model(frequency)[source]#

Complex-valued permittivity as a function of frequency.

Parameters:

frequency (float) – Frequency to evaluate permittivity at (Hz).

Returns:

Complex-valued relative permittivity evaluated at frequency.

Return type:

complex

nk_model(frequency)[source]#

Real and imaginary parts of the refactive index as a function of frequency.

Parameters:

frequency (float) – Frequency to evaluate permittivity at (Hz).

Returns:

Real part (n) and imaginary part (k) of refractive index of medium.

Return type:

Tuple[float, float]

loss_tangent_model(frequency)[source]#

Permittivity and loss tangent as a function of frequency.

Parameters:

frequency (float) – Frequency to evaluate permittivity at (Hz).

Returns:

Real part of permittivity and loss tangent.

Return type:

Tuple[float, float]

eps_diagonal(frequency)[source]#

Main diagonal of the complex-valued permittivity tensor as a function of frequency.

Parameters:

frequency (float) – Frequency to evaluate permittivity at (Hz).

Returns:

The diagonal elements of the relative permittivity tensor evaluated at frequency.

Return type:

complex

eps_comp(row, col, frequency)[source]#

Single component of the complex-valued permittivity tensor as a function of frequency.

Parameters:
  • row (int) – Component’s row in the permittivity tensor (0, 1, or 2 for x, y, or z respectively).

  • col (int) – Component’s column in the permittivity tensor (0, 1, or 2 for x, y, or z respectively).

  • frequency (float) – Frequency to evaluate permittivity at (Hz).

Returns:

Element of the relative permittivity tensor evaluated at frequency.

Return type:

complex

abstract property n_cfl#

To ensure a stable FDTD simulation, it is essential to select an appropriate time step size in accordance with the CFL condition. The maximal time step size is inversely proportional to the speed of light in the medium, and thus proportional to the index of refraction. However, for dispersive medium, anisotropic medium, and other more complicated media, there are complications in deciding on the choice of the index of refraction.

This property computes the index of refraction related to CFL condition, so that the FDTD with this medium is stable when the time step size that doesn’t take material factor into account is multiplied by n_cfl.

plot(freqs, ax=None)[source]#

Plot n, k of a Medium as a function of frequency.

Parameters:
  • freqs (float) – Frequencies (Hz) to evaluate the medium properties at.

  • 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

static nk_to_eps_complex(n, k=0.0)[source]#

Convert n, k to complex permittivity.

Parameters:
  • n (float) – Real part of refractive index.

  • k (float = 0.0) – Imaginary part of refrative index.

Returns:

Complex-valued relative permittivity.

Return type:

complex

static eps_complex_to_nk(eps_c)[source]#

Convert complex permittivity to n, k values.

Parameters:

eps_c (complex) – Complex-valued relative permittivity.

Returns:

Real and imaginary parts of refractive index (n & k).

Return type:

Tuple[float, float]

static nk_to_eps_sigma(n, k, freq)[source]#

Convert n, k at frequency freq to permittivity and conductivity values.

Parameters:
  • n (float) – Real part of refractive index.

  • k (float = 0.0) – Imaginary part of refrative index.

  • frequency (float) – Frequency to evaluate permittivity at (Hz).

Returns:

Real part of relative permittivity & electric conductivity.

Return type:

Tuple[float, float]

static eps_sigma_to_eps_complex(eps_real, sigma, freq)[source]#

convert permittivity and conductivity to complex permittivity at freq

Parameters:
  • eps_real (float) – Real-valued relative permittivity.

  • sigma (float) – Conductivity.

  • freq (float) – Frequency to evaluate permittivity at (Hz). If not supplied, returns real part of permittivity (limit as frequency -> infinity.)

Returns:

Complex-valued relative permittivity.

Return type:

complex

static eps_complex_to_eps_sigma(eps_complex, freq)[source]#

Convert complex permittivity at frequency freq to permittivity and conductivity values.

Parameters:
  • eps_complex (complex) – Complex-valued relative permittivity.

  • freq (float) – Frequency to evaluate permittivity at (Hz).

Returns:

Real part of relative permittivity & electric conductivity.

Return type:

Tuple[float, float]

static eps_complex_to_eps_loss_tangent(eps_complex)[source]#

Convert complex permittivity to permittivity and loss tangent.

Parameters:

eps_complex (complex) – Complex-valued relative permittivity.

Returns:

Real part of relative permittivity & loss tangent

Return type:

Tuple[float, float]

static eps_loss_tangent_to_eps_complex(eps_real, loss_tangent)[source]#

Convert permittivity and loss tangent to complex permittivity.

Parameters:
  • eps_real (float) – Real part of relative permittivity

  • loss_tangent (float) – Loss tangent

Returns:

eps_complex – Complex-valued relative permittivity.

Return type:

complex

sigma_model(freq)[source]#

Complex-valued conductivity as a function of frequency.

Parameters:

freq (float) – Frequency to evaluate conductivity at (Hz).

Returns:

Complex conductivity at this frequency.

Return type:

complex

property is_pec#

Whether the medium is a PEC.

sel_inside(bounds)[source]#

Return a new medium that contains the minimal amount data necessary to cover a spatial region defined by bounds.

Parameters:

bounds (Tuple[float, float, float], Tuple[float, float float]) – Min and max bounds packaged as (minx, miny, minz), (maxx, maxy, maxz).

Returns:

Medium with reduced data.

Return type:

AbstractMedium

compute_derivatives(derivative_info)[source]#

Compute the adjoint derivatives for this object.

derivative_eps_sigma_volume(E_der_map, bounds)[source]#

Get the derivative w.r.t permittivity and conductivity in the volume.

derivative_eps_complex_volume(E_der_map, bounds)[source]#

Get the derivative w.r.t complex-valued permittivity in the volume.

__hash__()#

Hash method.