- class Cubic(*args, **kwargs)¶
Simple cubic lattice with connectivity from 6 to 26
Though simple, the Cubic network offers many advantages such as easy visualization and accurate determination of domain area and length in transport calculations.
shape (array_like) – The [Nx, Ny, Nz] size of the network in terms of the number of pores in each direction
spacing (array_like, optional) – The spacing between pore centers in each direction. If not given, then [1, 1, 1] is assumed.
connectivity (int, optional) –
The number of connections to neighboring pores. Connections are made symmetrically to any combination of face, edge, or corners neighbors. The default is 6 to create a simple cubic structure, but options are:
6: Faces only
14: Faces and Corners
18: Faces and Edges
20: Edges and Corners
26: Faces, Edges and Corners
For a more random distribution of connectivity, use a high
connectivity(i.e. 26) and then delete a fraction of the throats using
name (string) – An optional name for the object to help identify it. If not given, one will be generated.
project (OpenPNM Project object, optional) – Each OpenPNM object must be part of a Project. If none is supplied then one will be created and this Network will be automatically assigned to it. To create a Project use
The distance between pore centers. This value becomes meaningless if the topology is manipulated at all (i.e. by adding boundary pores) since there is not unique or consistent value. In such cases an exception is thrown.
int or array
The shape of the network. Like
spacingthis values is meaningless if the topology is manipulated, so an Exception is thrown.
>>> import openpnm as op >>> pn = op.network.Cubic(shape=[5, 5, 5], spacing=[1, 1, 1]) >>> pn.Np 125
And it can be plotted for quick visualization using:
>>> fig = op.topotools.plot_connections(network=pn) >>> fig = op.topotools.plot_coordinates(network=pn, c='r', s=75, fig=fig)
For larger networks and more control over presentation use Paraview.
- add_boundary_pores(labels=['top', 'bottom', 'front', 'back', 'left', 'right'], spacing=None)¶
Add pores to the faces of the network for use as boundary pores.
Pores are offset from the faces by 1/2 a lattice spacing such that they lie directly on the boundaries.
labels (string or list of strings) – The labels indicating the pores defining each face where boundary pores are to be added (e.g. ‘left’ or [‘left’, ‘right’])
spacing (scalar or array_like) – The spacing of the network (e.g. [1, 1, 1]). This should be given since it can be quite difficult to infer from the network, for instance if boundary pores have already added to other faces.
- from_array(array, propname)¶
Apply data to the network based on a rectangular array filled with values. Each array location corresponds to a pore in the network.
array (array_like) – The rectangular array containing the values to be added to the network. This array must be the same shape as the original network.
propname (string) – The name of the pore property being added.
Converts the values to a rectangular array with the same shape as the network
values (array_like) – An Np-long array of values to convert to
This method can break on networks that have had boundaries added. It will usually work IF the given values came only from ‘internal’ pores.