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 anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.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:
- __hash__()#
Hash method.