Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wycisk OCP Restructure #4374

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

- Fixed bug where IDAKLU solver failed when `output variables` were specified and an event triggered. ([#4300](https://github.com/pybamm-team/PyBaMM/pull/4300))

## Breaking Changes

- Wycisk OCP reformatted to a more generalizable form. ([[#4332](https://github.com/pybamm-team/PyBaMM/issues/4332)])

# [v24.5](https://github.com/pybamm-team/PyBaMM/tree/v24.5) - 2024-07-26

## Features
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def set_rhs(self, variables):
domain, Domain = self.domain_Domain
phase_name = self.phase_name

current = variables[
i_surf = variables[
f"{Domain} electrode {phase_name}interfacial current density [A.m-2]"
]
# check if composite or not
Expand All @@ -165,12 +165,12 @@ def set_rhs(self, variables):
h = variables[f"{Domain} electrode {phase_name}hysteresis state"]

dhdt = (
K * (current / (Q_cell * (dQdU**K_x))) * (1 - pybamm.sign(current) * h)
K * (i_surf / (Q_cell * (dQdU**K_x))) * (1 - pybamm.sign(i_surf) * h)
) #! current is backwards for a halfcell
self.rhs[h] = dhdt

def set_initial_conditions(self, variables):
domain, Domain = self.domain_Domain
phase_name = self.phase_name
h = variables[f"{Domain} electrode {phase_name}hysteresis state"]
self.initial_conditions[h] = pybamm.Scalar(0)
self.initial_conditions[h] = self.phase_param.h_init
4 changes: 3 additions & 1 deletion src/pybamm/parameters/lithium_ion_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,9 @@ def _set_parameters(self):
self.hysteresis_switch = pybamm.Parameter(
f"{pref}{Domain} particle hysteresis switching factor"
)
self.h_init = pybamm.Scalar(0)
self.h_init = pybamm.Parameter(
f"{pref}Initial hysteresis state in {domain} electrode"
)

if self.options["open-circuit potential"] != "MSMR":
self.U_init = self.U(self.sto_init_av, main.T_init)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def test_wycisk_ocp(self):
+ 0.1,
"Negative particle hysteresis decay rate": 1,
"Negative particle hysteresis switching factor": 1,
"Initial hysteresis state in negative electrode": -0.5,
# "Negative electrode OCP hysteresis [V]": lambda sto: 1,
},
check_already_exists=False,
Expand Down