diff --git a/CHANGELOG.md b/CHANGELOG.md index 717ed74085..4fcd5acb81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ ## Bug Fixes +- Fixed a bug where a factor of electrode surface area to volume ratio is missing in the rhs of the LeadingOrderDifferential conductivity model ([#4139](https://github.com/pybamm-team/PyBaMM/pull/4139)) - Fixes the breaking changes caused by [#3624](https://github.com/pybamm-team/PyBaMM/pull/3624), specifically enables the deprecated parameter `electrode diffusivity` to be used by `ParameterValues.update({name:value})` and `Solver.solve(inputs={name:value})`. Fixes parameter translation from old name to new name, with corrected tests. ([#4072](https://github.com/pybamm-team/PyBaMM/pull/4072) - Set the `remove_independent_variables_from_rhs` to `False` by default, and moved the option from `Discretisation.process_model` to `Discretisation.__init__`. This fixes a bug related to the discharge capacity, but may make the simulation slower in some cases. To set the option to `True`, use `Simulation(..., discretisation_kwargs={"remove_independent_variables_from_rhs": True})`. ([#4020](https://github.com/pybamm-team/PyBaMM/pull/4020)) - Fixed a bug where independent variables were removed from models even if they appeared in events ([#4019](https://github.com/pybamm-team/PyBaMM/pull/4019)) diff --git a/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/full_surface_form_conductivity.py b/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/full_surface_form_conductivity.py index 50f36f83f9..cceb88f83e 100644 --- a/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/full_surface_form_conductivity.py +++ b/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/full_surface_form_conductivity.py @@ -272,13 +272,11 @@ def set_rhs(self, variables): domain, Domain = self.domain_Domain T = variables[f"{Domain} electrode temperature [K]"] - C_dl = self.domain_param.C_dl(T) delta_phi = variables[f"{Domain} electrode surface potential difference [V]"] i_e = variables[f"{Domain} electrolyte current density [A.m-2]"] - # Variable summing all of the interfacial current densities sum_a_j = variables[ f"Sum of {domain} electrode volumetric " "interfacial current densities [A.m-3]" diff --git a/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/leading_surface_form_conductivity.py b/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/leading_surface_form_conductivity.py index 629f764b0c..c7b47cdd37 100644 --- a/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/leading_surface_form_conductivity.py +++ b/pybamm/models/submodels/electrolyte_conductivity/surface_potential_form/leading_surface_form_conductivity.py @@ -86,24 +86,26 @@ def __init__(self, param, domain, options=None): def set_rhs(self, variables): domain = self.domain + T = variables[f"X-averaged {domain} electrode temperature [K]"] + C_dl = self.domain_param.C_dl(T) + + delta_phi = variables[ + f"X-averaged {domain} electrode surface potential difference [V]" + ] + sum_a_j = variables[ f"Sum of x-averaged {domain} electrode volumetric " "interfacial current densities [A.m-3]" ] - sum_a_j_av = variables[ f"X-averaged {domain} electrode total volumetric " "interfacial current density [A.m-3]" ] - delta_phi = variables[ - f"X-averaged {domain} electrode surface potential difference [V]" + a = variables[ + f"X-averaged {domain} electrode surface area to volume ratio [m-1]" ] - T = variables[f"X-averaged {domain} electrode temperature [K]"] - - C_dl = self.domain_param.C_dl(T) - - self.rhs[delta_phi] = 1 / C_dl * (sum_a_j_av - sum_a_j) + self.rhs[delta_phi] = 1 / (a * C_dl) * (sum_a_j_av - sum_a_j) class LeadingOrderAlgebraic(BaseLeadingOrderSurfaceForm):