Skip to content

flex_rf.tidy3d.BoundarySpec

Type: class Base(s): Tidy3dBaseModel

Specifies boundary conditions on each side of the domain and along each dimension.

This BoundarySpec object defines the boundary conditions applied on each of the 6 domain edges, and is provided as an input to the simulation.

A BoundarySpec consists of three Boundary objects, each defining the boundaries on the plus and minus side of each dimension. In most cases, one just wants to specify whether there are absorbing PML layers along any of the x, y, z dimensions. By default, tidy3d simulations have PML boundaries on all sides.

If we want to explicitly set the boundaries, we can use the all_sides method. This can be used to set any type of boundary condition on all sides of the simulation. We can also set PML on specified sides only by calling the pml method, e.g. BoundarySpec.pml( x=False, y=False, z=False). This will put PML along the dimensions defined as True, and set periodic boundaries along the other dimensions.

Practical Advice

Common boundary configurations:

  • PML on all sides: Default for most devices (waveguides, resonators, scatterers).
  • Periodic in x/y, PML in z: Infinite planar arrays (gratings, metasurfaces).
  • Bloch in x/y, PML in z: Oblique incidence on periodic structures.

Use pml as a convenience to set PML along selected dimensions and periodic along the rest.

x [Boundary] = factory: Boundary

Boundary condition on the plus and minus sides along the x axis. If None, periodic boundaries are applied. Default will change to PML in 2.0 so explicitly setting the boundaries is recommended.

y [Boundary] = factory: Boundary

Boundary condition on the plus and minus sides along the y axis. If None, periodic boundaries are applied. Default will change to PML in 2.0 so explicitly setting the boundaries is recommended.

z [Boundary] = factory: Boundary

Boundary condition on the plus and minus sides along the z axis. If None, periodic boundaries are applied. Default will change to PML in 2.0 so explicitly setting the boundaries is recommended.

all_sides(boundary: BoundaryEdge)

Set a given boundary condition on all six sides of the domain

dict_to_boundary(v: Any)

Convert dict representation to Boundary object if needed.

flipped_bloch_vecs()

Return a copy of the instance where all Bloch vectors are multiplied by -1.

pec(x: bool = False, y: bool = False, z: bool = False)

PEC along specified directions

pmc(x: bool = False, y: bool = False, z: bool = False)

PMC along specified directions

pml(x: bool = False, y: bool = False, z: bool = False)

PML along specified directions

to_list()

Returns edge-wise boundary conditions along each dimension for internal use.