tidy3d.PerturbationMedium#
- class PerturbationMedium[source]#
Bases:
Medium
,AbstractPerturbationMedium
Dispersionless medium with perturbations.
- 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 anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.json()
.subpixel (bool = True) – This value will be transferred to the resulting custom medium. That is, if
True
, the subpixel averaging will be applied to the custom medium provided the correspondingSimulation
’s fieldsubpixel
is set toTrue
as well. If the resulting medium is not a custom medium (no perturbations), this field does not have an effect.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 usingHeatSimulation
object,Simulation.perturbed_mediums_copy()
can be used to convert mediums with perturbation models defined into spatially dependent custom mediums. Otherwise, theheat_spec
does not directly affect the running of an opticalSimulation
.permittivity (ConstrainedFloatValue = 1.0) – [units = None (relative permittivity)]. Relative permittivity.
conductivity (float = 0.0) – [units = S/um]. Electric conductivity. Defined such that the imaginary part of the complex permittivity at angular frequency omega is given by conductivity/omega.
permittivity_perturbation (Optional[ParameterPerturbation] = None) – [units = None (relative permittivity)]. List of heat and/or charge perturbations to permittivity.
conductivity_perturbation (Optional[ParameterPerturbation] = None) – [units = S/um]. List of heat and/or charge perturbations to permittivity.
Example
>>> from tidy3d import ParameterPerturbation, LinearHeatPerturbation >>> dielectric = PerturbationMedium( ... permittivity=4.0, ... permittivity_perturbation=ParameterPerturbation( ... heat=LinearHeatPerturbation(temperature_ref=300, coeff=0.0001), ... ), ... name='my_medium', ... )
Attributes
Methods
perturbed_copy
([temperature, ...])Sample perturbations on provided heat and/or charge data and return 'CustomMedium'.
Inherited Common Usage
- permittivity_perturbation#
- conductivity_perturbation#
- perturbed_copy(temperature=None, electron_density=None, hole_density=None, interp_method='linear')[source]#
Sample perturbations on provided heat and/or charge data and return ‘CustomMedium’. Any of temperature, electron_density, and hole_density can be ‘None’. If all passed arguments are ‘None’ then a ‘Medium’ object is returned. All provided fields must have identical coords.
- Parameters:
temperature (Union[) –
] = None Temperature field data.
electron_density (Union[) –
] = None Electron density field data.
hole_density (Union[) –
] = None Hole density field data.
interp_method (
InterpMethod
, optional) – Interpolation method to obtain heat and/or charge values that are not supplied at the Yee grids.
- Returns:
Medium specification after application of heat and/or charge data.
- Return type:
Union[Medium, CustomMedium]
- __hash__()#
Hash method.