drainage¶
- drainage(im: ndarray[Any, dtype[_ScalarType_co]], pc: ndarray[Any, dtype[_ScalarType_co]] = None, dt: ndarray[Any, dtype[_ScalarType_co]] = None, inlets: ndarray[Any, dtype[_ScalarType_co]] = None, outlets: ndarray[Any, dtype[_ScalarType_co]] = None, residual: ndarray[Any, dtype[_ScalarType_co]] = None, bins: int = 25, return_sizes: bool = False)[source]¶
Simulate drainage using image-based sphere insertion, optionally including gravity
- Parameters:
im (ndarray) – The image of the porous media with
True
values indicating the void space.pc (ndarray, optional) – Precomputed capillary pressure transform which is used to determine the invadability of each voxel. If not provided then twice the inverse of the distance transform of im is used.
dt (ndarray (optional)) – The distance transform of
im
. If not provided it will be calculated, so supplying it saves time.inlets (ndarray, optional) – A boolean image the same shape as
im
, withTrue
values indicating the inlet locations. If not specified then access limitations are not applied so the result is essentially a local thickness filter.outlets (ndarray, optional) – A boolean image with
True
values indicating the outlet locations. If this is provided then trapped voxels of wetting phase are found and all the output images are adjusted accordingly. Note that trapping can be assessed during postprocessing as well.residual (ndarray, optional) – A boolean array indicating the locations of any residual invading phase. This is added to the intermediate image prior to trimming disconnected clusters, so will create connections to some clusters that would otherwise be removed. The residual phase is indicated in the final image by
-np.inf
values, since these are invaded at all applied capillary pressures.bins (int or array_like (default = None)) – The range of pressures to apply. If an integer is given then the given number of bins will be created between the lowest and highest values in
pc
. If a list is given, each value in the list is used in ascending order. If None is given (default) then all the possible values in pc are used (or dt if pc is not given).return_sizes (bool, default = False) – If True then an array containing the size of the sphere which first overlapped each pixel is returned. This array is not computed by default as computing it increases computation time.
conn (str) –
Controls the shape of the structuring element used to find neighboring voxels when looking connectivity of invading blobs. Options are:
Option
Description
’min’
This corresponds to a cross with 4 neighbors in 2D and 6 neighbors in 3D.
’max’
This corresponds to a square or cube with 8 neighbors in 2D and 26 neighbors in 3D.
- Returns:
results – A dataclass-like object with the following attributes:
Attribute
Description
im_seq
An ndarray with each voxel indicating the step number at which it was first invaded by non-wetting phase
im_satn
A numpy array with each voxel value indicating the global saturation value at the point it was invaded
im_size
If return_sizes was set to True, then a numpy array with each voxel containing the radius of the sphere, in voxels, that first overlapped it.
im_pc
A numpy array with each voxel value indicating the capillary pressure at which it was invaded.
im_trapped
A numpy array with
True
values indicating trapped voxelspc
1D array of capillary pressure values that were applied
swnp
1D array of non-wetting phase saturations for each applied value of capillary pressure (
pc
).- Return type:
Results object
See also
Notes
This algorithm only provides sensible results for gravity stabilized configurations, meaning the more dense fluid is on the bottom. Be sure that
inlets
are specified accordingly.Examples
Click here to view online example.