porespy.simulations.drainage_dt_conv#
- porespy.simulations.drainage_dt_conv(im, inlets=None, outlets=None, dt=None, steps=None, smooth=False)#
Performs a distance transform based drainage simulation using distance transform thresholding for the erosion step and fft-based convolution 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 can 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.
dt (ndarray, optional) – The distance transform of the void space. This is optional, but providing it if it is already available save some time.
steps (scalar or array_like) – Controls which sphere sizes to invade. If an int then this many steps between 1 and the maximum size are used. A tuple is treated as the start and stop of the integer values. A list or ndarray is used directly. If None (default) then each unique value in the distance transform is used.
- Returns:
results – An object with the following attributes:
Attribute
Description
im_seq
An ndarray with each voxel indicating the step number at which it was first invaded. -1 indicates uninvaded, either due to the applied steps not spanning the full range of sizes in the image, or due to trapping, while 0 indicates residual invading phase. With return_indices=True, 0 represents uninvaded or solid voxels and the array has a compact unsigned dtype.
im_size
A numpy array with each voxel containing the radius of the sphere, in voxels, that first overlapped it. inf indicates uninvaded, either due to the applied steps not spanning the full range of sizes in the image, or due to trapping, while 0 indicates residual invading phase. Not present when return_indices is True.
bins
Applied sizes prefixed with 0, so that
bins[im_seq]reconstructs im_size. Only present when return_indices is True.- Return type:
Dataclass-like object
Notes
The distance transform will be executed in parallel if porespy.settings.ncores > 1