-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
Issue 1006 process space var #1020
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
pybamm/solvers/processed_variable.py
Outdated
second_dim = second_dim[:, 0] | ||
return interpolant(second_dim, first_dim) | ||
else: | ||
return interpolant(second_dim, first_dim)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there no way around the duplication of all these lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, have made a function to take the interpolant and inputs and returns the result of the correct shape
pybamm/solvers/processed_variable.py
Outdated
second_dim = second_dim[:, 0] | ||
return interpolant(first_dim, second_dim)[:, :, np.newaxis] | ||
else: | ||
return interpolant(first_dim, second_dim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated here
Description
Extend
processed_variable
to work in the case whenlen(t_sol)=1
and also makes it so you no longer need to passt
to the call in the cases where the variable is constant (doesn't depend ont
ory
) or whenlen(solution.t)=1
(e.g. algebraic models)Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #1006 and #571
EDIT: Note that for variables discretised using finite elements (in y and z) the result returned by
ProcessedVariable
is transposed. This is consistent with other features, e.g. you can now doplt.pcolormesh(x,y,z)
wherez
is some variable discretised with finite elements, whereas before you had to doplt.pcolormesh(x,y,np.transpose(z))
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ flake8
$ python run-tests.py --unit
$ cd docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks: