Skip to content

Find derivative recurrences from PDE (via parametric derivative taking)#204

Open
hirish99 wants to merge 8 commits intoinducer:mainfrom
hirish99:parametric_recurrence
Open

Find derivative recurrences from PDE (via parametric derivative taking)#204
hirish99 wants to merge 8 commits intoinducer:mainfrom
hirish99:parametric_recurrence

Conversation

@hirish99
Copy link
Contributor

Revised version of #202, using parametric approach to compute recurrences for derivatives.

@inducer inducer changed the title Add functionality to find derivative recurrences from PDE Add functionality to find derivative recurrences from PDE (via parametric derivative taking) Jul 15, 2024
@hirish99
Copy link
Contributor Author

Requesting review @inducer

@hirish99
Copy link
Contributor Author

Request review @inducer

@inducer inducer force-pushed the parametric_recurrence branch from f77f639 to e363248 Compare July 29, 2024 21:06
@inducer inducer changed the title Add functionality to find derivative recurrences from PDE (via parametric derivative taking) Find derivative recurrences from PDE (via parametric derivative taking) Aug 5, 2024
@hirish99
Copy link
Contributor Author

Request review

# Sort terms and create idx_l
idx_l = []
for i in range(len(terms)):
tms = list(terms[i].atoms(sp.Number))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Carefully destructure term for correctness.

@@ -0,0 +1,83 @@
from sumpy.expansion.diff_op import (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add license header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

return result_qbx


def _qbx_lp_laplace_general(sources, targets, centers, radius, strengths, order):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify with the Helmholtz case?

return sources, centers, normals, density, h, radius


def test_recurrence_laplace_2d_ellipse():
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify with Helmholtz case?

Comment on lines 113 to 125
w = make_identity_diff_op(2)
helmholtz2d = laplacian(w) + w
_, _, r = get_processed_and_shifted_recurrence(helmholtz2d)

n = sp.symbols("n")
s = sp.Function("s")

var = _make_sympy_vec("x", 2)
var_t = _make_sympy_vec("t", 2)
abs_dist = sp.sqrt((var[0]-var_t[0])**2 +
(var[1]-var_t[1])**2)
k = 1
g_x_y = (1j/4) * hankel1(0, k * abs_dist)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get from a Kernel object? (Here and elsewhere.)



# ================ Recurrence LP Eval =================
def recurrence_qbx_lp(sources, centers, normals, strengths, radius, pde, g_x_y,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a Kernel as an argument?

Comment on lines 369 to 375
def shift_recurrence(r: sp.Expr) -> sp.Expr:
r"""
A function that "shifts" the recurrence so it's center is placed
at the origin and source is the input for the recurrence generated.

:arg recurrence: a recurrence relation in :math:`s(n)`
"""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain better.

r"""
With the functionality in this module, we aim to compute layer potentials
using a recurrence for one-dimensional derivatives of the corresponding
Green's function. See recurrence.py.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Green's function. See recurrence.py.
Green's function. See :mod:`sumpy.recurrence`.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to docs.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recurrence_qbx?


.. autofunction:: recurrence_qbx_lp
"""
from __future__ import annotations # noqa: I001
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noqa?

@hirish99
Copy link
Contributor Author

hirish99 commented Jan 3, 2025

Plots updated in plot_taylor_recurrence and plot_normal_recurrence

Adds recurrence-based QBX layer potential evaluation with on-axis
and off-axis computation support for Laplace and Helmholtz kernels
in 2D and 3D.
- Add pyright ignore comments for sympy typing issues in recurrence.py
  and recurrence_qbx.py (sum() return type, .subs() return type,
  ObjectArray1D vs ndarray)
- Broaden parameter types from sp.Expr to sp.Basic where .subs() results
  are passed
- Remove personal plotting code from test files
- Remove tracked experimental files (pgf, png, svg, ipynb)
- Update .gitignore to exclude *.ipynb, *.pgf, output.png, qbxrecurrence.svg
@hirish99 hirish99 force-pushed the parametric_recurrence branch from 8f58772 to 03e0eeb Compare February 9, 2026 23:02
- Add pyright ignore comments for reportMissingImports, reportCallIssue,
  reportArgumentType, reportAttributeAccessIssue, and reportIndexIssue
  in test files (meshmode/pytential are optional deps without full stubs)
- Fix RST formatting in recurrence.py docstrings (indentation, bullet lists)
- Fix wrong function name in autofunction directive
- Fix typo in class reference (LinearSystemPDEOperator -> LinearPDESystemOperator)
basedpyright reports reportMissingImports on the 'from' line,
not on the inner item line where ruff moved the comment.
Rename functions to match paper (arXiv:2509.03687) terminology:
- get_on_axis_recurrence -> get_large_x1_recurrence
- get_off_axis_recurrence -> get_small_x1_recurrence
- get_off_axis_expression -> get_small_x1_expansion

Add documentation with diagram and usage examples for computing
derivatives in both regimes. Add recurrence_qbx to docs.
- Fix recurrence_qbx_lp docstring: evaluation is at target points
  (center + radius * normal), not at expansion centers.
- Merge baseline with upstream/main to cover CI-specific diagnostics
  for pre-existing files while adding entries for new recurrence files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants