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:
  • 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 an attr obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a TypeError if attrs contain objects that can not be serialized. One can check if attrs are serializable by calling obj.json().

  • 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.

Inherited Common Usage

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_vaccum (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

__hash__()#

Hash method.