Skip to content

Commit

Permalink
Fixed up labelling
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Sep 29, 2016
1 parent eb7c75e commit b9aad5e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions OpenPNM/Network/__CubicDual__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,36 @@ def __init__(self, shape=None, spacing=[1, 1, 1], label_1='primary',
net['pore.'+label_1] = True
dual = Cubic(shape=shape-1, spacing=[1, 1, 1])
dual.add_boundaries()
# Add secondary network name as a label
dual['pore.'+label_2] = True
dual['throat.'+label_2] = True
# Shift coordinates prior to stitching
dual['pore.coords'] += 0.5
stitch(net, dual, P_network=net.Ps, P_donor=dual.Ps, len_max=1)
net['throat.interconnect'] = net['throat.stitched']
del net['throat.stitched']
net['pore.coords'] *= spacing

# Clean-up
# Clean-up labels
net['pore.surface'] = False
net['throat.surface'] = False
surface_labels = ['top', 'bottom', 'front', 'back', 'left', 'right']
for face in surface_labels:
Ps = net.pores(labels=[face, label_1], mode='intersection')
# Remove face label from secondary network since it's internal now
Ps = net.pores(labels=[face, label_2], mode='intersection')
net['pore.'+face][Ps] = False
Ps = net.pores(labels=[face+'_boundary'])
net['pore.surface'][Ps] = True
net['pore.'+face][Ps] = True

[net.pop(item) for item in list(net.keys()) if 'boundary' in item]
# Label all remaining 'face' pores as 'surface'
Ps = net.pores(labels=surface_labels)
net['pore.surface'][Ps] = True
Ts = net.find_neighbor_throats(pores=net.pores('surface'),
mode='intersection')
net['throat.surface'][Ts] = True
Ps = net.pores(face)
net['pore.surface'][Ps] = True
Ts = net.find_neighbor_throats(pores=Ps, mode='intersection')
net['throat.surface'][Ts] = True
net['throat.'+face] = net.tomask(throats=Ts)
[net.pop(item) for item in net.labels() if 'boundary' in item]
# Label non-surface pores and throats as internal
net['pore.internal'] = ~net['pore.surface']
Ts = net.find_neighbor_throats(pores=net['pore.internal'])
net['throat.internal'] = False
net['throat.internal'][Ts] = True
# Remove unused labels
del net['throat.stitched']
# Transfer all dictionary items from 'net' to 'self'
[self.update({item: net[item]}) for item in net]
del self.workspace[net.name]

0 comments on commit b9aad5e

Please sign in to comment.