Promote flux and tau_from_cmap from beta to simulations - #1177
Draft
ma-sadeghi wants to merge 4 commits into
Draft
Promote flux and tau_from_cmap from beta to simulations#1177ma-sadeghi wants to merge 4 commits into
flux and tau_from_cmap from beta to simulations#1177ma-sadeghi wants to merge 4 commits into
Conversation
Moves `flux` and `tau_from_cmap` out of `porespy.beta` into `porespy.simulations`, alongside `tortuosity_fd`, since they're the intended companion utilities. No code changes — pure rename + import plumbing. Test suite updated to import from the new path. Three new edge-case tests (low-porosity 2D, partially blocked inlet, anisotropic shape) confirm `tau_from_cmap` agrees with `tortuosity_fd` to solver-noise level. Closes #1023.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1177 +/- ##
=======================================
+ Coverage 70.8% 71.0% +0.1%
=======================================
Files 45 46 +1
Lines 6533 6578 +45
=======================================
+ Hits 4627 4672 +45
Misses 1906 1906 🚀 New features to boost your workflow:
|
# Conflicts: # test/unit/test_dns.py
Member
|
@ma-sadeghi I had to reduce the rtol on your 3 tests to 1e-3 from 1e-4 and 1e-5. Maybe you can rerun your checks? |
jgostick
marked this pull request as draft
May 5, 2026 19:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1023.
Moves
fluxandtau_from_cmapfromporespy.beta._dns_toolsintoporespy.simulations._dns_tools, alongsidetortuosity_fd. Pure rename — no code changes — plus the import plumbing insimulations/__init__.pyandbeta/__init__.pyand the test imports.On the edge-case bug I asked about in the issue thread: I went looking for it and couldn't reproduce one. I swept several hundred combinations of
ndim ∈ {2, 3}, varied shapes (cubic, anisotropic, long-thin, short-fat down toL=2), porosities0.4–0.85, multiple seeds, all axes, plus targeted constructions (single-column channels, partially-blocked inlet faces, multiple disjoint percolating clusters, last-layer solids that exercise the_fix_gradient_outletpath). In every casetau_from_cmap(im_conc, im, axis)agreed withtortuosity_fd(im, axis).tortuosityat solver-noise level (worst rel-diff ~1.4e-5, typically 1e-6 or tighter). The boundary fix at the outlet is approximate but safe undertortuosity_fd's outputs because solid voxels and Dirichlet-zero outlet voxels both havec=0, which kills the only term that could disagree.Three new tests are added to capture the cases I checked manually so future readers can re-audit: low-porosity 2D blobs, an inlet face with a solid half, and an anisotropic 3D shape across all three axes.
Heads-up for #1170 if it lands second: it imports
from porespy.beta import flux; that path is gone and needs to becomefrom porespy.simulations import flux.