From 0edf8c6e9fcb2ac5f318d5bccdc7c1c94b498f42 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 17 Mar 2025 11:30:25 -0500 Subject: [PATCH 1/2] Fix incorrect scaling of Yukawa kernel Noticed by Shawn Lin. Co-authored-by: Shawn Lin --- sumpy/kernel.py | 4 ++-- sumpy/version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sumpy/kernel.py b/sumpy/kernel.py index c4544ef5f..97c36b967 100644 --- a/sumpy/kernel.py +++ b/sumpy/kernel.py @@ -622,7 +622,7 @@ def __init__(self, dim, yukawa_lambda_name="lam"): expr = var("hankel_1")(0, var("I")*lam*r) scaling_for_K0 = var("pi")/2*var("I") # noqa: N806 - scaling = -1/(2*var("pi")) * scaling_for_K0 + scaling = 1/(2*var("pi")) * scaling_for_K0 elif dim == 3: # NOTE: to get the expression, we do the following and simplify # 1. express K(1/2, lam r) as a modified spherical Bessel function @@ -630,7 +630,7 @@ def __init__(self, dim, yukawa_lambda_name="lam"): # 2. or use (AS 10.2.17) directly expr = var("exp")(-lam*r) / r - scaling = -1/(4 * var("pi")**2) + scaling = 1/(4 * var("pi")) else: raise RuntimeError("unsupported dimensionality") diff --git a/sumpy/version.py b/sumpy/version.py index 81d1e3c72..8c4f151f9 100644 --- a/sumpy/version.py +++ b/sumpy/version.py @@ -41,4 +41,4 @@ def _parse_version(version: str) -> tuple[tuple[int, ...], str]: VERSION, VERSION_STATUS = _parse_version(VERSION_TEXT) _GIT_REVISION = find_module_git_revision(__file__, n_levels_up=1) -KERNEL_VERSION = (*VERSION, _GIT_REVISION, 0) +KERNEL_VERSION = (*VERSION, _GIT_REVISION, 1) From c692809b7249230d1d1d16ba57996b8fcb441902 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 24 Mar 2025 16:33:29 -0500 Subject: [PATCH 2/2] Add get_pde_as_diff_op to doc --- sumpy/kernel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sumpy/kernel.py b/sumpy/kernel.py index 97c36b967..a9d83f9fb 100644 --- a/sumpy/kernel.py +++ b/sumpy/kernel.py @@ -149,6 +149,7 @@ class Kernel: .. automethod:: get_global_scaling_const .. automethod:: get_args .. automethod:: get_source_args + .. automethod:: get_pde_as_diff_op """ if TYPE_CHECKING: