Kernels#
Kernel interface#
- class sumpy.kernel.Kernel(dim)[source]#
Basic kernel interface.
- is_complex_valued#
- is_translation_invariant#
- dim#
- replace_base_kernel(new_base_kernel)[source]#
Return the base kernel being wrapped by this one, or else new_base_kernel.
- prepare_loopy_kernel(loopy_knl)[source]#
Apply some changes (such as registering function manglers) to the kernel. Return the new kernel.
- get_code_transformer()[source]#
Return a function to postprocess the
pymbolic
expression generated from the result ofget_expression()
on the way to code generation.
- postprocess_at_source(expr, avec)[source]#
Transform a kernel evaluation or expansion expression in a place where the vector a (something - source) is known. (“something” may be an expansion center or a target.)
The typical use of this function is to apply source-variable derivatives to the kernel.
- postprocess_at_target(expr, bvec)[source]#
Transform a kernel evaluation or expansion expression in a place where the vector b (target - something) is known. (“something” may be an expansion center or a target.)
The typical use of this function is to apply target-variable derivatives to the kernel.
- Parameters:
expr – may be a
sympy.core.expr.Expr
or asumpy.derivative_taker.DifferentiatedExprDerivativeTaker
.
- get_global_scaling_const()[source]#
Return a global scaling constant of the kernel. Typically, this ensures that the kernel is scaled so that \(\mathcal L(G)(x)=C\delta(x)\) with a constant of 1, where \(\mathcal L\) is the PDE operator associated with the kernel. Not to be confused with rscale, which keeps expansion coefficients benignly scaled.
- get_args()[source]#
Return list of
KernelArgument
instances describing extra arguments used by the kernel.
- get_source_args()[source]#
Return list of
KernelArgument
instances describing extra arguments used by kernel in picking up contributions from point sources.
- class sumpy.kernel.KernelArgument(loopy_arg)[source]#
- loopy_arg#
A
loopy.KernelArgument
instance describing the type, name, and other features of this kernel argument when passed to a generated piece of code.
Symbolic kernels#
- class sumpy.kernel.ExpressionKernel(dim, expression, global_scaling_const, is_complex_valued)[source]#
- expression#
A
pymbolic
expression depending on variables d_1 through d_N where N equals dim. (These variables match what is returned frompymbolic.primitives.make_sym_vector()
with argument “d”.) Any variable that is not d or aSpatialConstant
will be viewed as potentially spatially varying.
- global_scaling_const#
A constant
pymbolic
expression for the global scaling of the kernel. Typically, this ensures that the kernel is scaled so that \(\mathcal L(G)(x)=C\delta(x)\) with a constant of 1, where \(\mathcal L\) is the PDE operator associated with the kernel. Not to be confused with rscale, which keeps expansion coefficients benignly scaled.
- is_complex_valued#
- get_expression(scaled_dist_vec)[source]#
Return
expression
as asumpy.symbolic.Basic
.
PDE kernels#
- class sumpy.kernel.StokesletKernel(dim, icomp, jcomp, viscosity_mu='mu', poisson_ratio='0.5')[source]#
- class sumpy.kernel.ElasticityKernel(dim, icomp, jcomp, viscosity_mu='mu', poisson_ratio='nu')[source]#
- class sumpy.kernel.LineOfCompressionKernel(dim=3, axis=2, viscosity_mu='mu', poisson_ratio='nu')[source]#
A kernel for the line of compression or dilatation of constant strength along the axis “axis” from zero to negative infinity. This is used for the explicit solution to half-space Elasticity problem. See [1] for details.
- [1]: Mindlin, R.: Force at a Point in the Interior of a Semi-Infinite Solid
Derivatives#
These objects wrap other kernels and take derivatives of them in the process.