label_boundaries
¶
This function add boundary pore labels to the netwrok based on proximity to axis extrema. This function should probably be part of OpenPNM since only operates on network objects, it is included here so that complete networks can be created in PoreSpy then used anywhere.
import numpy as np
import porespy as ps
import openpnm as op
import matplotlib.pyplot as plt
ws = op.Workspace()
ws.settings['loglevel'] = 50
np.random.seed(10)
ps.visualization.set_mpl_style()
[01:05:44] ERROR PARDISO solver not installed, run `pip install pypardiso`. Otherwise, _workspace.py:56 simulations will be slow. Apple M chips not supported.
network
¶
Any network dict
in OpenPNM format will work, but presumably this will come from an extracted network:
im = ps.generators.overlapping_spheres([100, 100], r=7, porosity=0.7)
snow = ps.filters.snow_partitioning(im)
net = ps.networks.regions_to_network(snow.regions)
net = ps.networks.label_boundaries(network=net)
for item in net.keys():
print(item)
throat.conns
pore.coords
pore.all
throat.all
pore.region_label
pore.phase
throat.phases
pore.region_volume
pore.equivalent_diameter
pore.local_peak
pore.global_peak
pore.geometric_centroid
throat.global_peak
pore.inscribed_diameter
pore.extended_diameter
throat.inscribed_diameter
throat.total_length
throat.direct_length
throat.perimeter
pore.volume
pore.surface_area
throat.cross_sectional_area
throat.equivalent_diameter
pore.boundary
pore.left
pore.right
pore.front
pore.back
pore.top
pore.bottom
As can be seen, labels for 'pore.top'
and 'pore.bottom'
, etc have been added.
labels
¶
It is possible to specify custom labels if desried. This should be specified as a list-of-lists, with the first list containing the labels to apply to the beginning and end of the first axis, and the second for the second axis, and so on:
net = ps.networks.regions_to_network(snow.regions)
net = ps.networks.label_boundaries(network=net, labels=[['north', 'south'], ['east', 'west']])
for item in net.keys():
print(item)
throat.conns
pore.coords
pore.all
throat.all
pore.region_label
pore.phase
throat.phases
pore.region_volume
pore.equivalent_diameter
pore.local_peak
pore.global_peak
pore.geometric_centroid
throat.global_peak
pore.inscribed_diameter
pore.extended_diameter
throat.inscribed_diameter
throat.total_length
throat.direct_length
throat.perimeter
pore.volume
pore.surface_area
throat.cross_sectional_area
throat.equivalent_diameter
pore.boundary
pore.north
pore.south
pore.east
pore.west
We can see that 'pore.left'
and 'pore.right'
have been replaced with 'pore.north'
and 'pore.south'
. Of course the default labels are probably better than that. However, the snow2
function uses 'xmin'
and 'xmax'
which is more generic and universal than 'left'
and 'right'
.