tidy3d.BoundarySpec#
- class BoundarySpec[source]#
Bases:
Tidy3dBaseModelSpecifies boundary conditions on each side of the domain and along each dimension.
- 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,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().x (Boundary = Boundary(attrs={}, plus=PML(attrs={},, name=None,, type='PML',, num_layers=12,, parameters=PMLParams(attrs={},, sigma_order=3,, sigma_min=0.0,, sigma_max=1.5,, type='PMLParams',, kappa_order=3,, kappa_min=1.0,, kappa_max=3.0,, alpha_order=1,, alpha_min=0.0,, alpha_max=0.0)), minus=PML(attrs={},, name=None,, type='PML',, num_layers=12,, parameters=PMLParams(attrs={},, sigma_order=3,, sigma_min=0.0,, sigma_max=1.5,, type='PMLParams',, kappa_order=3,, kappa_min=1.0,, kappa_max=3.0,, alpha_order=1,, alpha_min=0.0,, alpha_max=0.0)), type='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 = Boundary(attrs={}, plus=PML(attrs={},, name=None,, type='PML',, num_layers=12,, parameters=PMLParams(attrs={},, sigma_order=3,, sigma_min=0.0,, sigma_max=1.5,, type='PMLParams',, kappa_order=3,, kappa_min=1.0,, kappa_max=3.0,, alpha_order=1,, alpha_min=0.0,, alpha_max=0.0)), minus=PML(attrs={},, name=None,, type='PML',, num_layers=12,, parameters=PMLParams(attrs={},, sigma_order=3,, sigma_min=0.0,, sigma_max=1.5,, type='PMLParams',, kappa_order=3,, kappa_min=1.0,, kappa_max=3.0,, alpha_order=1,, alpha_min=0.0,, alpha_max=0.0)), type='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 = Boundary(attrs={}, plus=PML(attrs={},, name=None,, type='PML',, num_layers=12,, parameters=PMLParams(attrs={},, sigma_order=3,, sigma_min=0.0,, sigma_max=1.5,, type='PMLParams',, kappa_order=3,, kappa_min=1.0,, kappa_max=3.0,, alpha_order=1,, alpha_min=0.0,, alpha_max=0.0)), minus=PML(attrs={},, name=None,, type='PML',, num_layers=12,, parameters=PMLParams(attrs={},, sigma_order=3,, sigma_min=0.0,, sigma_max=1.5,, type='PMLParams',, kappa_order=3,, kappa_min=1.0,, kappa_max=3.0,, alpha_order=1,, alpha_min=0.0,, alpha_max=0.0)), type='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.
Notes
This
BoundarySpecobject defines the boundary conditions applied on each of the 6 domain edges, and is provided as an input to the simulation.A
BoundarySpecconsists of threeBoundaryobjects, each defining the boundaries on the plus and minus side of each dimension. In most cases, one just wants to specify whether there are absorbingPMLlayers along any of thex,y,zdimensions. By default,tidy3dsimulations havePMLboundaries on all sides.If we want to explicitly set the boundaries, we can use the
tidy3d.BoundarySpec.all_sidesmethod. This can be used to set any type of boundary condition on all sides of the simulation. We can also setPMLon specified sides only by calling thetidy3d.BoundarySpec.pmlmethod, e.g.BoundarySpec.pml( x=False, y=False, z=False). This will putPMLalong the dimensions defined asTrue, and set periodic boundaries along the other dimensions.See also
BoundaryBoundary conditions at the minus and plus extents along a dimension.
- Notebooks
- Lectures
Attributes
Return a copy of the instance where all Bloch vectors are multiplied by -1.
Returns edge-wise boundary conditions along each dimension for internal use.
Methods
all_sides(boundary)Set a given boundary condition on all six sides of the domain
pec([x,Β y,Β z])PEC along specified directions
pmc([x,Β y,Β z])PMC along specified directions
pml([x,Β y,Β z])PML along specified directions
Inherited Common Usage
- x#
- y#
- z#
- classmethod pml(x=False, y=False, z=False)[source]#
PML along specified directions
- Parameters:
x (bool = False) β Toggle whether to set a default PML on both plus and minus sides along the x axis.
y (bool = False) β Toggle whether to set a default PML on both plus and minus sides along the y axis.
z (bool = False) β Toggle whether to set a default PML on both plus and minus sides along the z axis.
Example
>>> boundaries = BoundarySpec.pml(y=True)
- classmethod pec(x=False, y=False, z=False)[source]#
PEC along specified directions
- Parameters:
x (bool = False) β Toggle whether to set a PEC condition on both plus and minus sides along the x axis.
y (bool = False) β Toggle whether to set a PEC condition on both plus and minus sides along the y axis.
z (bool = False) β Toggle whether to set a PEC condition on both plus and minus sides along the z axis.
Example
>>> boundaries = BoundarySpec.pec(x=True, z=True)
- classmethod pmc(x=False, y=False, z=False)[source]#
PMC along specified directions
- Parameters:
x (bool = False) β Toggle whether to set a PMC condition on both plus and minus sides along the x axis.
y (bool = False) β Toggle whether to set a PMC condition on both plus and minus sides along the y axis.
z (bool = False) β Toggle whether to set a PMC condition on both plus and minus sides along the z axis.
Example
>>> boundaries = BoundarySpec.pmc(x=True, z=True)
- classmethod all_sides(boundary)[source]#
Set a given boundary condition on all six sides of the domain
- Parameters:
boundary (
BoundaryEdge) β Boundary condition to apply on all six sides of the domain.
Example
>>> boundaries = BoundarySpec.all_sides(boundary=PML())
- property to_list#
Returns edge-wise boundary conditions along each dimension for internal use.
- __hash__()#
Hash method.
- property flipped_bloch_vecs#
Return a copy of the instance where all Bloch vectors are multiplied by -1.