Delaunay¶

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

Random network formed by Delaunay tessellation of arbitrary base points

Parameters
• points (array_like or int) – Can either be an N-by-3 array of point coordinates which will be used, or a scalar value indicating the number of points to generate

• shape (array_like) –

The size of the domain. It’s possible to create cubic as well as 2D square domains by changing the shape as follows:

[x, y, z]

will produce a normal cubic domain of dimension x, and and z

[x, y, 0]

will produce a 2D square domain of size x by y

• name (str) – An optional name for the object to help identify it. If not given, one will be generated.

Notes

This class always performs the tessellation on the full set of points, then trims any points that lie outside the given domain shape.

Examples

import numpy as np
import openpnm as op
import matplotlib.pyplot as plt

# Supplying custom specified points
pts = np.random.rand(200, 3)
gn = op.network.Delaunay(points=pts, shape=[1, 1, 1])

# Check the number of pores in 'gn'
print(gn.Np)

# Which can be quickly visualized using
fig, ax = plt.subplots(figsize=(5, 5))
op.topotools.plot_connections(network=gn, ax=ax)

plt.show()

Upon visualization it can be seen that this network is not very cubic. There are a few ways to combat this, but none will make a truly square domain. Points can be generated that lie outside the domain shape and they will be automatically trimmed.

import numpy as np
import openpnm as op
import matplotlib.pyplot as plt

# Must have more points for same density
pts = np.random.rand(300, 3)*1.2 - 0.1
gn = op.network.Delaunay(points=pts, shape=[1, 1, 1])

# Confirm base points have been trimmed
print(gn.Np < 300)

# And visualizing
fig, ax = plt.subplots(figsize=(5, 5))
op.topotools.plot_connections(network=gn, ax=ax)

plt.show()

If a domain with random base points but flat faces is needed use Voronoi.

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.

tri

A shortcut to get a handle to the Delanuay subnetwork

vor

A shortcut to get a handle to the Voronoi subnetwork

Methods