Skip to content

Unstructured finite volume#5397

Draft
aabills wants to merge 18 commits intomainfrom
unstructured-finite-volume
Draft

Unstructured finite volume#5397
aabills wants to merge 18 commits intomainfrom
unstructured-finite-volume

Conversation

@aabills
Copy link
Copy Markdown
Contributor

@aabills aabills commented Feb 26, 2026

Description

Adds an unstructured finite volume method for 2 and 3D, allowing for simulations on arbitrary domains with user-provided meshes.

Fixes # (issue)

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #)

Important checks:

Please confirm the following before marking the PR as ready for review:

  • No style issues: nox -s pre-commit
  • All tests pass: nox -s tests
  • The documentation builds: nox -s doctests
  • Code is commented for hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 42.62643% with 1350 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.39%. Comparing base (65b9cc9) to head (4036d4c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/pybamm/plotting/plot_vtk.py 2.60% 487 Missing ⚠️
...bamm/spatial_methods/finite_volume_unstructured.py 25.68% 382 Missing ⚠️
src/pybamm/solvers/processed_variable.py 10.65% 176 Missing ⚠️
src/pybamm/plotting/quick_plot.py 23.65% 142 Missing ⚠️
src/pybamm/meshes/unstructured_submesh.py 86.55% 66 Missing ⚠️
src/pybamm/discretisations/discretisation.py 46.77% 33 Missing ⚠️
src/pybamm/meshes/meshes.py 70.00% 30 Missing ⚠️
...ry_models/lithium_ion/basic_dfn_3d_unstructured.py 93.04% 8 Missing ⚠️
src/pybamm/expression_tree/unary_operators.py 53.33% 7 Missing ⚠️
src/pybamm/plotting/dynamic_plot.py 41.66% 7 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5397      +/-   ##
==========================================
- Coverage   98.29%   94.39%   -3.91%     
==========================================
  Files         337      342       +5     
  Lines       30950    33243    +2293     
==========================================
+ Hits        30423    31379     +956     
- Misses        527     1864    +1337     

☔ View full report in Codecov by Sentry.
📢 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.

aabills and others added 9 commits February 27, 2026 10:36
Resolve conflicts:
- __init__.py: keep both VTKQuickPlot and nyquist_plot imports
- functions.py: take main's Max/Min _casadi_evaluate and _evaluate_for_shape
- convert_to_casadi.py: accept deletion from main's OOP refactor; port
  VectorField casadi conversion to _to_casadi method on the class
- vector_field.py: 85% -> 100%
- tensor_field.py: 90% -> 100%
- unstructured_submesh.py: 64% -> 87%

Added tests for quad/hex element types, boundary loops, contains_points_3d
on hex, optimize_ordering on single cell, generator error paths, and
_parse_lims string-variable handling. Added tensor/vector field getitem
edge cases, all-on-edges path, and VectorField._to_casadi coverage.
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