-
Notifications
You must be signed in to change notification settings - Fork 174
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
Traceback when getting flow rate of a network with a single throat #2796
Comments
Hi. Can you share an MWE? (minimum working example that reproduces the bug) |
Of course.
Running this will throw the following error:
The error will not occur with larger networks, (increasing Nz to 3 already avoids it). It is definitely a consequence of np.squeeze eliminating all axes with size 1, which is the case for all axes in an array with a single element. |
Addendum: The bug can alternativelly be solved by replacing line 315 |
@Arenhart Thanks for reporting this. It's indeed a bug. Your solution works just fine, but let's use |
@ma-sadeghi Done |
Thank "you" for contributing to OpenPNM! If you were interested in further developing OpenPNM, we have a long list of issues and we welcome/appreciate PRs 😊 |
Running the following line:
perm.rate(throats=perm.network.throats("all"), mode="individual")
(where perm is a openpnm.algorithms.StokesFlow of a network with a single throat)
throws the following error:
This seems to be caused by the following line squeezing a ndarray with more than one dimension, but a single value, into a zero-dimension array when it has a single value, while the rest of the code still treats the variable as a one dimension array:
https://github.com/PMEAL/OpenPNM/blob/0efb343f2f564b4cf0189828d49096da1addddda/openpnm/algorithms/_transport.py#L315C46-L315C46
Qt = np.diff(g*X12, axis=1).squeeze()
I fixed the problem locally with the following code below the previous line:
Is this solution acceptable? Can I make a pull request to fix it in the repository?
The text was updated successfully, but these errors were encountered: