Skip to content

Add unstructured finite volume spatial method - #5688

Open
aabills wants to merge 5 commits into
mainfrom
ufv-2-spatial
Open

Add unstructured finite volume spatial method#5688
aabills wants to merge 5 commits into
mainfrom
ufv-2-spatial

Conversation

@aabills

@aabills aabills commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Stack

  1. Generalise VectorField to N components #5686 — VectorField N-comp
  2. Add unstructured mesh infrastructure #5687 — Meshing
  3. This PR (Add unstructured finite volume spatial method #5688) — Spatial method + ProcessedVariable
  4. Add VTK plotting for unstructured meshes #5689 — VTK plotting
  5. Add unstructured 2D/3D DFN battery models #5690 — Unstructured DFN models

Review tip: the spatial-only commit is feat: add unstructured finite volume spatial method; earlier commits are the two dependencies.

Test plan

  • test_finite_volume_unstructured.py + mesh + tensor-field tests (158 passed locally)
  • CI unit suite

Also in this stack: #5691 deprecates pybamm.Magnitude.

aabills and others added 4 commits July 31, 2026 14:37
Support 3D vector fields via N-component VectorField, Component/Norm
operators, and matching discretisation/solution handling. Extracted from
the unstructured finite-volume work for review in isolation.

Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce UnstructuredSubMesh, mesh generators, and Mesh interface
coupling so arbitrary 2D/3D domains can be discretised later. Extracted
from the unstructured finite-volume stack for isolated review.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	CHANGELOG.md
Add FiniteVolumeUnstructured, discretisation hooks, and unstructured
processed variables so cell-centered solutions can be formed on the new
meshes. Extracted from the unstructured finite-volume stack.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.07663% with 356 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.24%. Comparing base (1e9fbce) to head (7dc6f0d).

Files with missing lines Patch % Lines
...es/pybamm/src/pybamm/solvers/processed_variable.py 10.65% 176 Missing ⚠️
...s/pybamm/src/pybamm/meshes/unstructured_submesh.py 80.41% 105 Missing ⚠️
...ybamm/src/pybamm/discretisations/discretisation.py 44.28% 39 Missing ⚠️
packages/pybamm/src/pybamm/meshes/meshes.py 66.25% 27 Missing ⚠️
packages/pybamm/src/pybamm/solvers/solution.py 44.44% 5 Missing ⚠️
...bamm/src/pybamm/expression_tree/unary_operators.py 80.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5688      +/-   ##
==========================================
- Coverage   98.12%   97.24%   -0.88%     
==========================================
  Files         339      341       +2     
  Lines       31996    33512    +1516     
==========================================
+ Hits        31396    32590    +1194     
- Misses        600      922     +322     

☔ 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.

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