find_clusters

openpnm.topotools.find_clusters(network, mask=[], t_labels=False)[source]

Identify connected clusters of pores in the network. This method can also return a list of throat cluster numbers, which correspond to the cluster numbers of the pores to which the throat is connected. Either site and bond percolation can be considered, see description of input arguments for details.

Parameters
  • network (GenericNetwork) – The network

  • mask (array_like, boolean) – A list of active bonds or sites (throats or pores). If the mask is Np long, then the method will perform a site percolation, and if the mask is Nt long bond percolation will be performed.

Returns

  • A tuple containing an Np long list of pore cluster labels, and an Nt-long

  • list of throat cluster labels. The label numbers correspond such that

  • pores and throats with the same label are part of the same cluster.

Examples

>>> import openpnm as op
>>> import numpy as np
>>> pn = op.network.Cubic(shape=[25, 25, 1])
>>> pn['pore.seed'] = np.random.rand(pn.Np)
>>> pn['throat.seed'] = np.random.rand(pn.Nt)