GenericGeometry¶
- class openpnm.geometry.GenericGeometry(*args, **kwargs)[source]¶
This generic class is meant as a starter for custom Geometry objects
It has no pore-scale models assigned to it, so is a blank slate. Note that all OpenPNM Geometry sub-classes are just GenericGeometry instances with a assortment of models added.
- Parameters
pores (array_like) – The list of pores where this geometry applies.
throats (array_like) – The list of throats where this Geometry applies.
name (str) – A unique name to apply to the object. This name will also be used as a label to identify where this Geometry applies.
Examples
import openpnm as op import matplotlib.pyplot as plt pn = op.network.Cubic(shape=[5, 5, 5]) Ps = pn.pores('all') # Get all pores Ts = pn.throats('all') # Get all throats geom = op.geometry.GenericGeometry(network=pn, pores=Ps, throats=Ts) # Now assign pore-scale models to the empty object geom.add_model(propname='pore.size', model=op.models.misc.random, element='pore', num_range=[0.01, 0.1]) # Confirm that the object has one added model print(geom.models) # The results of the model can be seen using the ``show_hist`` function: geom.show_hist('pore.size') plt.show()
- Attributes
Np
A shortcut to query the total number of pores on the object
Nt
A shortcut to query the total number of throats on the object
Ps
A shortcut to get a list of all pores on the object
Ts
A shortcut to get a list of all throats on the object
models
List of available models on the objects
name
String representing the name of the object
network
A shortcut to get a handle to the associated network.
physics
A shortcut to get a handle to the associated physics.
project
A shortcut to get a handle to the associated project.
settings
Dictionary containing object settings.
Methods
add_model
(propname, model[, regen_mode])Adds a new model to the models dictionary.
filter_by_label
([pores, throats, labels, mode])Returns which of the supplied pores (or throats) has the specified label(s)
get_conduit_data
(poreprop[, throatprop, mode])Combines requested data into a single 3-column array.
interleave_data
(prop)Retrieves requested property from associated objects, to produce a full Np or Nt length array.
interpolate_data
(propname[, mode])Determines a pore (or throat) property as the average of it's neighboring throats (or pores)
labels
([pores, throats, element, mode])Returns a list of labels present on the object
num_pores
([labels, mode])Returns the number of pores of the specified labels
num_throats
([labels, mode])Return the number of throats of the specified labels
params
()Return parameter names and values in a dictionary
pores
([labels, mode, asmask, to_global])Returns pore indicies where given labels exist, according to the logic specified by the
mode
argument.props
([element, mode, deep])Returns a list containing the names of all defined pore or throat properties.
regenerate_models
([propnames, exclude, deep])Re-runs the specified model or models.
remove_model
([propname, mode])Removes model and data from object.
set_label
(label[, pores, throats, mode])Creates or updates a label array
set_locations
([pores, throats, mode])Assign a Subdomain object to specific pores and/or throats
show_hist
([props, bins, fontsize])Shows a quick plot of key property distributions.
throats
([labels, mode, asmask, to_global])Returns throat locations where given labels exist, according to the logic specified by the
mode
argument.to_global
([pores, throats])Convert local indices from a subdomain object to global values
to_indices
(mask)Converts a boolean mask to a list of pore or throat indices.
to_local
([pores, throats, missing_vals])Convert global indices to local values relative to a subdomain object
to_mask
([pores, throats])Convert a list of pore or throat indices into a boolean mask of the correct length.