yasfpy.mie_coefficients#

Mie coefficient generation utilities.

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

The coefficients computed here are the diagonal entries of each particle’s T-matrix in a vector-spherical-wave-function (VSWF) basis for homogeneous spheres (classical Mie scattering):

  • tau = 1 corresponds to one polarization family (often “TE”/”magnetic”)

  • tau = 2 corresponds to the other polarization family (often “TM”/”electric”)

The formulas follow standard Mie theory; see, e.g., [Bohren and Huffman, 1998] or [Mishchenko, 2002].

Functions#

compute_mie_coefficients(sim)

Compute diagonal Mie coefficients for unique (radius, material) pairs.

Module Contents#

yasfpy.mie_coefficients.compute_mie_coefficients(sim)#

Compute diagonal Mie coefficients for unique (radius, material) pairs.

Parameters:

sim – Simulation instance providing medium wavenumbers and particle material refractive indices. The results are stored on sim.

Return type:

None

Notes

This routine computes the diagonal spherical-particle T-matrix entries (Mie coefficients) for each unique (radius, material) pair found in sim.parameters.particles.

The legacy implementation in YASF called t_entry() for every (pair, tau, l) and then repeated the scalar coefficient for all m = -l..l. In typical geometries with many distinct radii, that created substantial overhead from repeated special-function evaluations.

This implementation reduces overhead by vectorizing the special-function evaluation:

  • evaluates spherical Bessel/Hankel functions for all l = 1..lmax on an outer (l, channel) grid

  • fills the (tau, l, m) blocks by slicing (no inner m loop)

The math is unchanged; only the computational structure differs.

The additional array sim.scatter_to_internal stores the ratio between internal-field and scattered-field coefficients used elsewhere in the solver.

References

Standard Mie scattering theory for homogeneous spheres: [Mishchenko, 2002, Bohren and Huffman, 1998].