fdtdx.setup_sparams_simulation

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:

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) where center_offset is the 3-D centre of the polygon in the core coordinate system (metres, origin at the start of the core region). The polygon’s partial_real_shape must be fully specified at construction time (no None entries).

  • input_ports (list[PortSpec]) – Ports that receive a ModePlaneSource.

  • output_ports (list[PortSpec]) – Ports that receive a ModeOverlapDetector.

  • 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 by place_objects(). Defaults to PRNGKey(0) when None. Usually not necessary to specify since simulation is deterministic.

Return type:

tuple[ObjectContainer, ArrayContainer, SimulationConfig]

Returns:

A 3-tuple (objects, arrays, config), ready to pass to calculate_sparam().