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

3D Processed Variables #2394

Open
rtimms opened this issue Oct 21, 2022 · 4 comments
Open

3D Processed Variables #2394

rtimms opened this issue Oct 21, 2022 · 4 comments
Labels
difficulty: medium Will take a few days feature priority: low No existing plans to resolve

Comments

@rtimms
Copy link
Contributor

rtimms commented Oct 21, 2022

Allow processing of 3D variables. E.g. to access concentration in a 1x1x1D model:

import pybamm

model = pybamm.lithium_ion.DFN(options={"current collector": "potential pair", "dimensionality": 1})
sim = pybamm.Simulation(model)
sol = sim.solve([0, 100])
sol["Negative particle concentration [mol.m-3]"].entries

This currently gives NotImplementedError: Shape not recognized for y[0:4000] * 24983.2619938437 (note processing of 3D variables is not yet implemented)

@rtimms
Copy link
Contributor Author

rtimms commented Oct 21, 2022

See #1549

@rtimms
Copy link
Contributor Author

rtimms commented Oct 21, 2022

Workaround to evaluate 3D variables at a given time and state

# get expression for the variable of interest
c_n = sim.built_model.variables["Negative particle concentration [mol.m-3]"]

# get time and states
t = sol.t
y = sol.y

# evaluate at a given time and state - the expression takes (time, state, inputs)
c_n.evaluate(t[90], y[:, 90], [])

@valentinsulzer
Copy link
Member

#2366 might make this easier (especially the interpolation in 3D)

@rtimms
Copy link
Contributor Author

rtimms commented May 2, 2023

should be easier now #2907 has been merged

@rtimms rtimms added feature difficulty: medium Will take a few days labels May 2, 2023
@rtimms rtimms added the priority: low No existing plans to resolve label May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium Will take a few days feature priority: low No existing plans to resolve
Projects
None yet
Development

No branches or pull requests

2 participants