Skip to content

Commit

Permalink
fix bug in leading surface form conductivity (#4139)
Browse files Browse the repository at this point in the history
* fix bug in leading surface form conductivity

* update changelog

---------

Co-authored-by: Eric G. Kratz <[email protected]>
Co-authored-by: Agriya Khetarpal <[email protected]>
  • Loading branch information
3 people authored Jun 5, 2024
1 parent b15d979 commit 293b8ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 293b8ff

Please sign in to comment.