Skip to content

Conversation

Rishab87
Copy link
Contributor

@Rishab87 Rishab87 commented Aug 2, 2025

Description

This PR resolves a non-deterministic ShapeError that occurred in the ScikitFiniteElement3D spatial method when simulating 3D thermal models.

The problem was when evaluating the gradient of a constant parameter, like thermal conductivity (lambda_eff), which PyBaMM simplifies to a pybamm.Scalar. The gradient method was not designed to handle a scalar input and would attempt an invalid matrix-scalar multiplication.

Fixes #5142

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

@Rishab87 Rishab87 requested a review from a team as a code owner August 2, 2025 08:27
Copy link

codecov bot commented Aug 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.08%. Comparing base (d421e3a) to head (e844170).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5143   +/-   ##
========================================
  Coverage    99.08%   99.08%           
========================================
  Files          310      310           
  Lines        24459    24459           
========================================
  Hits         24236    24236           
  Misses         223      223           

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

Copy link
Contributor

@aabills aabills left a comment

Choose a reason for hiding this comment

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

Great, thanks!!

@martinjrobins martinjrobins merged commit 0b92287 into pybamm-team:develop Aug 4, 2025
21 checks passed
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.

[Bug]: Intermittent CI Failure
3 participants