yasfpy.fields ============= .. py:module:: yasfpy.fields .. autoapi-nested-parse:: 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 :func:`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. .. rubric:: Notes The evaluation relies on precomputed lookup tables for particle-to-point VSWF translations (computed via :func:`yasfpy.functions.misc.mutual_lookup`) and then dispatches to a CPU (Numba) or CUDA implementation. .. rubric:: References The use of VSWFs and translation operators for multiple scattering is described in :cite:`Waterman-1971-ID50` and in the CELES implementation context :cite:`Egel-2017-ID1`. Functions --------- .. autoapisummary:: yasfpy.fields.compute_fields Module Contents --------------- .. py:function:: compute_fields(sim, sampling_points) Compute scattered (and optionally total) fields at sampling points. :param sim: Simulation instance providing particle positions, the computed scattered field coefficients (``sim.scattered_field_coefficients``), and configuration flags such as ``sim.numerics.gpu``. :param sampling_points: Array of Cartesian sampling points with shape ``(N, 3)``. :rtype: None .. rubric:: 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 :func:`yasfpy.functions.misc.mutual_lookup` (including Hankel-function derivatives) and then evaluates the field either via CPU/Numba (:func:`yasfpy.functions.cpu_numba.compute_field`) or CUDA (:func:`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. .. rubric:: References VSWF translation-based field evaluation is consistent with CELES-style formulations :cite:`Egel-2017-ID1`.