[Bug]: BatchStudy.solve silently ignores t_interp
Maintainers usually reply within 2 days
@shresthgoel77-png is already working on this.
Since Oct 25, 2026.
- #5979 by @shresthgoel77-png — open
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in packages/pybamm/src/pybamm/batch_study.py at the BatchStudy.solve method and inspect the inner Simulation.solve call around lines 161–169. Compare its arguments with the direct call in the reproduction, then add regression coverage for both permutation modes. Done when batch solution times match the requested interpolation grid; the issue also requests a changelog entry.
Written by the indexing model from the issue text.
Description
PyBaMM Version
0.0.1.dev16359+g5651a97ec — source checkout at commit 5651a97ecc5dfd1a2de8c2a1af13368263ee12ed
Python Version
Python 3.14.4 on Ubuntu/WSL2; pybammsolvers 0.11.1, NumPy 2.5.4, SciPy 1.18.1.
Describe the bug
BatchStudy.solve accepts t_interp, but does not forward it to the underlying Simulation.solve call. With the default IDAKLU solver, the resulting batch solutions therefore use adaptive solver output times instead of the requested interpolation grid.
An equivalent direct Simulation.solve call honours the requested grid. This prevents callers from obtaining batch results on a shared output grid for comparisons or data export.
Expected behaviour: In the example below, the batch solution's time array should match [0.0, 0.25, 0.5, 1.0], as the direct simulation does.
Actual behaviour: The batch solution returns a different time array. The behaviour was reproduced with both permutations=False and permutations=True.
In the inspected revision, t_interp is accepted in the method signature but omitted from the inner Simulation.solve call.
The adaptive point count shown below is specific to the reproduction environment; the issue is the ignored interpolation grid.
I would be happy to contribute a focused fix that forwards t_interp, with regression tests for both permutation modes and a changelog entry. I have prepared and tested a candidate patch locally, but have not opened a pull request. If appropriate, could a maintainer assign this issue to me?
Steps to Reproduce
Run the following against the unmodified source revision listed above. The example uses the default IDAKLU solver.
import numpy as np
import pybamm
state = pybamm.Variable("State")
model = pybamm.BaseModel()
model.rhs = {state: -state}
model.initial_conditions = {state: 1}
model.variables = {"State": state}
times = np.array([0.0, 0.25, 0.5, 1.0])
direct = pybamm.Simulation(model).solve(
[0, 1], t_interp=times, calc_esoh=False
)
study = pybamm.BatchStudy({"decay": model})
study.solve([0, 1], t_interp=times, calc_esoh=False)
actual = study.sims[0].solution.t
print("Requested:", times)
print("Direct Simulation:", direct.t)
print("BatchStudy point count:", actual.size)
print("BatchStudy matches requested grid:", np.array_equal(actual, times))
Setting permutations=True in the BatchStudy constructor reproduces the same grid mismatch.
Relevant log output
Requested: [0. 0.25 0.5 1. ]
Direct Simulation: [0. 0.25 0.5 1. ]
BatchStudy point count: 27
BatchStudy matches requested grid: False
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 808
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 55
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pybamm-team/PyBaMM
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pybamm-team/PyBaMM#6061 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
pybamm-team/PyBaMM#6059 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
pybamm-team/PyBaMM#6051 ·
Maintainers usually reply within 2 days
-
Composite positive half cell: get_initial_stoichiometry_half_cell inverts SOC (SOC 1 returns the 0% stoichiometry)Possibly taken @Mohit-Ak claimed this 14 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
pybamm-team/PyBaMM#6007 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 70/100
pybamm-team/PyBaMM#5692 · 12 comments ·
Maintainers usually reply within 2 days
All issues in pybamm-team/PyBaMM
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
btclib-org/btclib-wallet#1045 ·
Maintainers usually reply within 1 day
-
area-templates triage:bot-seen triage:needs-human
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/aspire#22356 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Train] An elastic ScalingConfig(num_workers=(0, 0)) is accepted and the run waits foreverPossibly taken @wguo7 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ray-project/ray#68217 ·
Maintainers usually reply within 2 days