tldr-group / taufactor

TauFactor is a parallelised solver for calculating tortuosity factors from voxel data.
MIT License
28 stars 5 forks source link

Negative values for tortuosity #92

Open isaacbasil opened 1 year ago

isaacbasil commented 1 year ago

Description

I am running the taufactor solver for a large number of tif images using a loop. For the majority of the images it appears to work fine, but sometimes it returns a negative value for tortuosity. In these cases, I believe that the structure is actually impermeable (has an infinite tortuosity), but for some reason the solver converges to a negative value instead.

I have attached an example of a tif image which returns a negative tortuosity value for directions 2 and 3 (tau_yy and tau_zz).

I am calling the solver as follows:

img = tifffile.imread(filepath)
# ensure 1s for conductive phase and 0s otherwise.
img[img == 255] = 1
img[img == 2] = 1
s = tau.Solver(img)
# call solver 
s.solve(iter_limit=10000)

I then rotate the image and repeat. For the image attached, I get the following output:

converged to: 1.3490620851516724 after: 201 iterations in: 0.123 seconds at a rate of 0.0006 s/iter converged to: -14.758493423461914 after: 101 iterations in: 0.0612 seconds at a rate of 0.0006 s/iter converged to: -161.89920043945312 after: 101 iterations in: 0.0622 seconds at a rate of 0.0006 s/iter

patch_1_1_2.zip

I should also mention that I am running Taufactor using cpu rather than cuda.

Thanks,

Isaac

amirDahari1 commented 9 months ago

Hi Isaac,

Thanks for raising an issue! I've looked into your volume, and there really aren't any percolating paths along the 2nd and 3rd dimensions in your volume. The output should be Warning: not converged ; unconverged value of tau: 2448267.0

Our next release should solve this issue, and return a "not converged" message for the 2nd and 3rd dimensions.

95 should fix the wrong convergence (there was no convergence, just very negative flux) and #96 should fix the iter_limit problem where currently it has no effect.

Thanks, Amir

renxiaosa00 commented 8 months ago
                # Warning: not converged unconverged value of tau: 17.588836669921875                   after: 15901 iterations in: 703.4496                    seconds at a rate of 0.0442 s/iter tensor(0.0098) tensor(17.5888, device='cuda:0')

There are my results, can anyone tell me is this is right or wrong?

amirDahari1 commented 7 months ago

Hi @renxiaosa00, this depends on your microstructure, does it have percolating paths in the phase you're calculating tau for?