tidy3d.plugins.invdes.ErosionDilationPenalty#

class ErosionDilationPenalty[source]#

Bases: AbstractPenalty

Erosion and dilation penalty, addable to tdi.TopologyDesignRegion.penalties. Uses filtering and projection methods to erode and dilate the features within this array. Measures the change in the array after eroding and dilating (and also dilating and eroding). Returns a penalty proportional to the magnitude of this change. The amount of change under dilation and erosion is minimized if the structure has large feature sizes and large radius of curvature relative to the length scale.

Parameters:
  • weight (NonNegativeFloat = 1.0) – When this penalty is evaluated, it will be weighted by this value. Note that the optimizer seeks to maximize the objective function and subtracts the penalty strength times this weight from the objective function.

  • length_scale (PositiveFloat) – [units = um]. Length scale of erosion and dilation. Corresponds to radius in the ConicFilter used for filtering. The parameter array is dilated and eroded by half of this value with each operation. Roughly corresponds to the desired minimum feature size and radius of curvature.

  • beta (float = 100.0) – Strength of the tanh projection. Corresponds to beta in the :class:`BinaryProjector. Higher values correspond to stronger discretization.

  • eta0 (float = 0.5) – Value between 0 and 1 that sets the projection midpoint. In other words, for values of eta0, the projected values are halfway between minimum and maximum. Corresponds to eta in the BinaryProjector.

  • delta_eta (float = 0.01) – The binarization threshold for erosion and dilation operations The thresholds are 0 + delta_eta on the low end and 1 - delta_eta on the high end. The default value balances binarization with differentiability so we strongly suggest using it unless there is a good reason to set it differently.

Note

For more details, refer to chapter 4 of Hammond, A., “High-Efficiency Topology Optimization for Very Large-Scale Integrated-Photonics Inverse Design” (2022).

../../_images/erosion_dilation.png

Attributes

Methods

evaluate(x, pixel_size)

Evaluate this penalty.

length_scale#
beta#
eta0#
delta_eta#
evaluate(x, pixel_size)[source]#

Evaluate this penalty.