flex_rf.tidy3d.Structure
Type: class │ Base(s): AbstractStructure
Description
Section titled “Description”Defines a physical object that interacts with the electromagnetic fields.
A Structure is a combination of a material property (AbstractMedium)
and a Geometry.
Structures can indeed be larger than the simulation domain in tidy3d. In such cases, tidy3d will
automatically truncate the geometry that goes beyond the domain boundaries. For best results, structures that
intersect with absorbing boundaries or simulation edges should extend all the way through. In many such
cases, an “infinite” size inf can be used to define the size along that dimension.
Practical Advice
For example, a waveguide extending along x should use td.inf to ensure it passes fully through
PML regions:
waveguide = Structure( geometry=Box(center=(0, 0, 0), size=(td.inf, 0.5, 0.22)), medium=Medium(permittivity=3.48**2),)Structures that terminate inside PML can cause evanescent fields at the interface to be amplified by the absorber, potentially leading to simulation divergence.
For uniform pixelated design regions (e.g. topology optimization), use the convenience method
from_permittivity_array, which creates a Structure with a CustomMedium
from a 3D numpy array of permittivity values and a geometry defining the region:
design_region = td.Box(center=(0, 0, 0), size=(2, 2, 0.22))structure = Structure.from_permittivity_array( geometry=design_region, eps_data=eps_array)Example(s)
Section titled “Example(s)”from tidy3d import Box, Mediumbox = Box(center=(0,0,1), size=(2, 2, 2))glass = Medium(permittivity=3.9)struct = Structure(geometry=box, medium=glass, name='glass_box')Parameters
Section titled “Parameters”geometry [GeometryType] |
|
Defines geometric properties of the structure. |
medium [StructureMediumType] |
|
Defines the electromagnetic properties of the structure’s medium. |
name [str | None] = None |
|
Optional name for the structure. |
background_permittivity [float | None] = None |
|
DEPRECATED: Use |
background_medium [StructureMediumType | None] = 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 |
priority [int | None] = None |
|
Priority of the structure applied in structure overlapping region. The material property in the overlapping region is dictated by the structure of higher priority. For structures of equal priority, the structure added later to the structure list takes precedence. When |
Attributes
Section titled “Attributes”viz_spec [VisualizationSpec | None] |
Methods
Section titled “Methods”eps_comp(row: Axis, col: Axis, frequency: float, coords: Coords) |
|
Single component of the complex-valued permittivity tensor as a function of frequency. |
eps_diagonal(frequency: float, coords: Coords) |
|
Main diagonal of the complex-valued permittivity tensor as a function of frequency. |
from_permittivity_array(geometry: GeometryType, eps_data: np.ndarray, **kwargs: Any) |
|
Create |
list_from_custom_medium(*, medium: AbstractCustomMedium, slab_bounds: tuple[float, float] | None = None, axis: int | None = None, frequency: float | None = None, threshold: float | None = None, foreground_medium: StructureMediumType | None = None, background_medium: StructureMediumType | None = None, pixel_exact: bool = False, boundary_step: float | None = None, smooth_sigma: float = 0.0, min_hole_area: float = 0.0, min_island_area: float = 0.0, name_prefix: str = 'design_polyslab') |
|
Create structures from a thresholded 2D slice of a custom medium. |
list_from_dataarray(*, data: SpatialDataArray, slab_bounds: tuple[float, float] | None = None, axis: int | None = None, threshold: float | None = None, foreground_medium: StructureMediumType | None = None, background_medium: StructureMediumType | None = None, pixel_exact: bool = False, boundary_step: float | None = None, smooth_sigma: float = 0.0, min_hole_area: float = 0.0, min_island_area: float = 0.0, name_prefix: str = 'design_polyslab') |
|
Create structures from a permittivity data array. |
to_gds(cell: gdstk.Cell, x: float | None = None, y: float | None = None, z: float | None = None, permittivity_threshold: NonNegativeFloat = 1, frequency: PositiveFloat = 0, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0, pixel_exact: bool = False) |
|
Append a structure’s planar slice to a .gds cell. |
to_gds_file(fname: PathLike, x: float | None = None, y: float | None = None, z: float | None = None, permittivity_threshold: NonNegativeFloat = 1, frequency: PositiveFloat = 0, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0, gds_cell_name: str = 'MAIN', pixel_exact: bool = False) |
|
Export a structure’s planar slice to a .gds file. |
to_gdstk(x: float | None = None, y: float | None = None, z: float | None = None, permittivity_threshold: NonNegativeFloat = 1, frequency: PositiveFloat = 0, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0, pixel_exact: bool = False) |
|
Convert a structure’s planar slice to a .gds type polygon. |