flex_rf.tidy3d.GridSpec
Type: class │ Base(s): Tidy3dBaseModel
Description
Section titled “Description”Collective grid specification for all three dimensions.
Practical Advice
When using AutoGrid, the wavelength parameter determines the scale for automatic meshing.
If omitted, it is inferred from sources in the simulation. For simulations without sources or where
finer control is needed, set it explicitly:
grid_spec = GridSpec.auto(min_steps_per_wvl=20, wavelength=1.55)Example(s)
Section titled “Example(s)”uniform = UniformGrid(dl=0.1)custom = CustomGrid(dl=[0.2, 0.2, 0.1, 0.1, 0.1, 0.2, 0.2])auto = AutoGrid(min_steps_per_wvl=12)grid_spec = GridSpec(grid_x=uniform, grid_y=custom, grid_z=auto, wavelength=1.5)Parameters
Section titled “Parameters”grid_x [GridType] = factory: AutoGrid |
|
Grid specification along x-axis |
grid_y [GridType] = factory: AutoGrid |
|
Grid specification along y-axis |
grid_z [GridType] = factory: AutoGrid |
|
Grid specification along z-axis |
wavelength [PositiveFloat | None] = None |
|
Free-space wavelength for automatic nonuniform grid. It can be |
override_structures [tuple[discriminated_union(StructureType), ...]] = () |
|
A set of structures that is added on top of the simulation structures in the process of generating the grid. This can be used to refine the grid or make it coarser depending than the expected need for higher/lower resolution regions. Note: it only takes effect when at least one of the three dimensions uses |
snapping_points [tuple[CoordinateOptional, ...]] = () |
|
A set of points that enforce grid boundaries to pass through them. However, some points might be skipped if they are too close. When points are very close to |
layer_refinement_specs [tuple[LayerRefinementSpec, ...]] = () |
|
Automatic mesh refinement according to layer specifications. The material distribution is assumed to be uniform inside the layer along the layer axis. Mesh can be refined around corners on the layer cross section, and around upper and lower bounds of the layer. |
Attributes
Section titled “Attributes”custom_grid_used [bool] |
|
True if any of the three dimensions uses |
external_override_structures [list[StructureType]] |
|
External supplied override structure list. |
override_structures_used [tuple[bool, bool, bool]] |
|
Along each axis, |
snapping_points_used [tuple[bool, bool, bool]] |
|
Along each axis, |
Methods
Section titled “Methods”all_override_structures(structures: list[Structure], wavelength: PositiveFloat, lumped_elements: list[LumpedElementType], boundary_types: tuple[tuple[str, str], tuple[str, str], tuple[str, str]], sim_bounds: tuple, structure_priority_mode: PriorityMode = 'equal', internal_override_structures: list[MeshOverrideStructure] | None = None) |
|
Internal and external mesh override structures sorted based on their priority. By default, the priority of internal override structures is -1, and 0 for external ones. |
all_snapping_points(structures: list[Structure], lumped_elements: list[LumpedElementType], boundary_types: tuple[tuple[str, str], tuple[str, str], tuple[str, str]], sim_bounds: tuple, internal_snapping_points: list[CoordinateOptional] | None = None) |
|
Internal and external snapping points. External snapping points take higher priority. So far, internal snapping points are generated by |
auto(wavelength: PositiveFloat = None, min_steps_per_wvl: PositiveFloat = 10.0, max_scale: PositiveFloat = 1.4, override_structures: list[StructureType] = (), snapping_points: tuple[CoordinateOptional, ...] = (), layer_refinement_specs: list[LayerRefinementSpec] = (), dl_min: NonNegativeFloat = 0.0, min_steps_per_sim_size: PositiveFloat = 10.0, mesher: MesherType = Undefined) |
|
Use the same |
auto_grid_used() |
|
True if any of the three dimensions uses |
from_grid(grid: Grid) |
|
Import grid directly from another simulation, e.g. |
get_wavelength(sources: list[SourceType]) |
|
Get wavelength for automatic mesh generation if needed. |
internal_override_structures(structures: list[Structure], wavelength: PositiveFloat, sim_bounds: tuple, lumped_elements: list[LumpedElementType], boundary_types: tuple[tuple[str, str], tuple[str, str], tuple[str, str]], cached_corners_and_convexity: list[CornersAndConvexity] | None = None, cached_merged_geos: list[tuple[Any, Shapely]] | None = None) |
|
Internal mesh override structures. So far, internal override structures are generated by |
internal_snapping_points(structures: list[Structure], lumped_elements: list[LumpedElementType], boundary_types: tuple[tuple[str, str], tuple[str, str], tuple[str, str]], sim_bounds: tuple, cached_corners_and_convexity: list[CornersAndConvexity] | None = None, cached_merged_geos: list[tuple[Any, Shapely]] | None = None) |
|
Internal snapping points. So far, internal snapping points are generated by |
layer_refinement_used() |
|
Whether layer_refiement_specs are applied. |
make_grid(structures: list[Structure], symmetry: tuple[Symmetry, Symmetry, Symmetry], periodic: tuple[bool, bool, bool], sources: list[SourceType], num_pml_layers: list[tuple[NonNegativeInt, NonNegativeInt]], lumped_elements: list[LumpedElementType] = (), internal_override_structures: list[MeshOverrideStructure] | None = None, internal_snapping_points: list[CoordinateOptional] | None = None, boundary_types: tuple[tuple[str, str], tuple[str, str], tuple[str, str]] = [[None, None], [None, None], [None, None]], structure_priority_mode: PriorityMode = 'equal') |
|
Make the entire simulation grid based on some simulation parameters. |
quasiuniform(dl: float, max_scale: PositiveFloat = 1.4, override_structures: list[StructureType] = (), snapping_points: tuple[CoordinateOptional, ...] = (), mesher: MesherType = Undefined) |
|
Use the same |
snapped_grid_used() |
|
True if any of the three dimensions uses |
uniform(dl: float) |
|
Use the same |
wavelength_from_sources(sources: list[SourceType]) |
|
Define a wavelength based on supplied sources. Called if auto mesh is used and |