openpnm.topotools.merge_pores(network, pores, labels=['merged'])[source]

Combines a selection of pores into a new single pore located at the centroid of the selected pores and connected to all of their neighbors.

  • network (GenericNetwork) –

  • pores (array_like) – The list of pores which are to be combined into a new single pore

  • labels (str or list[str]) – The labels to apply to the new pore and new throat connections


(1) The method also works if a list of lists is passed, in which case it consecutively merges the given selections of pores.

(2) The selection of pores should be chosen carefully, preferrable so that they all form a continuous cluster. For instance, it is recommended to use the find_nearby_pores method to find all pores within a certain distance of a given pore, and these can then be merged without causing any abnormal connections.


>>> import openpnm as op
>>> pn =[20, 20, 1])
>>> Ps = pn.find_nearby_pores(pores=111, r=5, flatten=True)
>>> op.topotools.merge_pores(network=pn, pores=Ps, labels=['merged'])
>>> print(pn.Np)
>>> pn.pores('merged')
>>> pn.num_throats('merged')