yasfpy.scattered_field_coefficients =================================== .. py:module:: yasfpy.scattered_field_coefficients .. autoapi-nested-parse:: 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 .. math:: 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. .. rubric:: 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``. .. rubric:: References Multiple-sphere scattering via VSWF bases and coupling operators is described in :cite:`Waterman-1971-ID50` and, in a modern implementation context, :cite:`Egel-2017-ID1`. Functions --------- .. autoapisummary:: yasfpy.scattered_field_coefficients.compute_scattered_field_coefficients Module Contents --------------- .. py:function:: compute_scattered_field_coefficients(sim, guess = None) Solve for scattered-field expansion coefficients. :param sim: Simulation instance with ``right_hand_side`` already assembled and a configured solver in ``sim.numerics.solver``. :param 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. :rtype: None .. rubric:: Notes This routine loops over wavelengths and builds a SciPy :class:`scipy.sparse.linalg.LinearOperator` compatible matvec (implemented via SciPy's internal ``_CustomLinearOperator`` wrapper). For each wavelength ``w``, it solves: .. math:: (I - T W) x_w = b_w, where ``b_w`` comes from ``sim.right_hand_side`` and the matvec routes through :meth:`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.