Reduction of coordination number #2715
-
Hi, import openpnm as op
from openpnm.utils import HealthDict
import matplotlib.pyplot as plt
import numpy as np
import scipy. stats as spst
op.visualization.set_mpl_style()
pn = op.network.Cubic(shape=[20,20,51], spacing=1)
fig = op.visualization.plot_connections(network=pn)
geo = op.models.collections.geometry.spheres_and_cylinders
pn.add_model_collection(geo)
pn.regenerate_models()
print(pn)
neighbor_pores= pn.find_neighbor_pores(pn.pores())
num_neighbors= pn.num_neighbors(pn.pores(), flatten=False)
print (num_neighbors)
Avg_Cnum= np.mean(num_neighbors)
print(Avg_Cnum)
op.topotools.reduce_coordination(network=pn, z=3.9) # Reducing average coordination number to 3.9
Ps=pn.num_neighbors(pores=pn.Ps)
op.topotools.trim(pn,pores=Ps==1)
while (Ps==1).any():
Ps=pn.num_neighbors(pores=pn.Ps)
op.topotools.trim(pn,pores=Ps==1)
print("Number of pores after elimination=", pn.num_pores())
h=op.utils.check_network_health(network=pn)
print(h) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Kindly consider this a gentle reminder. Thanks |
Beta Was this translation helpful? Give feedback.
-
The Ps = pn.pores('to_trim')
op.topotools.trim(network=pn, pores=Ps) Your network will now have the desired coordination number. Note that the |
Beta Was this translation helpful? Give feedback.
The
reduce_coordination
function creates a new label on the network (I think it's'pore.to_trim'
). You then do:Your network will now have the desired coordination number.
Note that the
reduce_coordination
function is a bit of a hack...it computes a minimum spanning tree using random weights, then randomly selects throats that are not part of the spanning tree for deletion. This will give you the correct mean coordination, but has not control at all over the distribution of the coordination. The point of using the spanning tree is that the network will remain connected after the deletion.