spatially_correlated

openpnm.models.geometry.pore_seed.spatially_correlated(target, weights=None, strel=None)[source]

Generates pore seeds that are spatailly correlated with their neighbors.

Parameters
  • target (OpenPNM Base object) – Object with which this model is associated. This controls the length of the calculated array, and also provides access to other necessary properties.

  • weights (list of ints, optional) – The [Nx, Ny, Nz] distances (in number of pores) in each direction that should be correlated.

  • strel (array_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]]])
    

Returns

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

Return type

ndarray

Notes

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.

References

1

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)

Examples

>>> import openpnm as op
>>> pn = op.network.Cubic(shape=[10, 10, 10])
>>> Ps, Ts = pn.Ps, pn.Ts
>>> geom = op.geometry.GenericGeometry(network=pn, pores=Ps, throats=Ts)
>>> mod = op.models.geometry.pore_seed.spatially_correlated
>>> geom.add_model(propname='pore.seed', model=mod, weights=[2, 2, 2])