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

sim.plot() crashes for DFN half-cell #1720

Closed
brosaplanella opened this issue Oct 6, 2021 · 0 comments · Fixed by #1731 or #1763
Closed

sim.plot() crashes for DFN half-cell #1720

brosaplanella opened this issue Oct 6, 2021 · 0 comments · Fixed by #1731 or #1763
Assignees
Labels
bug Something isn't working difficulty: easy A good issue for someone new. Can be done in a few hours

Comments

@brosaplanella
Copy link
Member

  • PyBaMM version - $ python -m pip show pybamm: 21.9
  • Python version - $ python --version: any

Describe the bug
When plotting the default plot for a simulation of a DFN half-cell model it crashes because it tries to plot the "Negative particle surface concentration [mol.m-3]" which does not exist for that model. Instead, the variables for the lithium counter electrode should be plotted (similar to how lead-acid is handled).

The key to fix this is to add a new case statement in line 163 of quick_plot.py.

To Reproduce
Steps to reproduce the behaviour:

import pybamm
import numpy as np

print(pybamm.__version__)

options = {"working electrode" : "positive"}

model = pybamm.lithium_ion.DFN(options = options)

# param = model.default_parameter_values
param = pybamm.ParameterValues(chemistry=pybamm.parameter_sets.Chen2020_plating)

sim = pybamm.Simulation(
    model,
    parameter_values=param
)
sim.solve(
    t_eval = np.linspace(0, 1000, 200),
    solver = pybamm.CasadiSolver(mode="safe"),
)
sol = sim.solution

sim.plot(output_variables=["Terminal voltage [V]"])

Expected behaviour
Plot the relevant variables for the model

@brosaplanella brosaplanella added bug Something isn't working difficulty: easy A good issue for someone new. Can be done in a few hours labels Oct 6, 2021
@valentinsulzer valentinsulzer mentioned this issue Oct 8, 2021
8 tasks
@valentinsulzer valentinsulzer self-assigned this Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working difficulty: easy A good issue for someone new. Can be done in a few hours
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants