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 BaseFom and specializes adjoint source setup, adjoint field scaling, and port position management for port-based monitors.

Parameters:
sim_resultsPortResults or list of PortResults

One or more port monitor result objects.

fctcallable(), 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.

Methods

PortFom.calculate_fom(fdtd_session)

Compute the figure of merit using the user-defined function and monitor results.

PortFom.calculate_gradient_fields(...)

Compute the gradient of the FOM with respect to permittivity using adjoint fields.

PortFom.create_project_folder()

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.

PortFom.setup_adjoint_simulation(...)

Configure the FDTD session for an adjoint port simulation.

Attributes

PortFom.supports_concurrent_adjoint

Port-based adjoint sources are independent of forward simulation results, so forward and adjoint simulations can be queued and run simultaneously.