tidy3d.MeshOverrideStructure#

class MeshOverrideStructure[source]#

Bases: AbstractStructure

Defines an object that is only used in the process of generating the mesh.

Parameters:
  • geometry (Union[Box, Transformed, ClipOperation, GeometryGroup, GeometryArray, Sphere, Cylinder, PolySlab, ComplexPolySlabBase, TriangleMesh]) – Defines geometric properties of the structure.

  • name (Optional[str] = None) – Optional name for the structure.

  • background_permittivity (Optional[float] = None) – DEPRECATED: Use Structure.background_medium. Relative permittivity used for the background of this structure when performing shape optimization with autograd.

  • background_medium (Optional[Union[MultiPhysicsMedium, Medium, AnisotropicMedium, PECMedium, PMCMedium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, FullyAnisotropicMedium, CustomMedium, CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomAnisotropicMedium, PerturbationMedium, PerturbationPoleResidue, LossyMetalMedium, Medium2D, AnisotropicMediumFromMedium2D, FluidSpec, SolidSpec, SolidMedium, FluidMedium, ChargeConductorMedium, ChargeInsulatorMedium, SemiconductorMedium]] = None) – Medium used for the background of this structure when performing shape optimization with autograd. This is required when the structure is embedded in another structure as autograd will use the permittivity of the Simulation by default to compute the shape derivatives.

  • priority (int = 0) – Priority of the structure applied in mesh override structure overlapping region. The priority of internal override structures is -1.

  • dl (tuple[Optional[PositiveFloat], Optional[PositiveFloat], Optional[PositiveFloat]] = (None, None, None)) – [units = um]. Grid size along x, y, z directions. Use None along a dimension to apply no override there, or to leave the grid size to min_steps_per_size. When both dl and min_steps_per_size are set along a dimension, the final grid size is the minimum (finer) of the two.

  • min_steps_per_size (tuple[Optional[PositiveFloat], Optional[PositiveFloat], Optional[PositiveFloat]] = (None, None, None)) – Minimum number of grid steps spanning the structure’s bounding box along x, y, z directions. The grid size along a dimension is the bounding box size divided by this value; it is ignored along dimensions where the bounding box size is zero or infinite. Use None along a dimension to apply no override there. When both dl and min_steps_per_size are set along a dimension, the final grid size is the minimum (finer) of the two.

  • enforce (bool = False) – If True, enforce the grid size setup inside the structure even if the structure is inside a structure of smaller grid size. In the intersection region of multiple structures of enforce=True, grid size is decided by the last added structure of enforce=True.

  • shadow (bool = True) – In structure intersection region, grid size is decided by the latter added structure in the structure list when shadow=True; or the structure of smaller grid size when shadow=False. A shadow=False structure lowers the grid size in the regions it overlaps, reusing a nearby existing grid line at its bounding box where possible instead of always adding a new one.

  • drop_outside_sim (bool = True) – If True, structure outside the simulation domain is dropped; if False, structure takes effect along the dimensions where the projections of the structure and that of the simulation domain overlap.

Notes

A MeshOverrideStructure is a combination of geometry Geometry, grid size along x, y, z directions, and a boolean on whether the override will be enforced.

The grid size can be specified directly through dl (an absolute grid size), or relative to the structure through min_steps_per_size (the minimum number of grid steps spanning the structure’s bounding box along each dimension). When both dl and min_steps_per_size are set along a dimension, the final grid size is the minimum (finer) of the two.

Example

>>> from tidy3d import Box
>>> box = Box(center=(0,0,1), size=(2, 2, 2))
>>> struct_override = MeshOverrideStructure(geometry=box, dl=(0.1,0.2,0.3), name='override_box')

Refinement relative to the structure size, here at least 10 grid steps along each direction:

>>> struct_override = MeshOverrideStructure(
...     geometry=box, min_steps_per_size=(10, 10, 10), name='override_box'
... )

Attributes

dl

min_steps_per_size

priority

enforce

shadow

drop_outside_sim

geometry

name

background_permittivity

background_medium

dl#
min_steps_per_size#
priority#
enforce#
shadow#
drop_outside_sim#