fdtdx.setup_sparams_simulation#
- fdtdx.setup_sparams_simulation(polygons, input_ports, output_ports, wavelength, resolution, max_time, domain_size, background_material=None, pml_layers=10, key=None)[source]#
Set up an FDTD simulation scene for S-parameter extraction.
Builds a fully initialised simulation scene containing:
A background
SimulationVolumesurrounded by PML absorbing boundaries on all six sides.Any GDS-derived
ExtrudedPolygonobjects placed at their requested positions.A
ModePlaneSourcefor every input port.A
ModeOverlapDetectorfor every output port.
To compute the full S-matrix, call this function once per input port (each time with a single entry in input_ports) and collect the detector readings.
- Parameters:
polygons (
list[tuple[ExtrudedPolygon,tuple[float,float,float]]]) – Pairs of(ExtrudedPolygon, center_offset)wherecenter_offsetis the 3-D centre of the polygon in the core coordinate system (metres, origin at the start of the core region). The polygon’spartial_real_shapemust be fully specified at construction time (noNoneentries).input_ports (
list[PortSpec]) – Ports that receive aModePlaneSource.output_ports (
list[PortSpec]) – Ports that receive aModeOverlapDetector.wavelength (
float) – Free-space wavelength in metres.resolution (
float) – Spatial resolution (voxel size) in metres.max_time (
float) – Total simulation time in seconds.domain_size (
tuple[float,float,float]) – Size of the core simulation region (excluding PML) as(Lx, Ly, Lz)in metres.background_material (
Material|None) – Material filling the simulation volume. Defaults to air (Material()).pml_layers (
int) – Number of PML grid cells added to every face.key (
Array|None) – JAX random key used byplace_objects(). Defaults toPRNGKey(0)whenNone. Usually not necessary to specify since simulation is deterministic.
- Return type:
- Returns:
A 3-tuple
(objects, arrays, config), ready to pass tocalculate_sparam().