tidy3d.GridRefinement#
- class GridRefinement[source]#
Bases:
Tidy3dBaseModelSpecification 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) – Sets the extent of the refinement region in units of the refined grid size
dl. When refining around a point, it is the width of the refined box (num_cells * dl, centered on the point); when refining a region of finite extent, it is the margin (num_cells * dlper axis) by which the region’s bounding box is grown.
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, size, ...)Generate override structure for mesh refinement around a point or a region.
- refinement_factor#
- dl#
- num_cells#
- override_structure(center, size, grid_size_in_vacuum, drop_outside_sim)[source]#
Generate override structure for mesh refinement around a point or a region.
Each refined axis is grown to
size + num_cells * dland centered oncenter.- Parameters:
center (CoordinateOptional) – Center of the override structure. A
Nonecoordinate along an axis means refinement is not applied along that axis.size (Coordinate) – Extent of the region to refine along each axis (
0for a point). Ignored along axes wherecenterisNone.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. Along an axis where refinement is not applied, the override geometry has size=inf and dl=None.
- Return type: