From 78fdf8a27e21e713a8742664506cb98935c9231c Mon Sep 17 00:00:00 2001 From: Tom Tranter Date: Fri, 26 May 2023 11:51:16 +0100 Subject: [PATCH 1/3] Handle change to length of solution, adding initial conditions back in --- liionpack/solver_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/liionpack/solver_utils.py b/liionpack/solver_utils.py index 5a351a0b..9a8a91d8 100644 --- a/liionpack/solver_utils.py +++ b/liionpack/solver_utils.py @@ -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 @@ -215,7 +215,7 @@ 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 = [] @@ -223,7 +223,7 @@ def _mapped_step(model, solutions, inputs_dict, integrator, variables, t_eval, e 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: From 4921aa93da5bc2491941642253f7af3633e0a4dd Mon Sep 17 00:00:00 2001 From: Tom Tranter Date: Fri, 26 May 2023 12:43:56 +0100 Subject: [PATCH 2/3] Add nbconvert to dependencies --- environment.yml | 1 + pyproject.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/environment.yml b/environment.yml index efc0a1e4..7d477c55 100644 --- a/environment.yml +++ b/environment.yml @@ -35,4 +35,5 @@ dependencies: - mkdocstrings-python-legacy - mkdocs-material - mkdocs-jupyter + - nbconvert - -e . diff --git a/pyproject.toml b/pyproject.toml index 9f9877d3..31579c91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,7 @@ dependencies = [ "scipy", "textwrapper", "tqdm", + "nbconvert", ] dynamic = [ "version", From 27e3358c03ab11f78bf6db60037a3e7f624d6abd Mon Sep 17 00:00:00 2001 From: Tom Tranter Date: Fri, 26 May 2023 14:45:21 +0100 Subject: [PATCH 3/3] Update changelog and bump version --- CHANGELOG.md | 8 ++++++++ liionpack/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff320425..d0ce8a2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/liionpack/__init__.py b/liionpack/__init__.py index 38b9ea2b..194f0695 100644 --- a/liionpack/__init__.py +++ b/liionpack/__init__.py @@ -44,4 +44,4 @@ from .solvers import GenericActor from .solvers import RayActor -__version__ = "0.3.5" +__version__ = "0.3.6"