porespy.simulations.drainage#
- porespy.simulations.drainage(im: numpy.typing.NDArray, pc: numpy.typing.NDArray = None, dt: numpy.typing.NDArray = None, inlets: numpy.typing.NDArray = None, outlets: numpy.typing.NDArray = None, residual: numpy.typing.NDArray = None, steps: int = None, conn: Literal['min', 'max'] = 'min', min_size: int = 0, smooth: bool = True)#
Simulate drainage using image-based sphere insertion, optionally including gravity [1].
- Parameters:
im (ndarray) – The image of the porous media with
Truevalues 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, withTruevalues indicating the inlet locations. If not specified then access limitations are not applied so invading phase can appear anywhere within the domain.outlets (ndarray, optional) – A boolean image with
Truevalues indicating the outlet locations. If this is provided then trapped voxels of wetting phase are found and all the output images are adjusted accordingly.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 capillary pressure map by
-np.infvalues, since these voxels 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.conn (str) –
Controls the shape of the structuring element used to find neighboring voxels when looking at 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. -1 indicates uninvaded, either due to the maximum pressure being too low, or trapping, while 0 indicates residual.
im_pc
A numpy array with each voxel value indicating the capillary pressure at which it was invaded. inf indicates uninvaded, either due to the maximum pressure being too low, or due to trapping.
im_snwp
A numpy array with each voxel value indicating the global value of the non-wetting phase saturation at the point it was invaded. -1 indicates uninvaded, either due to the maximum pressure being too low, or trapping, while 0 indicates residual.
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 maximum pressure being too low, or trapping, while 0 indicates residual.
im_trapped
A numpy array with
Truevalues indicating trapped voxels. If outlets was not provided it will be all False.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
References
Examples
Click here to view online example.