Skip to content

[Bug]: SPMe surface form "false" and "algebraic" give different answers #4910

@valentinsulzer

Description

@valentinsulzer

PyBaMM Version

25.1.1

Python Version

3.11

Describe the bug

The SPMe with surface form "false" and "algebraic" give different results. I don't remember if this is expected or not. This was found because setting "particle phases" to ("1", "1") sets surface form to "algebraic" (also a bug)

Steps to Reproduce

import pybamm
import matplotlib.pyplot as plt

options_list = [
    ("two-particle", { "particle phases": ("1", "1")}),
    ("algebraic", {"surface form": "algebraic"}),
    ("standard", {})
]

sims = []
for label, options in options_list:
    model = pybamm.lithium_ion.SPMe(options)
    sim = pybamm.Simulation(model)
    sim.solve([0, 3600])
    sims.append((label, sim))

fig, ax = plt.subplots(1, 1)
for label, sim in sims:
    ax.plot(
        sim.solution["Time [min]"].data,
        sim.solution["Battery voltage [V]"].data,
        marker= 'o' if label == 'algebraic' else 's' if label == 'two-particle' else '^',
        label=label
    )

ax.set_xlabel("Time [min]")
ax.set_ylabel("Voltage [V]")
ax.legend()
plt.show()

Algebraic and two-particle match, standard is slightly lower

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions