drainage_dt

drainage_dt(im, inlets, outlets=None, steps=None, smooth=True)[source]

Performs a distance transform based drainage simulation using distance transform thresholding for the erosion step and a second distance transform for the dilation step.

Parameters:
  • im (ndarray) – The boolean image of the void space on which to perform the simulation

  • inlets (ndarray (optional)) – A boolean array with True values indicating the inlet locations for the invading (non-wetting) fluid. If not provided then access limitations will not be applied, meaning that the invading fluid cand appear anywhere within the domain.

  • outlets (ndarray (optional)) – A boolean array with True values indicating the outlet locations through which defending (wetting) phase would exit the domain. If not provided then trapping of the wetting phase is ignored.

  • steps (scalar or array_like) – A list of which sphere sizes to invade. If None (default) then each unique integer value in the distance transform is used. If a scalar then a list of steps is generated from steps to 1.

  • smooth (boolean) – If True (default) then the spheres are drawn without any single voxel protrusions on the faces.

Returns:

results – A dataclass-like object with the following attributes:

Attribute

Description

im_seq

A numpy array with each voxel value indicating the sequence at which it was invaded. Values of -1 indicate that it was not invaded.

im_size

A numpy array with each voxel value indicating the radius of spheres being inserted when it was invaded.

Return type:

Results object

Notes

The distance transforms will be executed in parallel if porespy.settings.ncores > 1