Skip to content

treams_rs.ebcm

Surface integrals of the extended boundary condition method (EBCM).

Mirrors treams.ebcm. The Rust core evaluates the integrand at fixed quadrature nodes. Modes names the accepted mode arguments.

Modes

Modes = SphericalBasis | tuple[ArrayLike, ArrayLike, ArrayLike]

EBCM modes: a SphericalBasis at the origin, or (degree, order, pol) arrays.

qmat

qmat(r: Callable[[float], float], dr: Callable[[float], float], ks: ArrayLike, zs: ArrayLike, out: Modes, in_: Modes | None=None, singular: bool=True, *, order: int=96, radial_area_factor: bool=True) -> NDArray[np.complex128]

Surface integral Q of the extended boundary condition method (EBCM).

Mirrors treams.ebcm.qmat. The particle is rotationally symmetric about z, with surface radius r(theta) at polar angle theta. The T-matrix is -solve(Q, Q_regular), with Q from singular=True and Q_regular from singular=False.

qmat integrates over theta with order Gauss-Legendre nodes on [0, pi]. Increase order to check convergence for your shape and multipole degree. Use diff.ebcm_qmat or advect.ebcm_qmat for gradients with respect to sampled surfaces and materials.

Args

  • r: Surface radius as a function of the polar angle; positive.
  • dr: Derivative of r with respect to the polar angle.
  • ks: Wavenumbers, shape (2, 2): inside then outside, each as (negative, positive) helicity, for example Material.ks(k0).
  • zs: Relative impedances, shape (2,): inside then outside.
  • out: Destination modes: a SphericalBasis with one position at the origin, or (degree, order, pol) label arrays.
  • in_: Source modes in the same form; out when omitted.
  • singular: True pairs the regular waves inside with singular (outgoing) waves outside, for Q; False pairs them with regular waves, for Q_regular.
  • order: Number of quadrature nodes.
  • radial_area_factor: True keeps the second factor r of the surface element (r r_hat - dr theta_hat) r sin(theta) dtheta. False omits it and reproduces treams.ebcm.qmat.

Returns

Complex array of shape (len(out), len(in_)).

Differences from treams

treams integrates every element with adaptive quadrature (scipy.integrate.quad) and omits the second factor r of the surface element. radial_area_factor=False reproduces treams; the default recovers Mie coefficients for a sphere. out and in_ also accept a SphericalBasis.

A sphere recovers the Mie T-matrix:

import numpy as np
import treams_rs as tr

k0, radius = 1.3, 0.3
inside, outside = tr.Material(2.5), tr.Material(1)
ks = [inside.ks(k0), outside.ks(k0)]
zs = [inside.impedance, outside.impedance]
basis = tr.SphericalBasis.default(2)
q = tr.ebcm.qmat(lambda t: radius, lambda t: 0.0, ks, zs, basis)
q_regular = tr.ebcm.qmat(
    lambda t: radius, lambda t: 0.0, ks, zs, basis, singular=False
)
tmatrix = -np.linalg.solve(q, q_regular)
mie = tr.sphere_tmatrix(k0=k0, lmax=2, radius=radius, material=inside)
assert np.allclose(tmatrix, mie.array, atol=1e-12)