tidy3d.Medium2D#
- class Medium2D[source]#
- Bases: - AbstractMedium- 2D diagonally anisotropic 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, - attrsare mutable. For example, the following is allowed for setting an- attr- obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a- TypeErrorif- attrscontain objects that can not be serialized. One can check if- attrsare 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 - HeatSimulationinterface. 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- HeatSimulationobject,- Simulation.perturbed_mediums_copy()can be used to convert mediums with perturbation models defined into spatially dependent custom mediums. Otherwise, the- heat_specdoes not directly affect the running of an optical- Simulation.
- ss (Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, PECMedium]) – Medium describing the ss-component of the diagonal permittivity tensor. The ss-component refers to the in-plane dimension of the medium that is the first component in order of ‘x’, ‘y’, ‘z’. If the 2D material is normal to the y-axis, for example, then this determines the xx-component of the corresponding 3D medium. 
- tt (Union[Medium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, PECMedium]) – Medium describing the tt-component of the diagonal permittivity tensor. The tt-component refers to the in-plane dimension of the medium that is the second component in order of ‘x’, ‘y’, ‘z’. If the 2D material is normal to the y-axis, for example, then this determines the zz-component of the corresponding 3D medium. 
 
 - Notes - Only diagonal anisotropy is currently supported. - Example - >>> drude_medium = Drude(eps_inf=2.0, coeffs=[(1,2), (3,4)]) >>> medium2d = Medium2D(ss=drude_medium, tt=drude_medium) - Attributes - The diagonal elements of the 2D medium as a dictionary. - Whether the medium is a PEC. - 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.- Methods - eps_diagonal(frequency)- Main diagonal of the complex-valued permittivity tensor as a function of frequency. - eps_model(frequency)- Complex-valued permittivity as a function of frequency. - from_anisotropic_medium(medium, axis, thickness)- Generate a - Medium2Dequivalent of a- AnisotropicMediumwith given normal axis and thickness.- from_dispersive_medium(medium, thickness)- Generate a - Medium2Dequivalent of a- DispersiveMediumwith a given thickness.- from_medium(medium, thickness)- Generate a - Medium2Dequivalent of a- Mediumwith a given thickness.- is_comp_pec_2d(comp, axis)- Whether the medium is a PEC. - plot(freqs[, ax])- Plot n, k of a - Mediumas a function of frequency.- plot_sigma(freqs[, ax])- Plot the surface conductivity of the 2D material. - sigma_model(freq)- Complex-valued conductivity as a function of frequency. - to_anisotropic_medium(axis, thickness)- Generate a 3D - AnisotropicMediumequivalent of a given thickness.- to_medium(thickness)- Generate a - Mediumequivalent of a given thickness.- to_pole_residue(thickness)- Generate a - PoleResidueequivalent of a given thickness.- volumetric_equivalent(axis, adjacent_media, ...)- Produces a 3D volumetric equivalent medium. - Inherited Common Usage - ss#
 - tt#
 - volumetric_equivalent(axis, adjacent_media, adjacent_dls)[source]#
- Produces a 3D volumetric equivalent medium. The new medium has thickness equal to the average of the - dlsin the- axisdirection. The ss and tt components of the 2D material are mapped in order onto the xx, yy, and zz components of the 3D material, excluding the- axiscomponent. The conductivity and residues (in the case of a dispersive 2D material) are rescaled by- 1/dl. The neighboring media- neighborsenter in as a background for the resulting volumetric equivalent.- Parameters:
- axis (Axis) – Index (0, 1, or 2 for x, y, or z respectively) of the normal direction to the 2D material. 
- adjacent_media (Tuple[MediumType3D, MediumType3D]) – The neighboring media on either side of the 2D material. The first element is directly on the - side of the 2D material in the supplied axis, and the second element is directly on the + side. 
- adjacent_dls (Tuple[float, float]) – Each dl represents twice the thickness of the desired volumetric model on the respective side of the 2D material. 
 
- Returns:
- The 3D material corresponding to this 2D material. 
- Return type:
 
 - to_anisotropic_medium(axis, thickness)[source]#
- Generate a 3D - AnisotropicMediumequivalent of a given thickness.- Parameters:
- axis (Axis) – The normal axis to the 2D medium. 
- thickness (float) – The thickness of the desired 3D medium. 
 
- Returns:
- The 3D equivalent of this 2D medium. 
- Return type:
 
 - to_pole_residue(thickness)[source]#
- Generate a - PoleResidueequivalent of a given thickness. The 2D medium to be isotropic in-plane (otherwise the components are averaged).- Parameters:
- thickness (float) – The thickness of the desired 3D medium. 
- Returns:
- The 3D equivalent pole residue model of this 2D medium. 
- Return type:
 
 - to_medium(thickness)[source]#
- Generate a - Mediumequivalent of a given thickness. The 2D medium must be isotropic in-plane (otherwise the components are averaged) and non-dispersive besides a constant conductivity.- Parameters:
- thickness (float) – The thickness of the desired 3D medium. 
- Returns:
- The 3D equivalent of this 2D medium. 
- Return type:
 
 - classmethod from_medium(medium, thickness)[source]#
- Generate a - Medium2Dequivalent of a- Mediumwith a given thickness.
 - classmethod from_dispersive_medium(medium, thickness)[source]#
- Generate a - Medium2Dequivalent of a- DispersiveMediumwith a given thickness.- Parameters:
- medium ( - DispersiveMedium) – The 3D dispersive medium to convert.
- thickness (float) – The thickness of the 3D material. 
 
- Returns:
- The 2D equivalent of the given 3D medium. 
- Return type:
 
 - classmethod from_anisotropic_medium(medium, axis, thickness)[source]#
- Generate a - Medium2Dequivalent of a- AnisotropicMediumwith given normal axis and thickness. The- ssand- ttcomponents of the resulting 2D medium correspond to the first of the- xx,- yy, and- zzcomponents of the 3D medium, with the- axiscomponent removed.- Parameters:
- medium ( - AnisotropicMedium) – The 3D anisotropic medium to convert.
- axis ( - Axis) – The normal axis to the 2D material.
- thickness (float) – The thickness of the 3D material. 
 
- Returns:
- The 2D equivalent of the given 3D medium. 
- Return type:
 
 - eps_diagonal(frequency)[source]#
- Main diagonal of the complex-valued permittivity tensor as a function of frequency. 
 - 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 elements#
- The diagonal elements of the 2D medium as a dictionary. 
 - property n_cfl#
- 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.
 - property is_pec#
- Whether the medium is a PEC. 
 - __hash__()#
- Hash method.