tidy3d.components.medium.AbstractCustomMedium#

class AbstractCustomMedium[source]#

Bases: AbstractMedium, ABC

A spatially varying medium.

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.

  • interp_method (Literal['nearest', 'linear'] = nearest) – Interpolation method to obtain permittivity values that are not supplied at the Yee grids; For grids outside the range of the supplied data, extrapolation will be applied. When the extrapolated value is smaller (greater) than the minimal (maximal) of the supplied data, the extrapolated value will take the minimal (maximal) of the supplied data.

  • subpixel (bool = False) – If True and simulation’s subpixel is also True, applies subpixel averaging of the permittivity on the interface of the structure, including exterior boundary and intersection interfaces with other structures.

Attributes

is_isotropic

The medium is isotropic or anisotropic.

attrs

Methods

eps_comp_on_grid(row, col, frequency, coords)

Spatial profile of a single component of the complex-valued permittivity tensor at frequency interpolated at the supplied coordinates.

eps_dataarray_freq(frequency)

Permittivity array at frequency.

eps_diagonal(frequency)

Main diagonal of the complex-valued permittivity tensor at frequency.

eps_diagonal_on_grid(frequency, coords)

Spatial profile of main diagonal of the complex-valued permittivity at frequency interpolated at the supplied coordinates.

eps_model(frequency)

Complex-valued spatially averaged permittivity 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.

Inherited Common Usage

interp_method#
subpixel#
abstract property is_isotropic#

The medium is isotropic or anisotropic.

abstract eps_dataarray_freq(frequency)[source]#

Permittivity array at frequency.

Parameters:

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

Returns:

eps_diagonal_on_grid(frequency, coords)[source]#

Spatial profile of main diagonal of the complex-valued permittivity at frequency interpolated at the supplied coordinates.

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

  • coords (Coords) – The grid point coordinates over which interpolation is performed.

Returns:

The complex-valued permittivity tensor at frequency interpolated at the supplied coordinate.

Return type:

Tuple[ArrayComplex3D, ArrayComplex3D, ArrayComplex3D]

eps_comp_on_grid(row, col, frequency, coords)[source]#

Spatial profile of a single component of the complex-valued permittivity tensor at frequency interpolated at the supplied coordinates.

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

  • coords (Coords) – The grid point coordinates over which interpolation is performed.

Returns:

Single component of the complex-valued permittivity tensor at frequency interpolated at the supplied coordinates.

Return type:

ArrayComplex3D

eps_model(frequency)[source]#

Complex-valued spatially averaged permittivity as a function of frequency.

eps_diagonal(frequency)[source]#

Main diagonal of the complex-valued permittivity tensor at frequency. Spatially, we take max{||eps||}, so that autoMesh generation works appropriately.

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

__hash__()#

Hash method.