Replies: 4 comments
-
The error |
Beta Was this translation helpful? Give feedback.
-
I have defined the model as: But I get the following error:AttributeError Traceback (most recent call last) File /opt/conda/lib/python3.9/site-packages/openpnm/models/geometry/hydraulic_size_factors/_funcs.py:62, in spheres_and_cylinders(network, pore_diameter, throat_diameter) AttributeError: 'numpy.ndarray' object has no attribute 'split' |
Beta Was this translation helpful? Give feedback.
-
You've "run" the model instead of passing in only a handle to the model. The difference is: This: pn.add_model(propname='throat.hydraulic_size_factor',
model=op.models.geometry.hydaulic_size_factors.spheres_and_cylinders) Vs: water.add_model(propname='throat.hydraulic_size_factors',
model=op.models.geometry.hydraulic_size_factors.spheres_and_cylinders(
network=pn,
pore_diameter=pn.Ps,
throat_diameter=pn.Ts)) You're also adding to the water object instead of the network object. I'm sorry that OpenPNM is a bit complex to use sometimes, but please pay a bit more attention to each line before giving up. |
Beta Was this translation helpful? Give feedback.
-
Hi Prof Gostick I am also getting the KeyError: 'throat.hydraulic_size_factors' Apologies for opening this up again but I am trying to follow exactly as you suggest here, but still get a "diameter not found" key error with this code: |
Beta Was this translation helpful? Give feedback.
-
We have a porous data with fibers and binders of size 500x500x500 and would like to do REV analysis and find out the permeability. So how can this be done?
I am using this code as a reference : https://github.com/mbandreeta/absolute_permeability_simulations/blob/main/permeability_PoreSpy_OpenPNM.ipynb
When I try to create network and add the model. I get an error as follows:
KeyError Traceback (most recent call last)
File /opt/conda/lib/python3.9/site-packages/openpnm/core/_base2.py:173, in Base2.getitem(self, key)
172 try:
--> 173 return super().getitem(key)
174 except KeyError:
175 # If key is object's name or all, return ones
KeyError: 'throat.hydraulic_size_factors'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
Input In [64], in
15 water = op.phase.Water(network=pn)
17 #conductance -- ????
---> 18 water.add_model(propname='throat.hydraulic_conductance', model=op.models.physics.hydraulic_conductance.hagen_poiseuille)
20 #Stokes
21 perm = op.algorithms.StokesFlow(network=pn, phase=water)
File /opt/conda/lib/python3.9/site-packages/openpnm/core/_models.py:404, in ModelsMixin2.add_model(self, propname, model, domain, regen_mode, **kwargs)
402 self.models[propname+'@'+domain] = ModelWrapper(**kwargs)
403 if regen_mode != 'deferred':
--> 404 self.run_model(propname+'@'+domain)
File /opt/conda/lib/python3.9/site-packages/openpnm/core/_models.py:502, in ModelsMixin2.run_model(self, propname, domain)
500 if '@' in propname: # Get domain from propname if present
501 propname, _, domain = propname.partition('@')
--> 502 self.run_model(propname=propname, domain=domain)
503 else: # No domain means run model for ALL domains
504 for item in self.models.keys():
File /opt/conda/lib/python3.9/site-packages/openpnm/core/_models.py:521, in ModelsMixin2.run_model(self, propname, domain)
519 if 'domain' not in inspect.getfullargspec(mod_dict['model']).args:
520 _ = kwargs.pop('domain', None)
--> 521 vals = mod_dict['model'](self, **kwargs)
522 if isinstance(vals, dict): # Handle models that return a dict
523 for k, v in vals.items():
File /opt/conda/lib/python3.9/site-packages/openpnm/models/physics/hydraulic_conductance/_funcs.py:81, in hagen_poiseuille(phase, pore_viscosity, throat_viscosity, size_factors)
56 @_doctxt
57 def hagen_poiseuille(
58 phase,
(...)
61 size_factors="throat.hydraulic_size_factors"
62 ):
63 r"""
64 Calculates the hydraulic conductance of conduits in network.
65
(...)
79
80 """
---> 81 return generic_hydraulic(phase=phase,
82 pore_viscosity=pore_viscosity,
83 throat_viscosity=throat_viscosity,
84 size_factors=size_factors)
File /opt/conda/lib/python3.9/site-packages/openpnm/models/physics/hydraulic_conductance/_funcs.py:42, in generic_hydraulic(phase, pore_viscosity, throat_viscosity, size_factors)
39 mu1, mu2 = phase[pore_viscosity][conns].T
40 mut = phase[throat_viscosity]
---> 42 SF = network[size_factors]
43 if isinstance(SF, dict): # Legacy approach
44 F1, Ft, F2 = SF.values()
File /opt/conda/lib/python3.9/site-packages/openpnm/core/_base2.py:188, in Base2.getitem(self, key)
186 return vals
187 else:
--> 188 raise KeyError(key)
KeyError: 'throat.hydraulic_size_factors'
How can this be reolved?
Beta Was this translation helpful? Give feedback.
All reactions