Cubic

class openpnm.network.Cubic(*args, **kwargs)[source]

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.

Parameters
  • shape (array_like) – The [Nx, Ny, Nz] size of the network in terms of the number of pores in each direction. For a 2D network

  • 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:

    Value

    Result

    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 openpnm.topotools.reduce_coordination. Also note that corners-only and edges-only are not permitted since they create disconnected networks. If you require one of these topologies you can specify 14 or 18, then use openpnm.topotools.trim to remove the face-to-face connections, which can be identified by looking for throats with a length equal to the network spacing.

  • settings (dataclass-like or dict, optional) – User defined settings for the object to override defaults. Can be a dataclass-type object with settings stored as attributes or a python dicionary of key-value pairs. Settings are stored in the settings attribute of the object.

  • name (string, optional) – A unique name to assign to the object for easier identification. If not given one will be generated.

Examples

import openpnm as op
import matplotlib.pyplot as plt

pn = op.network.Cubic(shape=[5, 5, 5], spacing=[1, 1, 1])

fig, ax = plt.subplots(figsize=(5, 5))
op.topotools.plot_connections(network=pn, ax=ax)
op.topotools.plot_coordinates(network=pn, c='r', s=75, ax=ax)

plt.show()
../../_images/openpnm-network-Cubic-1.svg

For larger networks and more control over presentation use Paraview.

Attributes
Np

A shortcut to query the total number of pores on the object

Nt

A shortcut to query the total number of throats on the object

Ps

A shortcut to get a list of all pores on the object

Ts

A shortcut to get a list of all throats on the object

am

Adjacency matrix in the specified sparse format, with throat IDs indicating the non-zero values.

conns

Returns the connectivity matrix of the network.

coords

Returns the list of pore coordinates of the network.

im

Incidence matrix in the specified sparse format, with pore IDs indicating the non-zero values.

models

List of available models on the objects

name

String representing the name of the object

network

A shortcut to get a handle to the associated network.

project

A shortcut to get a handle to the associated project.

settings

Dictionary containing object settings.

Methods

add_boundary_pores([labels, spacing])

Add pores to the faces of the network for use as boundary pores.

add_model(propname, model[, regen_mode])

Adds a new model to the models dictionary.

check_network_health()

This method check the network topological health.

create_adjacency_matrix([weights, fmt, ...])

Generates a weighted adjacency matrix in the desired sparse format

create_incidence_matrix([weights, fmt, ...])

Creates a weighted incidence matrix in the desired sparse format

filter_by_label([pores, throats, labels, mode])

Returns which of the supplied pores (or throats) has the specified label(s)

find_connected_pores([throats, flatten, mode])

Return a list of pores connected to the given list of throats

find_connecting_throat(P1, P2)

Return the throat index connecting pairs of pores.

find_nearby_pores(pores, r[, flatten, ...])

Find all pores within a given radial distance of the input pore(s) regardless of whether or not they are toplogically connected.

find_neighbor_pores(pores[, mode, flatten, ...])

Returns a list of pores that are direct neighbors to the given pore(s)

find_neighbor_throats(pores[, mode, flatten])

Returns a list of throats neighboring the given pore(s)

get_adjacency_matrix([fmt])

Adjacency matrix in the specified sparse format, with throat IDs indicating the non-zero values.

get_conduit_data(poreprop[, throatprop, mode])

Combines requested data into a single 3-column array.

get_incidence_matrix([fmt])

Incidence matrix in the specified sparse format, with pore IDs indicating the non-zero values.

interleave_data(prop)

Retrieves requested property from associated objects, to produce a full Np or Nt length array.

interpolate_data(propname[, mode])

Determines a pore (or throat) property as the average of it's neighboring throats (or pores)

labels([pores, throats, element, mode])

Returns a list of labels present on the object

num_neighbors(pores[, mode, flatten])

Returns the number of neigbhoring pores for each given input pore

num_pores([labels, mode])

Returns the number of pores of the specified labels

num_throats([labels, mode])

Return the number of throats of the specified labels

params()

Return parameter names and values in a dictionary

pores([labels, mode, asmask, to_global])

Returns pore indicies where given labels exist, according to the logic specified by the mode argument.

props([element, mode, deep])

Returns a list containing the names of all defined pore or throat properties.

regenerate_models([propnames, exclude, deep])

Re-runs the specified model or models.

remove_model([propname, mode])

Removes model and data from object.

set_label(label[, pores, throats, mode])

Creates or updates a label array

show_hist([props, bins, fontsize])

Shows a quick plot of key property distributions.

throats([labels, mode, asmask, to_global])

Returns throat locations where given labels exist, according to the logic specified by the mode argument.

to_indices(mask)

Converts a boolean mask to a list of pore or throat indices.

to_mask([pores, throats])

Convert a list of pore or throat indices into a boolean mask of the correct length.