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

processed spatial variables #571

Closed
tobykirk opened this issue Aug 1, 2019 · 2 comments
Closed

processed spatial variables #571

tobykirk opened this issue Aug 1, 2019 · 2 comments
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours

Comments

@tobykirk
Copy link
Contributor

tobykirk commented Aug 1, 2019

We would like to process a SpatialVariable (into a "ProcessedSpatialVariable") to extract the limits and construct a np.array of points between them using linspace (or otherwise). This would allow easy plotting over any domain of choice.

@martinjrobins
Copy link
Contributor

might be able to make ProcessedVariable automatically detect if the variable is a spatial one and use a default np.array of points the same as the mesh on that domain?

martinjrobins added a commit that referenced this issue Aug 1, 2019
@valentinsulzer valentinsulzer added the difficulty: easy A good issue for someone new. Can be done in a few hours label Aug 1, 2019
@rtimms
Copy link
Contributor

rtimms commented May 26, 2020

you can now do this (see PR #1020) e.g.

import pybamm
import numpy as np

model = pybamm.lithium_ion.SPM()

sim = pybamm.Simulation(model)
solution = sim.solve()
r_n = solution["r_n [m]"]
r_n(r=np.linspace(0, 1, 10))

to get 10 linearly spaced points in the negative particle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants