Differentiation and EvaluationΒΆ
Visualization of PotentialsΒΆ
-
sumpy.visualization.
make_field_plotter_from_bbox
(bbox, h, extend_factor=0)[source]ΒΆ - Parameters
bbox β a tuple (low, high) of points represented as 1D numpy arrays indicating the low and high ends of the extent of a bounding box.
h β Either a number or a sequence of numbers indicating the desired (approximate) grid spacing in all or each of the dimensions. If a sequence, the length must match the number of dimensions.
extend_factor β A floating point number indicating by what percentage the plot area should be grown compared to bbox.
Differentiation of PotentialsΒΆ
-
class
sumpy.point_calculus.
CalculusPatch
(center, h=0.1, order=4, nodes='chebyshev')[source]ΒΆ Sets up a grid of points on which derivatives can be calculated. Useful to verify that an evaluated potential actually solves a PDE.
-
dim
ΒΆ
-
points
ΒΆ shape:
(dim, npoints_total)
-
diff
(axis, f_values, nderivs=1)[source]ΒΆ Return the derivative along axis of f_values.
- Parameters
f_values β an array of shape
(npoints_total,)
- Returns
an array of shape
(npoints_total,)
-
laplace
(f_values)[source]ΒΆ Return the Laplacian of f_values.
- Parameters
f_values β an array of shape
(npoints_total,)
- Returns
an array of shape
(npoints_total,)
-
div
(arg)[source]ΒΆ - Parameters
arg β an object array containing
numpy.ndarray
s with shape(npoints_total,)
.
-
curl
(arg)[source]ΒΆ Take the curl of the vector quantity arg.
- Parameters
arg β an object array of shape
(3,)
containingnumpy.ndarray
s with shape(npoints_total,)
.
-
eval_at_center
(f_values)[source]ΒΆ Interpolate f_values to the center point.
- Parameters
f_values β an array of shape
(npoints_total,)
- Returns
a scalar.
-
x
ΒΆ
-
y
ΒΆ
-
z
ΒΆ
-
Support for Numerical Experiments with ExpansionsΒΆ
This module provides a convenient interface for numerical experiments with local and multipole expansions.
-
class
sumpy.toys.
ToyContext
(cl_context, kernel, mpole_expn_class=None, local_expn_class=None, expansion_factory=None, extra_source_kwargs=None, extra_kernel_kwargs=None)[source]ΒΆ This class functions as a container for generated code and βbehind-the-scenesβ information.
-
class
sumpy.toys.
PotentialSource
(toy_ctx)[source]ΒΆ A base class for all classes representing potentials that can be evaluated anywhere in space.
Supports (lazy) arithmetic:
-
__radd__
(other)ΒΆ
-
__rmul__
(other)ΒΆ
-
-
class
sumpy.toys.
PointSources
(toy_ctx, points, weights, center=None)[source]ΒΆ -
points
ΒΆ [ndim, npoints]
-
These functions manipulate these potentials:
-
sumpy.toys.
combine_halfspace_and_outer
(psource_pos, psource_neg, psource_outer, axis, radius=None, center=None)[source]ΒΆ
These functions help with plotting:
-
sumpy.toys.
draw_annotation
(to_pt, from_pt, label, arrowprops={}, **kwargs)[source]ΒΆ - Parameters
to_pt β Head of arrow
from_pt β Tail of arrow
label β Annotation label
arrowprops β Passed to arrowprops
kwargs β Passed to annotate
These are created behind the scenes and are not typically directly instantiated by users:
-
class
sumpy.toys.
ExpansionPotentialSource
(toy_ctx, center, rscale, order, coeffs, derived_from, radius=None, expn_style=None, text_kwargs=None)[source]ΒΆ -
radius
ΒΆ Not used mathematically. Just for visualization, purely advisory.
-
text_kwargs
ΒΆ Passed to
matplotlib.pyplot.annotate()
. Used for customizing the expansion label. Changing the label text is supported by passing the kwarg s. Just for visualization, purely advisory.
-
-
class
sumpy.toys.
MultipoleExpansion
(toy_ctx, center, rscale, order, coeffs, derived_from, radius=None, expn_style=None, text_kwargs=None)[source]ΒΆ