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
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#
|
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_sidealready assembled and a configured solver insim.numerics.solver.guess –
Optional initial guess for the scattered-field coefficients.
If provided,
guess[:, :, w]is used for each wavelengthw.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.LinearOperatorcompatible matvec (implemented via SciPy’s internal_CustomLinearOperatorwrapper).For each wavelength
w, it solves:\[(I - T W) x_w = b_w,\]where
b_wcomes fromsim.right_hand_sideand the matvec routes throughyasfpy.simulation.Simulation.master_matrix_multiply().Solver statistics (matvec call count and time) are logged. When
sim._matvec_detail_enabledis set, a timing breakdown of selected sub-operations is logged at DEBUG level.