yasfpy.scattered_field_coefficients#

Linear-system solve for scattered field coefficients.

This module contains the implementation that used to live in yasfpy.simulation.Simulation.compute_scattered_field_coefficients, extracted to keep simulation.py smaller.

In the multiple-scattering formulation used by YASF, the unknown scattered-field expansion coefficients are obtained by solving a linear system involving the “master” operator

\[M = I - T W,\]

where T is the (block-diagonal) particle T-matrix and W is the coupling operator encoding translations between particle-centered VSWF bases.

Notes

This module does not implement a specific Krylov method itself; it wraps the solver configured in sim.numerics.solver and provides a SciPy LinearOperator matvec that delegates to sim.master_matrix_multiply.

References

Multiple-sphere scattering via VSWF bases and coupling operators is described in [Waterman, 1971] and, in a modern implementation context, [Egel et al., 2017].

Functions#

compute_scattered_field_coefficients(sim[, guess])

Solve for scattered-field expansion coefficients.

Module Contents#

yasfpy.scattered_field_coefficients.compute_scattered_field_coefficients(sim, guess=None)#

Solve for scattered-field expansion coefficients.

Parameters:
  • sim – Simulation instance with right_hand_side already assembled and a configured solver in sim.numerics.solver.

  • guess –

    Optional initial guess for the scattered-field coefficients.

    • If provided, guess[:, :, w] is used for each wavelength w.

    • If not provided, the implementation defaults to starting from the RHS. If enabled, subsequent wavelengths may warm-start from the previous wavelength’s solution.

Return type:

None

Notes

This routine loops over wavelengths and builds a SciPy scipy.sparse.linalg.LinearOperator compatible matvec (implemented via SciPy’s internal _CustomLinearOperator wrapper).

For each wavelength w, it solves:

\[(I - T W) x_w = b_w,\]

where b_w comes from sim.right_hand_side and the matvec routes through yasfpy.simulation.Simulation.master_matrix_multiply().

Solver statistics (matvec call count and time) are logged. When sim._matvec_detail_enabled is set, a timing breakdown of selected sub-operations is logged at DEBUG level.