PortFom#
- class lumopt2.fom.port_fom.PortFom(sim_results, fct=None)#
Figure of merit calculator for port-based (waveguide mode) simulations.
Inherits all shared FOM logic from
BaseFomand specializes adjoint source setup, adjoint field scaling, and port position management for port-based monitors.- Parameters:
- sim_results
PortResultsorlistofPortResults One or more port monitor result objects.
- fct
callable(),optional Scalar-valued function of the monitor values. Defaults to
PNorm()with default parameters (target=1, p=1, weights=1), applied element-wise to each monitor.
- sim_results
Methods
PortFom.calculate_fom(fdtd_session)Compute the figure of merit using the user-defined function and monitor results.
Compute the gradient of the FOM with respect to permittivity using adjoint fields.
Create the project folder based on the project name in the config map.
PortFom.get_adjoint_fields(fdtd_session, entry)Extract and scale adjoint fields for port-based simulation, one per wavelength.
PortFom.get_jacobian(fdtd_session)Compute the Jacobian of the FOM with respect to monitor result values.
PortFom.get_scaling_factor(fdtd_session, ...)Compute a per-wavelength scaling factor for the adjoint gradient (port-based).
PortFom.set_project_name(project_name)Set the project name used to determine the simulation output folder.
Configure the FDTD session for an adjoint port simulation.
Attributes
Port-based adjoint sources are independent of forward simulation results, so forward and adjoint simulations can be queued and run simultaneously.