# Kernels¶

## Kernel interface¶

class sumpy.kernel.Kernel(dim)[source]

Basic kernel interface.

is_complex_valued
is_translation_invariant
dim
get_base_kernel()[source]

Return the kernel being wrapped by this one, or else self.

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 of get_expression() on the way to code generation.

get_expression(dist_vec)[source]

Return a sympy expression for the kernel.

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
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]

## PDE kernels¶

class sumpy.kernel.LaplaceKernel(dim)[source]
class sumpy.kernel.BiharmonicKernel(dim)[source]
class sumpy.kernel.HelmholtzKernel(dim, helmholtz_k_name='k', allow_evanescent=False)[source]
class sumpy.kernel.YukawaKernel(dim, yukawa_lambda_name='lam')[source]
class sumpy.kernel.StokesletKernel(dim, icomp, jcomp, viscosity_mu='mu', poisson_ratio='0.5')[source]
class sumpy.kernel.StressletKernel(dim, icomp, jcomp, kcomp, viscosity_mu='mu')[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

https://doi.org/10.1063/1.1745385

## Derivatives¶

These objects wrap other kernels and take derivatives of them in the process.

class sumpy.kernel.DerivativeBase(inner_kernel)[source]
class sumpy.kernel.AxisTargetDerivative(axis, inner_kernel)[source]
class sumpy.kernel.AxisSourceDerivative(axis, inner_kernel)[source]
class sumpy.kernel.DirectionalSourceDerivative(inner_kernel, dir_vec_name=None)[source]
class sumpy.kernel.DirectionalTargetDerivative(inner_kernel, dir_vec_name=None)[source]

## Transforming kernels¶

class sumpy.kernel.KernelMapper[source]
class sumpy.kernel.KernelCombineMapper[source]
class sumpy.kernel.KernelIdentityMapper[source]
class sumpy.kernel.AxisSourceDerivativeRemover[source]
class sumpy.kernel.AxisTargetDerivativeRemover[source]
class sumpy.kernel.SourceDerivativeRemover[source]
class sumpy.kernel.TargetDerivativeRemover[source]
class sumpy.kernel.DerivativeCounter[source]