Skip to content

[Bug]: Initial concentration function fails for DFN model #4930

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

Open
d-cogswell opened this issue Mar 24, 2025 · 0 comments
Open

[Bug]: Initial concentration function fails for DFN model #4930

d-cogswell opened this issue Mar 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@d-cogswell
Copy link
Contributor

PyBaMM Version

25.1.1

Python Version

3.12.4

Describe the bug

Passing an initial concentration function which makes use of r or x fails for DFN models. The same function runs without error for other models such as BasicDFN.

Steps to Reproduce

import pybamm


# x-dependent initial concentration
def initial_concentration(r, x):
    return 17038.0 + r + x


parameter_values = pybamm.ParameterValues("Chen2020")
parameter_values.update(
    {
        "Initial concentration in negative electrode [mol.m-3]": initial_concentration,
    }
)

model = pybamm.lithium_ion.DFN()
experiment = pybamm.Experiment(["Rest for 1 sec"])
sim = pybamm.Simulation(
    model,
    experiment=experiment,
    parameter_values=parameter_values,
)
solution = sim.solve()

Relevant log output

NotImplementedError: method self.evaluate() not implemented for symbol r_n of type <class 'pybamm.expression_tree.independent_variable.SpatialVariable'
@d-cogswell d-cogswell added the bug Something isn't working label Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant