-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
[Bug]: Upwind/downwind schemes are not working properly #3526
Comments
The current approach creates an "upwind matrix" that converts the standard divergence matrix to the upwind divergence. However, the standard divergence matrix is singular (or at least for the problem I tested above) so I don't think such transformation exists. I think a better approach would be to allow a keyword argument when calling |
I have been playing with it and I can think of 2 possible ways of implementing this, and it boils down to how we conceptualise the model. The entry point for both would be to allow an extra keyword
I am not sure which way to go. I am tempted to say that, unless we can think of a good near-future feature that would benefit from approach 2, let's use 1 for now as it is cleaner and less prone to errors. What do you think @tinosulzer @rtimms @martinjrobins? |
It's been too long since I thought hard about spatial methods so just do whatever you think is simplest and safest. Does adding |
* #3526 initialise branch * #3256 add UpwindDivergence and DownwindDivergence * work in progress for fixing upwind scheme * #3526 add missing argument docstring * #3526 fix upwind/downwind methods * style: pre-commit fixes * #3526 get finite volume notebook from develop * 3526 add temporary test * ruff * style: pre-commit fixes * #3526 remove unused variable * #3526 clarify wording * #3526 fix tests * #3526 add to CHANGELOG * #3526 update coverage * #3526 add integration test * style: pre-commit fixes * #3526 remove example for debugging * Remove print for debug Co-authored-by: Eric G. Kratz <[email protected]> * #3526 add second test * #3526 generalised example but did not add test as was hard to know what to measure * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric G. Kratz <[email protected]> Co-authored-by: Valentin Sulzer <[email protected]>
* pybamm-team#3526 initialise branch * pybamm-team#3256 add UpwindDivergence and DownwindDivergence * work in progress for fixing upwind scheme * pybamm-team#3526 add missing argument docstring * pybamm-team#3526 fix upwind/downwind methods * style: pre-commit fixes * pybamm-team#3526 get finite volume notebook from develop * 3526 add temporary test * ruff * style: pre-commit fixes * pybamm-team#3526 remove unused variable * pybamm-team#3526 clarify wording * pybamm-team#3526 fix tests * pybamm-team#3526 add to CHANGELOG * pybamm-team#3526 update coverage * pybamm-team#3526 add integration test * style: pre-commit fixes * pybamm-team#3526 remove example for debugging * Remove print for debug Co-authored-by: Eric G. Kratz <[email protected]> * pybamm-team#3526 add second test * pybamm-team#3526 generalised example but did not add test as was hard to know what to measure * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric G. Kratz <[email protected]> Co-authored-by: Valentin Sulzer <[email protected]>
PyBaMM Version
develop
Python Version
all
Describe the bug
Checking the problem solved in
finite-volumes.ipynb
it does not correspond with what one would expect from an upwind scheme.See example below.
Steps to Reproduce
The example below compares a toy problem with its analytical solution. Note that for coarse meshes there is some disagreement but it converges if you refine the mesh. Commenting the lines that fix the system retrieves the previous behaviour which disagrees with the analytical solution.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: