setup_adjoint_simulation#

PortFom.setup_adjoint_simulation(fdtd_session: FdtdSession, sources: list, sim_result: PortResults) None#

Configure the FDTD session for an adjoint port simulation.

Sets sim_result.monitor_name as the active source port for the adjoint run and updates port positions by one mesh cell to account for the monitor/source offset convention used by Lumerical.

Parameters:
fdtd_sessionFdtdSession

Active FDTD session to modify.

sourceslist

Unused for port-based simulations.

sim_resultPortResults

Port-based simulation result that defines which port monitor to use as the adjoint source.

Raises:
RuntimeError

If setting the source port fails.

RuntimeError

If the configuration entry for sim_result cannot be found in config_map.