Skip to content

Deprecate pybamm.Magnitude in favour of Component - #5691

Open
aabills wants to merge 1 commit into
ufv-4-modelsfrom
ufv-5-deprecate-magnitude
Open

Deprecate pybamm.Magnitude in favour of Component#5691
aabills wants to merge 1 commit into
ufv-4-modelsfrom
ufv-5-deprecate-magnitude

Conversation

@aabills

@aabills aabills commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Deprecate pybamm.Magnitude with a DeprecationWarning pointing users to pybamm.Component(symbol, 0|1).
  • Migrate internal callers (BasicDFN2D, 2D FV / processed-variable tests) to Component.
  • Teach FiniteVolume2D edge-averaging to accept Component indices so the replacement works for flux products.

Stack

  1. 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
  6. This PR (Deprecate pybamm.Magnitude in favour of Component #5691) — Deprecate Magnitude

Test plan

  • test_vector_field_and_magnitude.py (Component + deprecation)
  • test_process_binary_operators, test_processed_variable_2D_fvm, 2D integration tests
  • CI unit suite

Emit DeprecationWarning from Magnitude and migrate internal 2D call
sites to Component. Teach FiniteVolume2D edge-averaging to read
Component indices so the replacement works for flux products.

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

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.84%. Comparing base (5e1d810) to head (47e87fd).

Files with missing lines Patch % Lines
...amm/src/pybamm/spatial_methods/finite_volume_2d.py 70.00% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           ufv-4-models    #5691   +/-   ##
=============================================
  Coverage         96.84%   96.84%           
=============================================
  Files               344      344           
  Lines             34489    34499   +10     
=============================================
+ Hits              33402    33412   +10     
  Misses             1087     1087           

☔ 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