-
Dear all, I am a newbie trying to run openpnm. I am facing problem on running a function on directed network when I want to assign viscosity value to a variable, however, I am facing an error on running it on the directed network. any function or tools I can convert directed network to undirected network in order to do it? import numpy as np
import openpnm as op
op.visualization.set_mpl_style()
from openpnm.io import network_from_csv
print(op.__version__)
pn= network_from_csv('syntheticnetworkv2.csv')
print(pn)
ax = op.visualization.plot_coordinates(pn)
ax = op.visualization.plot_connections(pn, ax=ax)
water = op.phase.Water(network=pn, name="water")
print(water)
print(water['pore.viscosity'])
R = pn['throat.diameter']/2
L = pn['throat.length']
mu = water['throat.viscosity']
water['throat.hydraulic_conductance'] = np.pi*R**4/(8*mu*L)
print(water['throat.hydraulic_conductance']) The error showed me that File "/home/user/Desktop/graphynetwork/directed.py", line 27, in <module>
mu = water['throat.viscosity']
File "/home/user/anaconda3/lib/python3.8/site-packages/openpnm/phase/_phase.py", line 103, in __getitem__
vals = self.interpolate_data(element + '.' + prop)
File "/home/user/anaconda3/lib/python3.8/site-packages/openpnm/core/_base2.py", line 466, in interpolate_data
values = from_neighbor_pores(self, prop='pore.'+prop, mode=mode)
File "/home/user/anaconda3/lib/python3.8/site-packages/openpnm/models/misc/_neighbor_lookups.py", line 114, in from_neighbor_pores
P12 = network.find_connected_pores(throats)
File "/home/user/anaconda3/lib/python3.8/site-packages/openpnm/network/_network.py", line 435, in find_connected_pores
pores = topotools.find_connected_sites(bonds=Ts, network=self,
File "/home/user/anaconda3/lib/python3.8/site-packages/openpnm/topotools/_graphtools.py", line 37, in find_connected_sites
return queries.find_connected_nodes(inds=bonds, **kwargs)
File "/home/user/anaconda3/lib/python3.8/site-packages/openpnm/_skgraph/queries/_funcs.py", line 135, in find_connected_nodes
raise Exception("This function is not implemented for directed networks")
Exception: This function is not implemented for directed networks |
Beta Was this translation helpful? Give feedback.
Answered by
jgostick
Dec 21, 2022
Replies: 1 comment 1 reply
-
Hi @ChiWeiOng pn['throat.conns'] = np.sort(pn['throat.conns'], axis=1) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ChiWeiOng
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @ChiWeiOng
Sorry for the late response here. There is not specific function for this, but I agree that there should be! It's not hard to do though: