size_to_satn#

Converts values of invasion size into a saturation map

import numpy as np
import porespy as ps
import matplotlib.pyplot as plt
from edt import edt
ps.visualization.set_mpl_style()
[17:44:52] ERROR    PARDISO solver not installed, run `pip install pypardiso`. Otherwise,          _workspace.py:56
                    simulations will be slow. Apple M chips not supported.                                         

The arguments and default values for this function are:

import inspect
inspect.signature(ps.filters.size_to_satn)
<Signature (size, im=None, bins=None, mode='drainage')>

Generate an image containing invasion sizes using the porosimetry function:

np.random.seed(0)
im = ps.generators.blobs([200, 200], porosity=0.5)
inv = ps.filters.porosimetry(im)

size#

The sizes are produced by porosimetry for instance:

satn = ps.filters.size_to_satn(size=inv)
fig, ax = plt.subplots(1, 2, figsize=[12, 6])
ax[0].imshow(inv/im, origin='lower', interpolation='none')
ax[0].set_title('Invasion map by size')
ax[0].axis(False)
ax[1].imshow(satn/im, origin='lower', interpolation='none')
ax[1].set_title('Invasion map by saturation')
ax[1].axis(False);
../../../_images/2f348c369cff453b0db80f7bc3bb1e08c1e56eeb288597b4e67962c5e7c54454.png

The saturation map makes it very easy to obtain a desired fluid configuration just by applying a threhold:

fig, ax = plt.subplots(1, 2, figsize=[12, 6])

s = 0.3
ax[0].imshow((satn < s)*(satn > 0)/im, origin='lower', interpolation='none')
ax[0].set_title(f'saturation = {s}')
ax[0].axis(False)

s = 0.6
ax[1].imshow((satn < s)*(satn > 0)/im, origin='lower', interpolation='none')
ax[1].set_title(f'saturation = {s}')
ax[1].axis(False);
../../../_images/3d5721b9afbadfa3ce9cf5caa917b2b394f52a14976cc8a767b70989b517bc19.png

im#

The boolean image can be optionally passed into so that uninvaded regions can be differentiated from solid (if both are labelled 0).

fig, ax = plt.subplots(1, 2, figsize=[12, 6])

satn = ps.filters.size_to_satn(size=inv)
ax[0].imshow(satn, origin='lower', interpolation='none')
ax[0].set_title('Invasion map by size')
ax[0].axis(False)

satn = ps.filters.size_to_satn(size=inv, im=im)
ax[1].imshow(satn, origin='lower', interpolation='none')
ax[1].set_title('Invasion map by saturation')
ax[1].axis(False);
../../../_images/68834e8bdfc2d1b24a6186d0b5c37882735c85c13cb8a3042f04a09639ab36aa.png

The different between the two images above is that when im is not supplied, then uninvaded regions are given a lable of 0, matching solid. When im is supplied, the uninvaded regions are labelled -1.

bins#

The number of sequence values to when converting sizes. The default is 25.

fig, ax = plt.subplots(1, 2, figsize=[12, 6])

bins = 5
seq = ps.filters.size_to_satn(size=inv, bins=bins)
ax[0].imshow(seq, origin='lower', interpolation='none')
ax[0].set_title(f'bins = {bins}')
ax[0].axis(False)

bins = 25
seq = ps.filters.size_to_satn(size=inv, bins=bins)
ax[1].imshow(seq, origin='lower', interpolation='none')
ax[1].set_title(f'bins = {bins}')
ax[1].axis(False);
../../../_images/f8cc452b0c7e24c4ecbdbbbda02b1c94561743c08dad69014e4bd8a2c9dd4b55.png