tidy3d.GridRefinement#

class GridRefinement[source]#

Bases: Tidy3dBaseModel

Specification for local mesh refinement that defines the grid step size and the number of grid cells in the refinement region.

Parameters:
  • refinement_factor (Optional[PositiveFloat] = None) – Refine grid step size in vacuum by this factor.

  • dl (Optional[PositiveFloat] = None) – [units = um]. Grid step size in the refined region.

  • num_cells (PositiveInt = 3) – Number of grid cells in the refinement region.

Note

If both refinement_factor and dl are defined, the grid step size is upper bounded by the smaller value of the two. If neither is defined, default refinement_factor=2 is applied.

Example

>>> grid_refine = GridRefinement(refinement_factor = 2, num_cells = 7)

Attributes

Methods

override_structure(center, ...)

Generate override structure for mesh refinement.

refinement_factor#
dl#
num_cells#
override_structure(center, grid_size_in_vacuum, drop_outside_sim)[source]#

Generate override structure for mesh refinement.

Parameters:
  • center (CoordinateOptional) – Center of the override structure. None coordinate along an axis means refinement is not applied along that axis.

  • grid_size_in_vacuum (float) – Grid step size in vaccum.

  • drop_outside_sim (bool) – Drop override structures outside simulation domain.

Returns:

Unshadowed override structures for mesh refinement. If refinement doesn’t need to be applied to an axis, the override geometry has size=inf and dl=None along this axis.

Return type:

MeshOverrideStructure