yasfpy.lookups#
Lookup-table generation for simulations.
This module contains functionality extracted from yasfpy.simulation.Simulation so that simulation.py can stay focused on orchestration.
The lookup tables produced here are used by coupling backends to avoid repeated special-function evaluation and to precompute geometric terms (relative positions, azimuthal phases, and associated Legendre polynomials) for the vector-spherical-wave-function (VSWF) translation operators.
The legacy_* helpers are preserved as-is; they originate from the Matlab
CELES framework [Egel et al., 2017] and are not used by YASF in typical runs.
Functions#
Compute distance sampling points for a legacy Hankel lookup table. |
|
Compute a legacy spherical Hankel lookup table. |
|
|
Create the (particle, n, tau, l, m) index lookup table. |
|
Compute pairwise lookup tables used by coupling backends. |
Module Contents#
- yasfpy.lookups.legacy_compute_lookup_particle_distances(sim)#
Compute distance sampling points for a legacy Hankel lookup table.
- Parameters:
sim – Simulation-like object that will receive a
lookup_particle_distancesattribute.
Notes
This helper exists for parity with legacy CELES-style input generation and YAML/Matlab compatibility [Egel et al., 2017].
The resulting distances include an extra leading
0to keep the original interpolation scheme stable near the origin.
- yasfpy.lookups.legacy_compute_h3_table(sim)#
Compute a legacy spherical Hankel lookup table.
- Parameters:
sim – Simulation-like object with
lookup_particle_distancesand wavelength-dependent medium wavenumbersparameters.k_medium.
Notes
Populates
sim.h3_tablewith values of\[h_l^{(1)}(k r) = j_l(k r) + i y_l(k r),\]for
l = 0 .. 2*lmaxand the configured sampling radii.This is kept only for compatibility with legacy CELES-derived workflows [Egel et al., 2017].
- yasfpy.lookups.compute_idx_lookup(sim)#
Create the (particle, n, tau, l, m) index lookup table.
- Parameters:
sim – Simulation-like object that provides
numerics.lmaxandparameters.particles.numberand will receive anidx_lookupattribute.
Notes
The
idx_lookuptable maps the flattened unknown indexjto a tuple(s, n, tau, l, m)(particle index, VSWF mode index, polarization, degree, order). It is used by dense coupling backends to turn the matvec\[(W x)_j = \sum_k W_{j k} x_k\]into structured loops over VSWF indices.
- yasfpy.lookups.compute_lookups(sim)#
Compute pairwise lookup tables used by coupling backends.
- Parameters:
sim – Simulation-like object providing
numerics.lmax, particle positions, and medium wavenumbers (parameters.k_medium). The function writes the lookup arrays ontosim.
Notes
This function calls
yasfpy.functions.misc.mutual_lookup()to compute a set of geometric and special-function tables for all particle pairs.The produced attributes:
sim.sph_j: spherical Bessel functionsj_l(k r).sim.sph_h: spherical Hankel functionsh_l^{(1)}(k r).sim.e_j_dm_phi: azimuthal phase factorsexp(i (m-m') phi).sim.plm: normalized associated Legendre terms.
These terms are building blocks for VSWF translation operators and are used by the dense coupling implementations (CPU/Numba and CUDA) to assemble or apply inter-particle interaction blocks.
References
The overall CELES-style formulation using VSWFs and pairwise translation is described in [Egel et al., 2017].