How do I specify different boundary conditions on each simulation domain edge?

How do I specify different boundary conditions on each simulation domain edge?#

Date

Category

2023-12-15 21:23:27

Boundary Conditions

Use tidy3d.BoundarySpec to specify different boundary conditions to simulation edges. For example:


# Definition different boundary conditions.
bspec = tidy3d.BoundarySpec(
    x=tidy3d.Boundary(minus=tidy3d.PECBoundary(), plus=tidy3d.PECBoundary()),
    y=tidy3d.Boundary(minus=tidy3d.Periodic(), plus=tidy3d.Periodic()),
    z=tidy3d.Boundary(minus=tidy3d.PML(), plus=tidy3d.PMCBoundary()),
)

# Build the simulation.
sim = tidy3d.Simulation(
    center=(0, 0, 0),
    size=(2, 2, 10),
    boundary_spec=bspec,
    grid_spec=tidy3d.GridSpec.auto(min_steps_per_wvl=20, wavelength=1.55),
    structures=[unit_cell],
    sources=[plane_wave],
    monitors=[flux_monitor],
    run_time=1e-12,
)

See this notebook for more details on setting up boundary conditions.