spatially_correlated(network, weights=None, strel=None)[source]#

Generates pore seeds that are spatailly correlated with their neighbors.


network (OpenPNM Network object) –

weightslist of ints, optional

The [Nx, Ny, Nz] distances (in number of pores) in each direction that should be correlated.

strelarray_like, optional (in place of weights)

This option allows full control over the spatial correlation pattern by specifying the structuring element to be used in the convolution.

The array should be a 3D array containing the strength of correlations in each direction. Nonzero values indicate the strength, direction and extent of correlations. The following would achieve a basic correlation in the x-direction:

strel = np.array([[[0, 0, 0], [0, 0, 0], [0, 0, 0]],
                  [[0, 0, 0], [1, 1, 1], [0, 0, 0]],
                  [[0, 0, 0], [0, 0, 0], [0, 0, 0]]])

seeds – A numpy ndarry containing pore cross-sectional area values

Return type:



This approach uses image convolution to replace each pore seed in the geoemtry with a weighted average of those around it. It then converts the new seeds back to a random distribution by assuming they new seeds are normally distributed.

Because is uses image analysis tools, it only works on Cubic networks.

This is the appproached used by Gostick et al [1] to create an anistropic gas diffusion layer for fuel cell electrodes.



J. Gostick et al, Pore network modeling of fibrous gas diffusion layers for polymer electrolyte membrane fuel cells. J Power Sources v173, pp277–290 (2007)