class Bravais(*args, **kwargs)[source]


Crystal lattice types including fcc, bcc, sc, and hcp

These arrangements not only allow more dense packing than the standard Cubic for higher porosity materials, but also have more interesting non-straight connections between the various pore sites.

More information on Bravais lattice notation can be found on wikipedia.

  • shape (array_like) – The number of pores in each direction. This value is a bit ambiguous for the more complex unit cells used here, but generally refers to the the number for ‘corner’ sites

  • spacing (array_like (optional)) – The spacing between pores in all three directions. Like the shape this is a bit ambiguous but refers to the spacing between corner sites. Essentially it controls the dimensions of the unit cell. It a scalar is given it is applied to all directions. The default is 1.

  • mode (string) –

    The type of lattice to create. Options are:

    • ’sc’ : Simple cubic (Same as Cubic)

    • ’bcc’ : Body-centered cubic lattice

    • ’fcc’ : Face-centered cubic lattice

    • ’hcp’ : Hexagonal close packed (Note Implemented Yet)

  • 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 openpnm.Project().

See also

Cubic, CubicDual


The pores are labelled as beloning to ‘corner_sites’ and ‘body_sites’ in bcc or ‘face_sites’ in fcc. Throats are labelled by the which type of pores they connect, e.g. ‘throat.corner_to_body’.


  • Bravais lattice can also have a skew to them, but this is not implemented yet.

  • Support for 2D networks has not been added yet.

  • Hexagonal Close Packed (hcp) has not been implemented yet, but is on the todo list.


>>> import openpnm as op
>>> sc =[3, 3, 3], mode='sc')
>>> bcc =[3, 3, 3], mode='bcc')
>>> fcc =[3, 3, 3], mode='fcc')
>>> sc.Np, bcc.Np, fcc.Np
(27, 35, 63)

Since these three networks all have the same domain size, it is clear that both ‘bcc’ and ‘fcc’ have more pores per unit volume. This is particularly helpful for modeling higher porosity materials.

They all have the same number corner sites, which corresponds to the [3, 3, 3] shape that was specified:

>>> sc.num_pores('corner*'), bcc.num_pores('cor*'), fcc.num_pores('cor*')
(27, 27, 27)

Visualization of these three networks can be done quickly using the functions in topotools. Firstly, merge them all into a single network for convenience:

>>> bcc['pore.coords'][:, 0] += 3
>>> fcc['pore.coords'][:, 0] += 6
>>> op.topotools.merge_networks(sc, [bcc, fcc])
>>> fig = op.topotools.plot_connections(sc)

For larger networks and more control over presentation use Paraview.

add_boundary_pores(labels, spacing)[source]

Add boundary pores to the specified faces of the network

Pores are offset from the faces by 1/2 of the given 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 must be given since it can be quite difficult to infer from the network, for instance if boundary pores have already added to other faces.