tidy3d.EMEExplicitGrid#

class EMEExplicitGrid[source]#

Bases: EMEGridSpec

EME grid with explicitly defined internal boundaries.

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().

  • num_reps (PositiveInt = 1) – Number of periodic repetitions of this EME grid. Useful for efficiently simulating long periodic structures like Bragg gratings. Instead of explicitly repeating the cells, setting ‘num_reps’ allows the EME solver to reuse the modes and cell interface scattering matrices.

  • name (Optional[str] = None) – Name of this ‘EMEGridSpec’. Used in ‘EMEPeriodicitySweep’.

  • mode_specs (List[EMEModeSpec]) – Mode specifications for each cell in the explicit EME grid.

  • boundaries (ArrayLike[dtype=float, ndim=1]) – List of coordinates of internal cell boundaries along the propagation axis. Must contain one fewer item than ‘mode_specs’, and must be strictly increasing. Each cell spans the region between an adjacent pair of boundaries. The first (last) cell spans the region between the first (last) boundary and the simulation boundary.

Example

>>> from tidy3d import EMEExplicitGrid, EMEModeSpec
>>> mode_spec1 = EMEModeSpec(num_modes=10)
>>> mode_spec2 = EMEModeSpec(num_modes=20)
>>> eme_grid = EMEExplicitGrid(
...     mode_specs=[mode_spec1, mode_spec2],
...     boundaries=[1],
... )

Attributes

num_real_cells

Number of real cells in this EME grid spec.

attrs

Methods

from_structures(structures, axis, mode_spec, ...)

Create an explicit EME grid with boundaries aligned with structure bounding boxes.

make_grid(center, size, axis)

Generate EME grid from the EME grid spec.

Inherited Common Usage

mode_specs#
boundaries#
make_grid(center, size, axis)[source]#

Generate EME grid from the EME grid spec.

Parameters:
  • center (Coordinate) – Center of the EME simulation.

  • size (Size) – Size of the EME simulation.

  • axis (Axis) – Propagation axis for the EME simulation.

Returns:

An EME grid dividing the EME simulation into cells, as defined by the EME grid spec.

Return type:

EMEGrid

classmethod from_structures(structures, axis, mode_spec, **kwargs)[source]#

Create an explicit EME grid with boundaries aligned with structure bounding boxes. Every cell in the resulting grid has the same mode specification.

Parameters:
  • structures (List[Structure]) – A list of structures to define the EMEExplicitGrid. The EME grid boundaries will be placed at the lower and upper bounds of the bounding boxes of all the structures in the list.

  • axis (Axis) – Propagation axis for the EME simulation.

  • mode_spec (EMEModeSpec) – Mode specification for the EME grid. The same mode specification will be used in every cell in the resulting EMEExplicitGrid.

  • **kwargs – Other arguments passed to the new EMEExplicitGrid instance.

Returns:

Explicit EME grid with boundaries aligned with the structure bounding boxes.

Return type:

EMEExplicitGrid

Example

>>> from tidy3d import EMEModeSpec, Structure, Box, Medium
>>> mode_spec = EMEModeSpec(num_modes=1)
>>> box = Structure(
...     geometry=Box(center=(0, 0, 0), size=(1, 2, 3)),
...     medium=Medium(permittivity=5),
... )
>>> box2 = Structure(
...     geometry=Box(center=(0, 0, 4), size=(1, 2, 3)),
...     medium=Medium(permittivity=5),
... )
>>> eme_grid_spec = EMEExplicitGrid.from_structures(
...     structures=[box, box2],
...     axis=2,
...     mode_spec=mode_spec
... )
property num_real_cells#

Number of real cells in this EME grid spec.

__hash__()#

Hash method.