From ea59d9f2882d306c39b4b3b9ee21ba263e2169e6 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Thu, 5 Aug 2021 18:02:43 +0100 Subject: [PATCH] #1477 fix bug with bounds --- pybamm/solvers/base_solver.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pybamm/solvers/base_solver.py b/pybamm/solvers/base_solver.py index 0d843f190c..49c372985d 100644 --- a/pybamm/solvers/base_solver.py +++ b/pybamm/solvers/base_solver.py @@ -613,7 +613,7 @@ def jacp(*args, **kwargs): n_inputs = model.len_rhs_sens // model.len_rhs elif model.len_alg != 0: n_inputs = model.len_alg_sens // model.len_alg - if model.bounds[0].shape[0] < model.len_alg + model.len_alg_sens: + if model.bounds[0].shape[0] == model.len_rhs_and_alg: model.bounds = ( np.repeat(model.bounds[0], n_inputs + 1), np.repeat(model.bounds[1], n_inputs + 1), @@ -635,10 +635,10 @@ def jacp(*args, **kwargs): ) else: # take care if calculate_sensitivites used then not used - if model.bounds[0].shape[0] > model.len_alg: + if model.bounds[0].shape[0] > model.len_rhs_and_alg: model.bounds = ( - model.bounds[0][:model.len_alg], - model.bounds[1][:model.len_alg], + model.bounds[0][:model.len_rhs_and_alg], + model.bounds[1][:model.len_rhs_and_alg], ) if (model.mass_matrix is not None and model.mass_matrix.shape[0] > model.len_rhs_and_alg):