Skip to content

Polyhedron potential field kernels - #89

Draft
jcapriot wants to merge 2 commits into
simpeg:mainfrom
jcapriot:jcapriot/polyhedron-kernels
Draft

jcapriot wants to merge 2 commits into
simpeg:mainfrom
jcapriot:jcapriot/polyhedron-kernels

Conversation

@jcapriot

@jcapriot jcapriot commented Oct 7, 2026

Copy link
Copy Markdown
Member

This draft is the start of adding polyhedron kernels for the potential fields methods.

For now they are checked for consistency against the prism formulations, and that they match their behavior at degenerate points.
The consistent degenerate behavior is specifically because I wanted them to cancel out if necessary. Say someone wanted to compute the magnetic field of a prism minus a polygon, in such a way the the point is outside the linearly combined body, but is evaluated at a degenerate point (say the top face).

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.98143% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.71%. Comparing base (7c47ec2) to head (4bfaeb6).

Files with missing lines Patch % Lines
geoana/shapes.py 86.66% 10 Missing and 8 partials ⚠️
geoana/em/static/freespace.py 82.22% 5 Missing and 3 partials ⚠️
geoana/kernels/potential_field_polyhedron.py 95.08% 5 Missing and 1 partial ⚠️
geoana/kernels/_extensions/__init__.py 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   83.87%   84.71%   +0.83%     
==========================================
  Files          31       32       +1     
  Lines        3169     3526     +357     
  Branches      268      295      +27     
==========================================
+ Hits         2658     2987     +329     
- Misses        443      458      +15     
- Partials       68       81      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jcapriot and others added 2 commits October 20, 2026 15:54
Closed-form gravity and magnetic solutions for closed triangulated
polyhedra and tetrahedra (Werner and Scheeres, 1996), with Polyhedron,
Tetrahedron, MagneticPolyhedron and MagneticTetrahedron classes, and a
broadcasting tetrahedron_integrals / tetrahedron_inside_fraction path for
evaluating many tetrahedra at once.

The potential and field are continuous across every face, edge and
vertex. Edge line integrals and face solid angles are evaluated without
cancellation, coplanar faces are merged into polygons so triangulation
diagonals play no part, and shared faces cancel exactly between bodies.
On the surface, the gradient tensor follows Prism's conventions, so
tetrahedra tiling a prism sum to it there as well.

Prism: evaluate the log kernels without cancellation near edges, and
weight the magnetization in B by the fraction of a small sphere inside
the prism, making B's normal component exact on its faces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jcapriot
jcapriot force-pushed the jcapriot/polyhedron-kernels branch from 0dae788 to 4bfaeb6 Compare October 20, 2026 21:54

This branch has not been deployed

No deployments
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.

1 participant