Skip to content

Conversation

@aabills
Copy link
Contributor

@aabills aabills commented Jan 5, 2026

Description

Adds tensors and some basic operators. Useful for some models which need these types of things.

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

@aabills aabills requested a review from a team as a code owner January 5, 2026 23:06
@aabills aabills marked this pull request as draft January 5, 2026 23:07
@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

❌ Patch coverage is 90.44586% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.59%. Comparing base (3a25c09) to head (edf1919).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/pybamm/expression_tree/tensor_field.py 90.27% 7 Missing ⚠️
src/pybamm/expression_tree/binary_operators.py 84.00% 4 Missing ⚠️
src/pybamm/spatial_methods/finite_volume_2d.py 92.10% 3 Missing ⚠️
src/pybamm/expression_tree/symbol.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5335      +/-   ##
===========================================
- Coverage    98.64%   98.59%   -0.05%     
===========================================
  Files          323      324       +1     
  Lines        28063    28211     +148     
===========================================
+ Hits         27682    27816     +134     
- Misses         381      395      +14     

☔ 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 aabills marked this pull request as ready for review January 5, 2026 23:29
valentinsulzer
valentinsulzer previously approved these changes Jan 6, 2026
>>> v2 = pybamm.VectorField(c, d) # rank-1
>>> T = pybamm.tensor_product(v1, v2) # rank-2 tensor
"""
return TensorProduct(left, right)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would left and right ever be constant (i.e. use simplify_if_constant) ?

valentinsulzer
valentinsulzer previously approved these changes Jan 6, 2026
@aabills aabills merged commit 05c045d into develop Jan 6, 2026
24 of 26 checks passed
@aabills aabills deleted the tensors branch January 6, 2026 22:06
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.

3 participants