Skip to content

Generalise VectorField to N components - #5686

Open
aabills wants to merge 3 commits into
mainfrom
ufv-0-vector-field
Open

Generalise VectorField to N components#5686
aabills wants to merge 3 commits into
mainfrom
ufv-0-vector-field

Conversation

@aabills

@aabills aabills commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Generalise VectorField from fixed 2D (lr, tb) to N components (needed for 3D unstructured FV).
  • Add Component / Norm operators and matching discretisation + solution handling.
  • First of a stacked split of Unstructured finite volume #5397 (plan B).

Stack

  1. This PR (Generalise VectorField to N components #5686) — VectorField N-comp
  2. Add unstructured mesh infrastructure #5687 — Meshing
  3. 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

Full pre-split branch preserved as backup/unstructured-finite-volume-full and original #5397 (unstructured-finite-volume).

Test plan

  • test_finite_volume_2d/test_tensor_field.py (includes new VectorField N-comp cases)
  • CI unit suite

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

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>
@aabills
aabills requested a review from a team as a code owner July 31, 2026 21:39
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.14%. Comparing base (1e9fbce) to head (0e1522c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5686      +/-   ##
==========================================
+ Coverage   98.12%   98.14%   +0.01%     
==========================================
  Files         339      339              
  Lines       31996    32063      +67     
==========================================
+ Hits        31396    31468      +72     
+ Misses        600      595       -5     

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

Add unit tests for the uncovered patch lines: Component/Norm
discretisation (success and error paths), _unary_new_copy and the
component/norm convenience functions, _disc_state_vector propagation
through binary/unary operators, and the per-component casadi handling
for VectorField variables in Solution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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