Skip to content

Fix lumped thermal discretisation with 1+1D current collectors - #5891

Open
chenyi6758-source wants to merge 3 commits into
pybamm-team:mainfrom
chenyi6758-source:fix/lumped-1plus1d-discretisation
Open

chenyi6758-source wants to merge 3 commits into
pybamm-team:mainfrom
chenyi6758-source:fix/lumped-1plus1d-discretisation

Conversation

@chenyi6758-source

Copy link
Copy Markdown

Closes #5878.

"Surface temperature [K]" carries the current-collector domain, so with 1+1D current collectors the lumped cooling term varied in z while the lumped temperature state is a scalar, and discretisation failed with a shape mismatch.

This averages the surface temperature over the current collector(s) for the cooling term. It is a no-op for 0D (z_average of a scalar returns it unchanged). The 1+1D lumped model now builds and solves, and its temperature trajectory matches the 0D lumped result as expected.

@chenyi6758-source
chenyi6758-source requested a review from a team as a code owner October 12, 2026 03:26
@rtimms

rtimms commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Looks good, thanks. Please drop the two-line comment above T_surf_av; the averaging is clear from the code.

@rtimms rtimms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @chenyi6758-source, the fix is right. In the Timms2021 lumped formulation the cell has a single temperature, and the heat source and heat capacity are already averaged over the current collector, so the only term varying in z was T_surf (= T_amb(y, z, t)). Since h_total and A_cooling are uniform, averaging it gives exactly the same total cooling. I checked that 0D lumped is bit-identical to main, that 2+1D now builds too, and that 1+1D/2+1D lumped agree with x-lumped to within 0.5% of the temperature rise under uniform cooling.

Before this goes into 26.10.0.1:

  1. Add a regression test. test_well_posed_lumped_thermal_1plus1D only checks the model symbolically, which is why this wasn't caught. Adding 1+1D and 2+1D "lumped" SPMe models to test_consistent_cooling in tests/integration/test_models/test_full_battery_models/test_lithium_ion/test_thermal_models.py, and asserting they match the x-lumped ones (e.g. assert 1e-5 > err(solutions["SPMe 1+1D"], solutions["SPMe 1+1D lumped"]), same for 2+1D), fails on main and passes here.
  2. Drop the two-line comment above T_surf_av (as mentioned earlier); the averaging is clear from the code.
  3. Optional, same root cause: "surface temperature": "lumped" with 1+1D/2+1D current collectors still fails, because thermal/surface/lumped.py uses the unaveraged "Ambient temperature [K]". Switching it to "Volume-averaged ambient temperature [K]" fixes both. Fine as a follow-up if you'd rather keep this PR minimal.

… in surface lumped

- Add 1+1D/2+1D lumped SPMe models to test_consistent_cooling, asserting
  they match the x-lumped ones (fails on main, passes with the fix)
- Drop the two-line comment above T_surf_av
- thermal/surface/lumped.py now uses 'Volume-averaged ambient temperature [K]'
  so 'surface temperature': 'lumped' works with 1+1D/2+1D current collectors

This branch has not been deployed

No deployments
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]: Lumped thermal model fails to discretise with 1+1D current collectors

2 participants