diff --git a/CHANGELOG.md b/CHANGELOG.md index 3097dfaaa9..02f0997a22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ ## Bug fixes +- Fixed ElectrodeSOH model for multi-dimensional simulations ([#1548](https://github.com/pybamm-team/PyBaMM/pull/1548)) - Removed the overly-restrictive check "each variable in the algebraic eqn keys must appear in the eqn" ([#1510](https://github.com/pybamm-team/PyBaMM/pull/1510)) - Made parameters importable through pybamm ([#1475](https://github.com/pybamm-team/PyBaMM/pull/1475)) diff --git a/pybamm/models/submodels/active_material/base_active_material.py b/pybamm/models/submodels/active_material/base_active_material.py index 1c94af7e60..4d3a8a7fd0 100644 --- a/pybamm/models/submodels/active_material/base_active_material.py +++ b/pybamm/models/submodels/active_material/base_active_material.py @@ -62,7 +62,14 @@ def _get_standard_active_material_variables(self, eps_solid): L = param.L_p c_s_max = param.c_p_max - C = eps_solid_av * L * param.A_cc * c_s_max * param.F / 3600 + C = ( + pybamm.yz_average(eps_solid_av) + * L + * param.A_cc + * c_s_max + * param.F + / 3600 + ) variables.update({self.domain + " electrode capacity [A.h]": C}) if self.domain == "Negative": diff --git a/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py b/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py index 0983339d77..5a6501a351 100644 --- a/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py +++ b/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py @@ -139,7 +139,7 @@ def _get_total_concentration_electrolyte(self, c_e, epsilon): L_x = self.param.L_x A = self.param.A_cc - c_e_av = pybamm.x_average(epsilon * c_e) + c_e_av = pybamm.yz_average(pybamm.x_average(epsilon * c_e)) variables = {"Total lithium in electrolyte [mol]": c_e_typ * L_x * A * c_e_av} diff --git a/pybamm/models/submodels/particle/base_particle.py b/pybamm/models/submodels/particle/base_particle.py index bac7795efd..825d2d0d48 100644 --- a/pybamm/models/submodels/particle/base_particle.py +++ b/pybamm/models/submodels/particle/base_particle.py @@ -133,7 +133,10 @@ def _get_total_concentration_variables(self, variables): + "volume-averaged concentration [mol.m-3]": c_s_vol_av * c_scale, "Total lithium in " + self.domain.lower() - + " electrode [mol]": c_s_vol_av * eps_s_av * c_scale * L * A, + + " electrode [mol]": pybamm.yz_average(c_s_vol_av * eps_s_av) + * c_scale + * L + * A, } ) return variables diff --git a/pybamm/solvers/solution.py b/pybamm/solvers/solution.py index 385f754541..9514d1f937 100644 --- a/pybamm/solvers/solution.py +++ b/pybamm/solvers/solution.py @@ -733,17 +733,24 @@ def get_cycle_summary_variables(cycle_solution, esoh_sim): esoh_sim.built_model.set_initial_conditions_from( {"x_100": x_100_init, "C": C_init} ) - esoh_sol = esoh_sim.solve( - [0], - inputs={ - "V_min": V_min, - "V_max": V_max, - "C_n": C_n, - "C_p": C_p, - "n_Li": n_Li, - }, - solver=solver, - ) + + try: + esoh_sol = esoh_sim.solve( + [0], + inputs={ + "V_min": V_min, + "V_max": V_max, + "C_n": C_n, + "C_p": C_p, + "n_Li": n_Li, + }, + solver=solver, + ) + except pybamm.SolverError: # pragma: no cover + raise pybamm.SolverError( + "Could not solve for summary variables, run " + "`sim.solve(calc_esoh=False)` to skip this step" + ) for var in esoh_sim.built_model.variables: cycle_summary_variables[var] = esoh_sol[var].data[0]