Skip to content

Separate ElasticityKernel and Stokeslet#281

Open
alexfikl wants to merge 9 commits into
inducer:mainfrom
alexfikl:stokeslet-refactor
Open

Separate ElasticityKernel and Stokeslet#281
alexfikl wants to merge 9 commits into
inducer:mainfrom
alexfikl:stokeslet-refactor

Conversation

@alexfikl
Copy link
Copy Markdown
Collaborator

@alexfikl alexfikl commented May 9, 2026

This makes the StokesletKernel an ExpressionKernel instead of inheriting from ElasticityKernel. Besides that, it also

  1. Removes the __new__ implementations. This is breaking (since ElasticityKernel no longer returns a Stokeslet in special cases).
  2. Deprecates passing a non-string value for viscosity_mu and poisson_ratio to match the existing scalar kernels.
  3. Renames viscosity_mu and poisson_ratio to viscosity_mu_name and poisson_ratio_name.
  4. Makes it an error to pass non-string values to these things. This matches all the other kernels.

Comment thread sumpy/kernel.py

.. math::

\Delta K(\mathbf{x}, \mathbf{y}) = \delta(\mathbf{x} - \mathbf{y}).
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this is right, i.e. it's not $-\Delta K = \delta$, but pointing it out just to make sure. 😁

Comment thread sumpy/kernel.py Outdated
Comment thread sumpy/kernel.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the PDE kernel hierarchy by separating StokesletKernel from ElasticityKernel, making StokesletKernel a standalone ExpressionKernel. It also removes custom __new__ behavior and introduces deprecations around passing non-string material parameters to align with other scalar kernels.

Changes:

  • Refactor StokesletKernel to inherit directly from ExpressionKernel and implement its own expression/scaling/args/pickling behavior.
  • Remove __new__-based class substitution and introduce DeprecationWarnings for non-string viscosity_mu / poisson_ratio.
  • Update misc tests to focus on pickle round-trips for elasticity-related kernels.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
sumpy/kernel.py Separates StokesletKernel from ElasticityKernel, adds deprecation warnings, and expands kernel docstrings/references.
sumpy/test/test_misc.py Updates a kernel test to validate pickling behavior after the refactor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sumpy/kernel.py Outdated
Comment thread sumpy/kernel.py Outdated
Comment thread sumpy/kernel.py Outdated
Comment thread sumpy/kernel.py Outdated
Comment thread sumpy/kernel.py Outdated
@alexfikl alexfikl force-pushed the stokeslet-refactor branch from 571c798 to 147cb43 Compare May 9, 2026 08:59
@alexfikl alexfikl marked this pull request as ready for review May 9, 2026 17:28
@alexfikl alexfikl force-pushed the stokeslet-refactor branch from 43887c3 to b3a6dd2 Compare May 12, 2026 07:02
@inducer inducer force-pushed the stokeslet-refactor branch from b3a6dd2 to f12528e Compare May 13, 2026 22:16
@alexfikl alexfikl force-pushed the stokeslet-refactor branch from f12528e to 0c5e3a3 Compare May 14, 2026 08:01
@alexfikl alexfikl force-pushed the stokeslet-refactor branch 2 times, most recently from afad449 to d0e1d45 Compare May 23, 2026 13:45
@alexfikl alexfikl force-pushed the stokeslet-refactor branch from d0e1d45 to 8b5d97f Compare May 23, 2026 16:54
@alexfikl
Copy link
Copy Markdown
Collaborator Author

@inducer This should also be good for a look (the CI passed once). It doesn't seem to break pytential, so not bad for all the breaking changes it makes 😁

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.

3 participants