volumential.wranglers.sumpy_backend#
The sumpy-based fpnd expansion wrangler.
fpnd = far field by Particle approximation, Near field Directly from
precomputed interaction tables. This module owns the sumpy flavour of that
wrangler plus its tree-independent data, and the default aliases exported as
FPNDExpansionWrangler / FPNDTreeIndependentDataForWrangler.
- class volumential.wranglers.sumpy_backend.FPNDSumpyTreeIndependentDataForWrangler(cl_context, multipole_expansion_factory, local_expansion_factory, target_kernels, exclude_self=True, use_rscale=None, strength_usage=None, source_kernels=None)[source]#
Bases:
TreeIndependentDataForWranglerInterface,SumpyTreeIndependentDataForWranglerObjects of this type serve as a place to keep the code needed for ExpansionWrangler if it is using sumpy to perform multipole expansion and manipulations.
Since
SumpyExpansionWranglernecessarily must have apyopencl.CommandQueue, but this queue is allowed to be more ephemeral than the code, the code’s lifetime is decoupled by storing it in this object.- get_wrangler(queue, traversal, dtype, fmm_level_to_order, source_extra_kwargs=None, kernel_extra_kwargs=None, self_extra_kwargs=None, *args, **kwargs) FPNDSumpyExpansionWrangler[source]#
Build a queue-bound wrangler for traversal.
- Returns:
- class volumential.wranglers.sumpy_backend.FPNDSumpyExpansionWrangler(tree_indep, queue, traversal, dtype, fmm_level_to_order, near_field_table, quad_order, potential_kind=1, source_extra_kwargs=None, kernel_extra_kwargs=None, self_extra_kwargs=None, list1_extra_kwargs=None, helmholtz_split=None, helmholtz_split_order=1, helmholtz_split_smooth_quad_order=None, helmholtz_split_auto_config=None, helmholtz_split_term_tables=None, helmholtz_split_order1_legacy_subtraction=False, translation_classes_data=None, preprocessed_mpole_dtype=None)[source]#
Bases:
ExpansionWranglerInterface,NearFieldPayloadCacheMixin,HelmholtzSplitCorrectionMixin,SumpyExpansionWranglerThis expansion wrangler uses “fpnd” strategy. That is, Far field is computed via Particle approximation and Near field is computed Directly. The FMM is performed using sumpy backend.
For Helmholtz split mode, neighbor-list (list1) interactions are evaluated with the decomposition
\[G_k(r) = G_0(r) + S_p(r) + R_p(r),\]where
G_0is tabulated by Laplace near-field tables,S_pis the sum of pretabulated non-smooth split terms, andR_pis an analytic remainder evaluated online by P2P.Split terms kept in
S_pare:2D: \(r^{2n}\log r\), \(n=1,\dots,p-1\).
3D: \(r^{2j-1}\), \(j=1,\dots,p-1\).
Smooth polynomial terms (2D: constant and \(r^{2n}\); 3D: even powers including constant) remain in
R_p.- source_extra_kwargs#
Keyword arguments to be passed to interactions that involve the source field.
- kernel_extra_kwargs#
Keyword arguments to be passed to interactions that involve expansions, but not the source field.
- self_extra_kwargs#
Keyword arguments to be passed for handling self interactions (singular integrals)
- multipole_expansion_zeros(actx=None) Any[source]#
Zeroed multipole-expansion storage, on actx or the wrangler’s own.
- local_expansion_zeros(actx=None) Any[source]#
Zeroed local-expansion storage, on actx or the wrangler’s own.
- reorder_sources(source_array: Any) Any[source]#
Return source_array, given in user order, in tree source order.
- reorder_targets(target_array: Any) Any[source]#
Return target_array permuted by the tree’s target ordering.
- reorder_potentials(potentials: Any) Any[source]#
Return potentials, given in tree order, in user target order.
- finalize_potentials(potentials: Any) Any[source]#
Apply sumpy’s global scaling to the reordered potentials.
- form_multipoles(level_start_source_box_nrs: Any, source_boxes: Any, src_weights: Any) Any[source]#
P2M: form multipole expansions in source_boxes.
- coarsen_multipoles(level_start_source_parent_box_nrs: Any, source_parent_boxes: Any, mpoles: Any) Any[source]#
M2M: accumulate child multipole expansions into their parents.
- eval_direct_single_out_kernel(out_pot: Any, out_kernel, target_boxes: Any, neighbor_source_boxes_starts: Any, neighbor_source_boxes_lists: Any, mode_coefs: Any, near_field_tables=None, list1_extra_kwargs=None) tuple[Any, object][source]#
Near-field (list 1) contribution to out_pot for one target kernel.
The interaction is read out of the precomputed tables instead of being evaluated point by point. Returns
(out_pot, event).
- eval_direct(target_boxes: Any, neighbor_source_boxes_starts: Any, neighbor_source_boxes_lists: Any, mode_coefs: Any) Any[source]#
Near-field stage: one table-based pass per target kernel.
- multipole_to_local(level_start_target_box_nrs: Any, target_boxes: Any, src_box_starts: Any, src_box_lists: Any, mpole_exps: Any) Any[source]#
M2L: translate list-2 multipole expansions into local expansions.
- eval_multipoles(target_boxes_by_source_level: Any, source_boxes_by_level: Any, mpole_exps: Any) Any[source]#
M2P: evaluate list-3 multipole expansions at the targets.
- form_locals(level_start_target_or_target_parent_box_nrs: Any, target_or_target_parent_boxes: Any, starts: Any, lists: Any, src_weights: Any) Any[source]#
P2L: form local expansions from the list-4 sources.
- refine_locals(level_start_target_or_target_parent_box_nrs: Any, target_or_target_parent_boxes: Any, local_exps: Any) Any[source]#
L2L: push each parent’s local expansion down to its children.
- class volumential.wranglers.sumpy_backend.FPNDTreeIndependentDataForWrangler(cl_context, multipole_expansion_factory, local_expansion_factory, target_kernels, exclude_self=True, use_rscale=None, strength_usage=None, source_kernels=None)[source]#
Bases:
FPNDSumpyTreeIndependentDataForWranglerThe default tree-independent-data class.
- class volumential.wranglers.sumpy_backend.FPNDExpansionWrangler(tree_indep, queue, traversal, dtype, fmm_level_to_order, near_field_table, quad_order, potential_kind=1, source_extra_kwargs=None, kernel_extra_kwargs=None, self_extra_kwargs=None, list1_extra_kwargs=None, helmholtz_split=None, helmholtz_split_order=1, helmholtz_split_smooth_quad_order=None, helmholtz_split_auto_config=None, helmholtz_split_term_tables=None, helmholtz_split_order1_legacy_subtraction=False, translation_classes_data=None, preprocessed_mpole_dtype=None)[source]#
Bases:
FPNDSumpyExpansionWranglerThe default wrangler class.