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, steps: int = 25, return_sizes: bool = False, min_size: int = 0)[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 it is calculated as 2/dt.

  • 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, with True 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.

  • steps (int or array_like (default = 25)) – The range of pressures to apply. If an integer is given then the given number of steps 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 then all the possible values in pc are used.

  • 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.

  • min_size (int) – Any clusters of trapped voxels smaller than this size will be set to not trapped. This argument is only used if outlets is given. This is useful to prevent small voxels along edges of the void space from being set to trapped. These can appear to be trapped due to the jagged nature of the digital image. The default is 0, meaning this adjustment is not applied, but a value of 3 or 4 is recommended to activate this adjustment.

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 value of the non-wetting phase saturation 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 voxels if outlets was provided, otherwise will be None.

pc

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

drainage

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.

References

Examples

Click here to view online example.