yasfpy.fields#

Sampling-point field evaluation.

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

Given computed scattered-field expansion coefficients (VSWF coefficients about particle centers), the main routine compute_fields() evaluates the scattered field at user-provided sampling points. For plane-wave illumination it also evaluates the incident field and reports the total field as incident plus scattered.

Notes

The evaluation relies on precomputed lookup tables for particle-to-point VSWF translations (computed via yasfpy.functions.misc.mutual_lookup()) and then dispatches to a CPU (Numba) or CUDA implementation.

References

The use of VSWFs and translation operators for multiple scattering is described in [Waterman, 1971] and in the CELES implementation context [Egel et al., 2017].

Functions#

compute_fields(sim, sampling_points)

Compute scattered (and optionally total) fields at sampling points.

Module Contents#

yasfpy.fields.compute_fields(sim, sampling_points)#

Compute scattered (and optionally total) fields at sampling points.

Parameters:
  • sim – Simulation instance providing particle positions, the computed scattered field coefficients (sim.scattered_field_coefficients), and configuration flags such as sim.numerics.gpu.

  • sampling_points – Array of Cartesian sampling points with shape (N, 3).

Return type:

None

Notes

This routine mutates sim by setting:

  • sim.sampling_points

  • sim.scattered_field (evaluated field at sampling points)

  • sim.initial_field_electric and sim.initial_field_magnetic for the plane-wave illumination case

  • sim.total_field_electric equal to incident plus scattered when an incident field is evaluated

The implementation computes particle-to-point lookup tables using yasfpy.functions.misc.mutual_lookup() (including Hankel-function derivatives) and then evaluates the field either via CPU/Numba (yasfpy.functions.cpu_numba.compute_field()) or CUDA (yasfpy.functions.cuda_numba.compute_field_gpu()).

When sim.numerics.particle_distance_resolution > 0, a radial interpolation scheme is used to reduce repeated special-function evaluation for large sampling grids.

References

VSWF translation-based field evaluation is consistent with CELES-style formulations [Egel et al., 2017].