Skip to content

Commit

Permalink
Merge pull request #259 from pybamm-team/issue-258-casadi-sol
Browse files Browse the repository at this point in the history
Fix issue 258
  • Loading branch information
TomTranter authored May 26, 2023
2 parents aac9128 + 27e3358 commit b85e376
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@

- ([#PR](link))

# [v0.3.6](https://github.com/pybamm-team/liionpack/)


## Bug fixes

- Fix a RunTimeError introduced by change to latest version of casadi that PyBaMM now supports. Solution returned by casadi no longer contains initial state. ([#259](https://github.com/pybamm-team/liionpack/pull/259))


# [v0.3.5](https://github.com/pybamm-team/liionpack/) - 2023-04-05

## Features
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ dependencies:
- mkdocstrings-python-legacy
- mkdocs-material
- mkdocs-jupyter
- nbconvert
- -e .
2 changes: 1 addition & 1 deletion liionpack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
from .solvers import GenericActor
from .solvers import RayActor

__version__ = "0.3.5"
__version__ = "0.3.6"
6 changes: 3 additions & 3 deletions liionpack/solver_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _serial_step(model, solutions, inputs_dict, integrator, variables, t_eval, e
ninputs = len(temp.values())
# Call the integrator once, with the grid
casadi_sol = integrator(x0=x0, z0=z0, p=inputs)
xf = casadi_sol["xf"]
xf = casadi.horzcat(x0, casadi_sol["xf"])
zf = casadi_sol["zf"]
if zf.is_empty():
y_sol = xf
Expand Down Expand Up @@ -215,15 +215,15 @@ def _mapped_step(model, solutions, inputs_dict, integrator, variables, t_eval, e
tic = timer.time()
casadi_sol = integrator(x0=x0, z0=z0, p=inputs)
integration_time = timer.time()
nt = len(t_eval)
nt = len(t_eval[1:])
xf = casadi_sol["xf"]
zf = casadi_sol["zf"]
sol = []
xend = []
events_eval = []
for i in range(N):
start = i * nt
y_diff = xf[:, start : start + nt]
y_diff = casadi.horzcat(x0[:, i], xf[:, start : start + nt])
if zf.is_empty():
y_sol = y_diff
else:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies = [
"scipy",
"textwrapper",
"tqdm",
"nbconvert",
]
dynamic = [
"version",
Expand Down

0 comments on commit b85e376

Please sign in to comment.