Claim Check / Sample report
Sample. No client was involved.
PyBaMM BasicDFN: does the model conserve lithium when the transference number varies?
How this sample was built
This is the structure a client receives, filled in from a real, public, self-initiated investigation. Every number below is computed at build time from the public reproduction package at commit adaa877 (summary.csv and controls.json, SHA-256 matched to the package’s own manifest).
1. The question, as agreed
The model conserves lithium: the total in the electrolyte and particles stays constant over a cycle, up to solver tolerance.
Settled by: an independent lithium count that uses the library’s mesh and solution but none of its averaging or total-lithium diagnostics. The claim fails if the count drifts by more than solver tolerance; the cause is reported separately.
2. Verdict
Fails. With a concentration-dependent transference number, the model’s lithium inventory grows: the largest drift is between 2.4407% and 2.4417% of the initial inventory in all 21 runs, and every run ends with more lithium than it started with. The cause is a missing term in the equation, not the numerical method. Two control models hold: their largest drift in any run is 1.3e-13 of the inventory.
3. What was run
Froze three revisions: release v26.4.1 (d9e5afb), main (258fdc8), and the head of then-open pull request #5524 (719763b).
Counted lithium from the mesh, the parameters and the raw concentrations, without using the library’s own totals. A second, loop-based implementation was checked against the first on every run.
Ran 84 jobs: four model cases × three revisions × seven mesh and tolerance settings. A constant-transference model and the full DFN model served as controls.
4. Proof the check works
Before the count was trusted, it was run on synthetic cases with known answers. Five planted defects were each caught, and two correct cases balanced:
| Case given to the counter | Largest imbalance reported | Reading |
|---|---|---|
| closed transfer | 1.8e-15 mol | balances, as it should |
| boundary and source conserving | 3.3e-15 mol | balances, as it should |
| altered inventory | 0.020 mol | caught |
| wrong boundary sign | 0.600 mol | caught |
| omitted source | 0.200 mol | caught |
| wrong volume factor | 0.005 mol | caught |
| synthetic imbalance | 0.010 mol | caught |
A second implementation of the count, written separately with explicit loops, agrees with the first to 3.6e-15 mol on these synthetic arrays.
5. Evidence
| Mesh (cells) | Time tolerance | Case under test | Constant-transference control | Full DFN control |
|---|---|---|---|---|
| 20 × 20 | 1e-06 | +2.4417% | 1.8e-14 | 1.5e-14 |
| 20 × 20 | 1e-08 | +2.4417% | 1.9e-14 | 1.5e-14 |
| 20 × 20 | 1e-10 | +2.4417% | 1.8e-14 | 1.5e-14 |
| 20 × 80 | 1e-10 | +2.4417% | 2.9e-14 | 1.3e-13 |
| 40 × 40 | 1e-10 | +2.4409% | 2.8e-14 | 2.6e-14 |
| 80 × 20 | 1e-10 | +2.4407% | 2.0e-14 | 2.1e-14 |
| 80 × 80 | 1e-10 | +2.4407% | 2.7e-14 | 1.3e-13 |
Largest drift in the lithium inventory as a fraction of the initial inventory, worst of three revisions. For the case under test the drift is a gain.
The measured rate matched the rate predicted from the missing transference-gradient term to within 1.2 × 10⁻¹⁷ mol/s in all 21 runs. The equation, not the discretisation, is the cause. A PyBaMM contributor confirmed the missing term on the original thread.
6. What this does not show
One library, two model families, one protocol (rest, 1C discharge, rest, 1C charge, rest) and one parameter set (O’Regan 2022). The full DFN model conserved lithium; nothing here is said against it. No physical battery was measured.
7. Next actions
- Add the missing transference-gradient term (done upstream in PR #5747, released in 26.9.0.0).
- Add the independent lithium count as a test that runs on every release, so a future change cannot reintroduce the drift.
- The finite-volume question raised in #5700 is a separate claim and would need its own check.
8. Re-run
The count, the 84-job table and the planted-defect checks are in the reproduction package. In a client report, this section gives the exact command and environment.