_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q20700 | cylinder | train | def cylinder(target, throat_diameter='throat.diameter'):
r"""
Calculate throat cross-sectional area for a cylindrical throat
Parameters
----------
target : OpenPNM Object
The object which this model is associated with. This controls the
length of the calculated array, and also provi... | python | {
"resource": ""
} |
q20701 | DelaunayGeometry._t_normals | train | def _t_normals(self):
r"""
Update the throat normals from the voronoi vertices
"""
verts = self['throat.vertices']
value = sp.zeros([len(verts), 3])
for i in range(len(verts)):
if len(sp.unique(verts[i][:, 0])) == 1:
verts_2d = sp.vstack((verts... | python | {
"resource": ""
} |
q20702 | DelaunayGeometry._centroids | train | def _centroids(self, verts):
r'''
Function to calculate the centroid as the mean of a set of vertices.
Used for pore and throat.
'''
value = sp.zeros([len(verts), 3])
for i, i_verts in enumerate(verts):
value[i] = np.mean(i_verts, axis=0)
return value | python | {
"resource": ""
} |
q20703 | DelaunayGeometry._indiameter_from_fibers | train | def _indiameter_from_fibers(self):
r"""
Calculate an indiameter by distance transforming sections of the
fiber image. By definition the maximum value will be the largest radius
of an inscribed sphere inside the fibrous hull
"""
Np = self.num_pores()
indiam = np.ze... | python | {
"resource": ""
} |
q20704 | DelaunayGeometry._throat_c2c | train | def _throat_c2c(self):
r"""
Calculate the center to center distance from centroid of pore1 to
centroid of throat to centroid of pore2.
"""
net = self.network
Nt = net.num_throats()
p_cen = net['pore.centroid']
t_cen = net['throat.centroid']
conns =... | python | {
"resource": ""
} |
q20705 | DelaunayGeometry.in_hull_volume | train | def in_hull_volume(self):
r"""
Work out the voxels inside the convex hull of the voronoi vertices of
each pore
"""
i = self.network['pore.internal']
s = self.network['pore.surface']
d = self.network['pore.delaunay']
Ps = self.network.pores()[np.logical_and... | python | {
"resource": ""
} |
q20706 | DelaunayGeometry._process_pore_voxels | train | def _process_pore_voxels(self):
r'''
Function to count the number of voxels in the pore and fiber space
Which are assigned to each hull volume
'''
num_Ps = self.num_pores()
pore_vox = sp.zeros(num_Ps, dtype=int)
fiber_vox = sp.zeros(num_Ps, dtype=int)
pore... | python | {
"resource": ""
} |
q20707 | DelaunayGeometry._bresenham | train | def _bresenham(self, faces, dx):
r'''
A Bresenham line function to generate points to fill in for the fibers
'''
line_points = []
for face in faces:
# Get in hull order
fx = face[:, 0]
fy = face[:, 1]
fz = face[:, 2]
# F... | python | {
"resource": ""
} |
q20708 | DelaunayGeometry._get_fiber_slice | train | def _get_fiber_slice(self, plane=None, index=None):
r"""
Plot an image of a slice through the fiber image
plane contains percentage values of the length of the image in each
axis
Parameters
----------
plane : array_like
List of 3 values, [x,y,z], 2 must b... | python | {
"resource": ""
} |
q20709 | DelaunayGeometry.plot_fiber_slice | train | def plot_fiber_slice(self, plane=None, index=None, fig=None):
r"""
Plot one slice from the fiber image
Parameters
----------
plane : array_like
List of 3 values, [x,y,z], 2 must be zero and the other must be between
zero and one representing the fraction of the d... | python | {
"resource": ""
} |
q20710 | DelaunayGeometry.plot_porosity_profile | train | def plot_porosity_profile(self, fig=None):
r"""
Return a porosity profile in all orthogonal directions by summing
the voxel volumes in consectutive slices.
"""
if hasattr(self, '_fiber_image') is False:
logger.warning('This method only works when a fiber image exists'... | python | {
"resource": ""
} |
q20711 | VoronoiGeometry._throat_props | train | def _throat_props(self):
r'''
Helper Function to calculate the throat normal vectors
'''
network = self.network
net_Ts = network.throats(self.name)
conns = network['throat.conns'][net_Ts]
p1 = conns[:, 0]
p2 = conns[:, 1]
coords = network['pore.coo... | python | {
"resource": ""
} |
q20712 | pore_to_pore | train | def pore_to_pore(target):
r"""
Calculates throat vector as straight path between connected pores.
Parameters
----------
geometry : OpenPNM Geometry object
The object containing the geometrical properties of the throats
Notes
-----
There is an important impicit assumption here: ... | python | {
"resource": ""
} |
q20713 | GenericTransport.setup | train | def setup(self, phase=None, quantity='', conductance='', **kwargs):
r"""
This method takes several arguments that are essential to running the
algorithm and adds them to the settings.
Parameters
----------
phase : OpenPNM Phase object
The phase on which the a... | python | {
"resource": ""
} |
q20714 | GenericTransport.set_value_BC | train | def set_value_BC(self, pores, values):
r"""
Apply constant value boundary conditons to the specified pore
locations. These are sometimes referred to as Dirichlet conditions.
Parameters
----------
pores : array_like
The pore indices where the condition should ... | python | {
"resource": ""
} |
q20715 | GenericTransport.set_rate_BC | train | def set_rate_BC(self, pores, values):
r"""
Apply constant rate boundary conditons to the specified pore
locations. This is similar to a Neumann boundary condition, but is
slightly different since it's the conductance multiplied by the
gradient, while Neumann conditions specify ju... | python | {
"resource": ""
} |
q20716 | GenericTransport._set_BC | train | def _set_BC(self, pores, bctype, bcvalues=None, mode='merge'):
r"""
Apply boundary conditions to specified pores
Parameters
----------
pores : array_like
The pores where the boundary conditions should be applied
bctype : string
Specifies the type... | python | {
"resource": ""
} |
q20717 | GenericTransport.remove_BC | train | def remove_BC(self, pores=None):
r"""
Removes all boundary conditions from the specified pores
Parameters
----------
pores : array_like
The pores from which boundary conditions are to be removed. If no
pores are specified, then BCs are removed from all p... | python | {
"resource": ""
} |
q20718 | GenericTransport._build_b | train | def _build_b(self, force=False):
r"""
Builds the RHS matrix, without applying any boundary conditions or
source terms. This method is trivial an basically creates a column
vector of 0's.
Parameters
----------
force : Boolean (default is ``False``)
If ... | python | {
"resource": ""
} |
q20719 | GenericTransport.results | train | def results(self, times='all', t_precision=12, **kwargs):
r"""
Fetches the calculated quantity from the algorithm and returns it as
an array.
Parameters
----------
times : scalar or list
Time steps to be returned. The default value is 'all' which results
... | python | {
"resource": ""
} |
q20720 | GenericTransport.rate | train | def rate(self, pores=[], throats=[], mode='group'):
r"""
Calculates the net rate of material moving into a given set of pores or
throats
Parameters
----------
pores : array_like
The pores for which the rate should be calculated
throats : array_like
... | python | {
"resource": ""
} |
q20721 | GenericTransport._calc_eff_prop | train | def _calc_eff_prop(self, inlets=None, outlets=None,
domain_area=None, domain_length=None):
r"""
Calculate the effective transport through the network
Parameters
----------
inlets : array_like
The pores where the inlet boundary conditions were a... | python | {
"resource": ""
} |
q20722 | Base.get | train | def get(self, keys, default=None):
r"""
This subclassed method can be used to obtain a dictionary containing
subset of data on the object
Parameters
----------
keys : string or list of strings
The item or items to retrieve.
default : any object
... | python | {
"resource": ""
} |
q20723 | Base.props | train | def props(self, element=None, mode='all', deep=False):
r"""
Returns a list containing the names of all defined pore or throat
properties.
Parameters
----------
element : string, optional
Can be either 'pore' or 'throat' to specify what properties are
... | python | {
"resource": ""
} |
q20724 | Base._get_labels | train | def _get_labels(self, element, locations, mode):
r"""
This is the actual label getter method, but it should not be called
directly. Use ``labels`` instead.
"""
# Parse inputs
locations = self._parse_indices(locations)
element = self._parse_element(element=element... | python | {
"resource": ""
} |
q20725 | Base.labels | train | def labels(self, pores=[], throats=[], element=None, mode='union'):
r"""
Returns a list of labels present on the object
Additionally, this function can return labels applied to a specified
set of pores or throats
Parameters
----------
element : string
... | python | {
"resource": ""
} |
q20726 | Base._get_indices | train | def _get_indices(self, element, labels='all', mode='or'):
r"""
This is the actual method for getting indices, but should not be called
directly. Use ``pores`` or ``throats`` instead.
"""
# Parse and validate all input values.
element = self._parse_element(element, single... | python | {
"resource": ""
} |
q20727 | Base.pores | train | def pores(self, labels='all', mode='or', asmask=False):
r"""
Returns pore indicies where given labels exist, according to the logic
specified by the ``mode`` argument.
Parameters
----------
labels : string or list of strings
The label(s) whose pores locations... | python | {
"resource": ""
} |
q20728 | Base.map_pores | train | def map_pores(self, pores, origin, filtered=True):
r"""
Given a list of pore on a target object, finds indices of those pores
on the calling object
Parameters
----------
pores : array_like
The indices of the pores on the object specifiedin ``origin``
... | python | {
"resource": ""
} |
q20729 | Base.map_throats | train | def map_throats(self, throats, origin, filtered=True):
r"""
Given a list of throats on a target object, finds indices of
those throats on the calling object
Parameters
----------
throats : array_like
The indices of the throats on the object specified in ``ori... | python | {
"resource": ""
} |
q20730 | Base._tomask | train | def _tomask(self, indices, element):
r"""
This is a generalized version of tomask that accepts a string of
'pore' or 'throat' for programmatic access.
"""
element = self._parse_element(element, single=True)
indices = self._parse_indices(indices)
N = sp.shape(self[... | python | {
"resource": ""
} |
q20731 | Base.tomask | train | def tomask(self, pores=None, throats=None):
r"""
Convert a list of pore or throat indices into a boolean mask of the
correct length
Parameters
----------
pores or throats : array_like
List of pore or throat indices. Only one of these can be specified
... | python | {
"resource": ""
} |
q20732 | Base.toindices | train | def toindices(self, mask):
r"""
Convert a boolean mask to a list of pore or throat indices
Parameters
----------
mask : array_like booleans
A boolean array with True at locations where indices are desired.
The appropriate indices are returned based an the... | python | {
"resource": ""
} |
q20733 | Base.interleave_data | train | def interleave_data(self, prop):
r"""
Retrieves requested property from associated objects, to produce a full
Np or Nt length array.
Parameters
----------
prop : string
The property name to be retrieved
Returns
-------
A full length (... | python | {
"resource": ""
} |
q20734 | Base.num_pores | train | def num_pores(self, labels='all', mode='or'):
r"""
Returns the number of pores of the specified labels
Parameters
----------
labels : list of strings, optional
The pore labels that should be included in the count.
If not supplied, all pores are counted.
... | python | {
"resource": ""
} |
q20735 | Base.num_throats | train | def num_throats(self, labels='all', mode='union'):
r"""
Return the number of throats of the specified labels
Parameters
----------
labels : list of strings, optional
The throat labels that should be included in the count.
If not supplied, all throats are ... | python | {
"resource": ""
} |
q20736 | Base._count | train | def _count(self, element=None):
r"""
Returns a dictionary containing the number of pores and throats in
the network, stored under the keys 'pore' or 'throat'
Parameters
----------
element : string, optional
Can be either 'pore' , 'pores', 'throat' or 'throats... | python | {
"resource": ""
} |
q20737 | Base.show_hist | train | def show_hist(self, props=[], bins=20, **kwargs):
r"""
Show a quick plot of key property distributions.
Parameters
----------
props : string or list of strings
The pore and/or throat properties to be plotted as histograms
bins : int or array_like
... | python | {
"resource": ""
} |
q20738 | Base.check_data_health | train | def check_data_health(self, props=[], element=None):
r"""
Check the health of pore and throat data arrays.
Parameters
----------
element : string, optional
Can be either 'pore' or 'throat', which will limit the checks to
only those data arrays.
p... | python | {
"resource": ""
} |
q20739 | Base._parse_indices | train | def _parse_indices(self, indices):
r"""
This private method accepts a list of pores or throats and returns a
properly structured Numpy array of indices.
Parameters
----------
indices : multiple options
This argument can accept numerous different data types in... | python | {
"resource": ""
} |
q20740 | Base._parse_element | train | def _parse_element(self, element, single=False):
r"""
This private method is used to parse the keyword \'element\' in many
of the above methods.
Parameters
----------
element : string or list of strings
The element argument to check. If is None is recieved, ... | python | {
"resource": ""
} |
q20741 | Base._parse_mode | train | def _parse_mode(self, mode, allowed=None, single=False):
r"""
This private method is for checking the \'mode\' used in the calling
method.
Parameters
----------
mode : string or list of strings
The mode(s) to be parsed
allowed : list of strings
... | python | {
"resource": ""
} |
q20742 | sphere | train | def sphere(target, pore_diameter='pore.diameter', throat_area='throat.area'):
r"""
Calculates internal surface area of pore bodies assuming they are spherical
then subtracts the area of the neighboring throats in a crude way, by
simply considering the throat cross-sectional area, thus not accounting
... | python | {
"resource": ""
} |
q20743 | cube | train | def cube(target, pore_diameter='pore.diameter', throat_area='throat.area'):
r"""
Calculates internal surface area of pore bodies assuming they are cubes
then subtracts the area of the neighboring throats.
Parameters
----------
target : OpenPNM Object
The object for which these values ar... | python | {
"resource": ""
} |
q20744 | MixedInvasionPercolation.set_outlets | train | def set_outlets(self, pores=[], overwrite=False):
r"""
Set the locations through which defender exits the network.
This is only necessary if 'trapping' was set to True when ``setup``
was called.
Parameters
----------
pores : array_like
Locations where... | python | {
"resource": ""
} |
q20745 | MixedInvasionPercolation._add_ts2q | train | def _add_ts2q(self, pore, queue):
"""
Helper method to add throats to the cluster queue
"""
net = self.project.network
elem_type = 'throat'
# Find throats connected to newly invaded pore
Ts = net.find_neighbor_throats(pores=pore)
# Remove already invaded t... | python | {
"resource": ""
} |
q20746 | MixedInvasionPercolation._add_ps2q | train | def _add_ps2q(self, throat, queue):
"""
Helper method to add pores to the cluster queue
"""
net = self.project.network
elem_type = 'pore'
# Find pores connected to newly invaded throat
Ps = net['throat.conns'][throat]
# Remove already invaded pores from Ps... | python | {
"resource": ""
} |
q20747 | MixedInvasionPercolation._merge_cluster | train | def _merge_cluster(self, c2keep, c2empty):
r"""
Little helper function to merger clusters but only add the uninvaded
elements
"""
while len(self.queue[c2empty]) > 0:
temp = [_pc, _id, _type] = hq.heappop(self.queue[c2empty])
if self[_type+'.invasion_sequen... | python | {
"resource": ""
} |
q20748 | MixedInvasionPercolation.results | train | def results(self, Pc):
r"""
Places the results of the IP simulation into the Phase object.
Parameters
----------
Pc : float
Capillary Pressure at which phase configuration was reached
"""
phase = self.project.find_phase(self)
net = self.proj... | python | {
"resource": ""
} |
q20749 | MixedInvasionPercolation.apply_flow | train | def apply_flow(self, flowrate):
r"""
Convert the invaded sequence into an invaded time for a given flow rate
considering the volume of invaded pores and throats.
Parameters
----------
flowrate : float
The flow rate of the injected fluid
Returns
... | python | {
"resource": ""
} |
q20750 | MixedInvasionPercolation._apply_snap_off | train | def _apply_snap_off(self, queue=None):
r"""
Add all the throats to the queue with snap off pressure
This is probably wrong!!!! Each one needs to start a new cluster.
"""
net = self.project.network
phase = self.project.find_phase(self)
snap_off = self.settings['sna... | python | {
"resource": ""
} |
q20751 | MixedInvasionPercolation.set_residual | train | def set_residual(self, pores=[], overwrite=False):
r"""
Method to start invasion in a network w. residual saturation.
Called after inlets are set.
Parameters
----------
pores : array_like
The pores locations that are to be filled with invader at the
... | python | {
"resource": ""
} |
q20752 | MixedInvasionPercolation._invade_isolated_Ts | train | def _invade_isolated_Ts(self):
r"""
Throats that are uninvaded connected to pores that are both invaded
should be invaded too.
"""
net = self.project.network
Ts = net['throat.conns'].copy()
invaded_Ps = self['pore.invasion_sequence'] > -1
uninvaded_Ts = se... | python | {
"resource": ""
} |
q20753 | MixedInvasionPercolation.trilaterate_v | train | def trilaterate_v(self, P1, P2, P3, r1, r2, r3):
r'''
Find whether 3 spheres intersect
'''
temp1 = P2-P1
e_x = temp1/np.linalg.norm(temp1, axis=1)[:, np.newaxis]
temp2 = P3-P1
i = self._my_dot(e_x, temp2)[:, np.newaxis]
temp3 = temp2 - i*e_x
e_y = ... | python | {
"resource": ""
} |
q20754 | MixedInvasionPercolation._get_throat_pairs | train | def _get_throat_pairs(self):
r'''
Generate an array of pores with all connected throats and pairs of
throats that connect to the same pore
'''
network = self.project.network
# Collect all throat pairs sharing a pore as list of lists
neighbor_Ts = network.find_neig... | python | {
"resource": ""
} |
q20755 | MixedInvasionPercolation._apply_cen_to_throats | train | def _apply_cen_to_throats(self, p_cen, t_cen, t_norm, men_cen):
r'''
Take the pore center and throat center and work out which way
the throat normal is pointing relative to the vector between centers.
Offset the meniscus center along the throat vector in the correct
direction
... | python | {
"resource": ""
} |
q20756 | MixedInvasionPercolation._check_coop | train | def _check_coop(self, pore, queue):
r"""
Method run in loop after every pore invasion. All connecting throats
are now given access to the invading phase. Two throats with access to
the invading phase can cooperatively fill any pores that they are both
connected to, common pores.
... | python | {
"resource": ""
} |
q20757 | cylinder | train | def cylinder(target, throat_diameter='throat.diameter',
throat_length='throat.length'):
r"""
Calculate surface area for a cylindrical throat
Parameters
----------
target : OpenPNM Object
The object which this model is associated with. This controls the
length of the cal... | python | {
"resource": ""
} |
q20758 | cuboid | train | def cuboid(target, throat_diameter='throat.diameter',
throat_length='throat.length'):
r"""
Calculate surface area for a cuboid throat
Parameters
----------
target : OpenPNM Object
The object which this model is associated with. This controls the
length of the calculated a... | python | {
"resource": ""
} |
q20759 | extrusion | train | def extrusion(target, throat_perimeter='throat.perimeter',
throat_length='throat.length'):
r"""
Calculate surface area for an arbitrary shaped throat give the perimeter
and length.
Parameters
----------
target : OpenPNM Object
The object which this model is associated with... | python | {
"resource": ""
} |
q20760 | cubic_pores | train | def cubic_pores(target, pore_diameter='pore.diameter'):
r"""
Calculate coordinates of throat endpoints, assuming throats don't overlap
with their adjacent pores. This model could be applied to conduits such as
cuboids or cylinders in series.
Parameters
----------
target : OpenPNM Object
... | python | {
"resource": ""
} |
q20761 | spherical_pores | train | def spherical_pores(target, pore_diameter='pore.diameter',
throat_diameter='throat.diameter',
throat_centroid='throat.centroid'):
r"""
Calculate the coordinates of throat endpoints, assuming spherical pores.
This model accounts for the overlapping lens between pores a... | python | {
"resource": ""
} |
q20762 | circular_pores | train | def circular_pores(target, pore_diameter='pore.diameter',
throat_diameter='throat.diameter',
throat_centroid='throat.centroid'):
r"""
Calculate the coordinates of throat endpoints, assuming circular pores.
This model accounts for the overlapping lens between pores and t... | python | {
"resource": ""
} |
q20763 | straight_throat | train | def straight_throat(target, throat_centroid='throat.centroid',
throat_vector='throat.vector',
throat_length='throat.length'):
r"""
Calculate the coordinates of throat endpoints given a central coordinate,
unit vector along the throat direction and a length.
Param... | python | {
"resource": ""
} |
q20764 | Cubic.add_boundary_pores | train | def add_boundary_pores(self, labels=['top', 'bottom', 'front', 'back',
'left', 'right'], spacing=None):
r"""
Add pores to the faces of the network for use as boundary pores.
Pores are offset from the faces by 1/2 a lattice spacing such that
they ... | python | {
"resource": ""
} |
q20765 | Cubic.to_array | train | def to_array(self, values):
r"""
Converts the values to a rectangular array with the same shape as the
network
Parameters
----------
values : array_like
An Np-long array of values to convert to
Notes
-----
This method can break on net... | python | {
"resource": ""
} |
q20766 | Cubic.from_array | train | def from_array(self, array, propname):
r"""
Apply data to the network based on a rectangular array filled with
values. Each array location corresponds to a pore in the network.
Parameters
----------
array : array_like
The rectangular array containing the val... | python | {
"resource": ""
} |
q20767 | GenericNetwork.get_adjacency_matrix | train | def get_adjacency_matrix(self, fmt='coo'):
r"""
Returns an adjacency matrix in the specified sparse format, with 1's
indicating the non-zero values.
Parameters
----------
fmt : string, optional
The sparse storage format to return. Options are:
*... | python | {
"resource": ""
} |
q20768 | GenericNetwork.get_incidence_matrix | train | def get_incidence_matrix(self, fmt='coo'):
r"""
Returns an incidence matrix in the specified sparse format, with 1's
indicating the non-zero values.
Parameters
----------
fmt : string, optional
The sparse storage format to return. Options are:
*... | python | {
"resource": ""
} |
q20769 | GenericNetwork.create_adjacency_matrix | train | def create_adjacency_matrix(self, weights=None, fmt='coo', triu=False,
drop_zeros=False):
r"""
Generates a weighted adjacency matrix in the desired sparse format
Parameters
----------
weights : array_like, optional
An array containing ... | python | {
"resource": ""
} |
q20770 | GenericNetwork.create_incidence_matrix | train | def create_incidence_matrix(self, weights=None, fmt='coo',
drop_zeros=False):
r"""
Creates a weighted incidence matrix in the desired sparse format
Parameters
----------
weights : array_like, optional
An array containing the throat val... | python | {
"resource": ""
} |
q20771 | GenericNetwork.find_connected_pores | train | def find_connected_pores(self, throats=[], flatten=False, mode='union'):
r"""
Return a list of pores connected to the given list of throats
Parameters
----------
throats : array_like
List of throats numbers
flatten : boolean, optional
If ``True``... | python | {
"resource": ""
} |
q20772 | GenericNetwork.find_connecting_throat | train | def find_connecting_throat(self, P1, P2):
r"""
Return the throat index connecting pairs of pores
Parameters
----------
P1 , P2 : array_like
The indices of the pores whose throats are sought. These can be
vectors of indices, but must be the same length
... | python | {
"resource": ""
} |
q20773 | GenericNetwork.num_neighbors | train | def num_neighbors(self, pores, mode='or', flatten=False):
r"""
Returns the number of neigbhoring pores for each given input pore
Parameters
----------
pores : array_like
Pores whose neighbors are to be counted
flatten : boolean (optional)
If ``Fa... | python | {
"resource": ""
} |
q20774 | fuller | train | def fuller(target, MA, MB, vA, vB, temperature='pore.temperature',
pressure='pore.pressure'):
r"""
Uses Fuller model to estimate diffusion coefficient for gases from first
principles at conditions of interest
Parameters
----------
target : OpenPNM Object
The object for which ... | python | {
"resource": ""
} |
q20775 | fuller_scaling | train | def fuller_scaling(target, DABo, To, Po, temperature='pore.temperature',
pressure='pore.pressure'):
r"""
Uses Fuller model to adjust a diffusion coefficient for gases from
reference conditions to conditions of interest
Parameters
----------
target : OpenPNM Object
The... | python | {
"resource": ""
} |
q20776 | tyn_calus | train | def tyn_calus(target, VA, VB, sigma_A, sigma_B, temperature='pore.temperature',
viscosity='pore.viscosity'):
r"""
Uses Tyn_Calus model to estimate diffusion coefficient in a dilute liquid
solution of A in B from first principles at conditions of interest
Parameters
----------
targ... | python | {
"resource": ""
} |
q20777 | tyn_calus_scaling | train | def tyn_calus_scaling(target, DABo, To, mu_o, viscosity='pore.viscosity',
temperature='pore.temperature'):
r"""
Uses Tyn_Calus model to adjust a diffusion coeffciient for liquids from
reference conditions to conditions of interest
Parameters
----------
target : OpenPNM Obj... | python | {
"resource": ""
} |
q20778 | brock_bird_scaling | train | def brock_bird_scaling(target, sigma_o, To, temperature='pore.temperature',
critical_temperature='pore.critical_temperature'):
r"""
Uses Brock_Bird model to adjust surface tension from it's value at a given
reference temperature to temperature of interest
Parameters
---------... | python | {
"resource": ""
} |
q20779 | water | train | def water(target, temperature='pore.temperature', salinity='pore.salinity'):
r"""
Calculates thermal conductivity of pure water or seawater at atmospheric
pressure using the correlation given by Jamieson and Tudhope. Values at
temperature higher the normal boiling temperature are calculated at the
... | python | {
"resource": ""
} |
q20780 | sato | train | def sato(target, mol_weight='pore.molecular_weight',
boiling_temperature='pore.boiling_point',
temperature='pore.temperature',
critical_temperature='pore.critical_temperature'):
r"""
Uses Sato et al. model to estimate thermal conductivity for pure liquids
from first principles at ... | python | {
"resource": ""
} |
q20781 | largest_sphere | train | def largest_sphere(target, fixed_diameter='pore.fixed_diameter', iters=5):
r"""
Finds the maximum diameter pore that can be placed in each location without
overlapping any neighbors.
This method iteratively expands pores by increasing their diameter to
encompass half of the distance to the nearest ... | python | {
"resource": ""
} |
q20782 | equivalent_diameter | train | def equivalent_diameter(target, pore_volume='pore.volume',
pore_shape='sphere'):
r"""
Calculates the diameter of a sphere or edge-length of a cube with same
volume as the pore.
Parameters
----------
target : OpenPNM Geometry Object
The Geometry object which this ... | python | {
"resource": ""
} |
q20783 | VTK.save | train | def save(cls, network, phases=[], filename='', delim=' | ', fill_nans=None):
r"""
Save network and phase data to a single vtp file for visualizing in
Paraview
Parameters
----------
network : OpenPNM Network Object
The Network containing the data to be written... | python | {
"resource": ""
} |
q20784 | VTK.load | train | def load(cls, filename, project=None, delim=' | '):
r"""
Read in pore and throat data from a saved VTK file.
Parameters
----------
filename : string (optional)
The name of the file containing the data to import. The formatting
of this file is outlined be... | python | {
"resource": ""
} |
q20785 | standard | train | def standard(target, mol_weight='pore.molecular_weight',
density='pore.density'):
r"""
Calculates the molar density from the molecular weight and mass density
Parameters
----------
target : OpenPNM Object
The object for which these values are being calculated. This
con... | python | {
"resource": ""
} |
q20786 | ideal_gas | train | def ideal_gas(target, pressure='pore.pressure',
temperature='pore.temperature'):
r"""
Uses ideal gas law to calculate the molar density of an ideal gas
Parameters
----------
target : OpenPNM Object
The object for which these values are being calculated. This
controls ... | python | {
"resource": ""
} |
q20787 | vanderwaals | train | def vanderwaals(target, pressure='pore.pressure',
temperature='pore.temperature',
critical_pressure='pore.critical_pressure',
critical_temperature='pore.critical_temperature'):
r"""
Uses Van der Waals equation of state to calculate the density of a real gas
P... | python | {
"resource": ""
} |
q20788 | DelaunayVoronoiDual.find_throat_facets | train | def find_throat_facets(self, throats=None):
r"""
Finds the indicies of the Voronoi nodes that define the facet or
ridge between the Delaunay nodes connected by the given throat.
Parameters
----------
throats : array_like
The throats whose facets are sought. ... | python | {
"resource": ""
} |
q20789 | DelaunayVoronoiDual.find_pore_hulls | train | def find_pore_hulls(self, pores=None):
r"""
Finds the indices of the Voronoi nodes that define the convex hull
around the given Delaunay nodes.
Parameters
----------
pores : array_like
The pores whose convex hull are sought. The given pores should be
... | python | {
"resource": ""
} |
q20790 | DelaunayVoronoiDual._label_faces | train | def _label_faces(self):
r'''
Label the pores sitting on the faces of the domain in accordance with
the conventions used for cubic etc.
'''
coords = sp.around(self['pore.coords'], decimals=10)
min_labels = ['front', 'left', 'bottom']
max_labels = ['back', 'right', ... | python | {
"resource": ""
} |
q20791 | DelaunayVoronoiDual.add_boundary_pores | train | def add_boundary_pores(self, labels=['top', 'bottom', 'front', 'back',
'left', 'right'], offset=None):
r"""
Add boundary pores to the specified faces of the network
Pores are offset from the faces of the domain.
Parameters
----------
... | python | {
"resource": ""
} |
q20792 | MAT.save | train | def save(cls, network, phases=[], filename=''):
r"""
Write Network to a Mat file for exporting to Matlab.
Parameters
----------
network : OpenPNM Network Object
filename : string
Desired file name, defaults to network name if not given
phases : list... | python | {
"resource": ""
} |
q20793 | Workspace._create_console_handles | train | def _create_console_handles(self, project):
r"""
Adds all objects in the given project to the console as variables
with handle names taken from each object's name.
"""
import __main__
for item in project:
__main__.__dict__[item.name] = item | python | {
"resource": ""
} |
q20794 | Workspace.save_workspace | train | def save_workspace(self, filename=''):
r"""
Saves all the current Projects to a 'pnm' file
Parameters
----------
filename : string, optional
If no filename is given, a name is genrated using the current
time and date. See Notes for more information on val... | python | {
"resource": ""
} |
q20795 | Workspace.save_project | train | def save_project(self, project, filename=''):
r"""
Saves given Project to a 'pnm' file
This will include all of associated objects, including algorithms.
Parameters
----------
project : OpenPNM Project
The project to save.
filename : string, optiona... | python | {
"resource": ""
} |
q20796 | Workspace.load_project | train | def load_project(self, filename, overwrite=False):
r"""
Loads a Project from the specified 'pnm' file
The loaded project is added to the Workspace . This will *not* delete
any existing Projects in the Workspace and will rename any Projects
being loaded if necessary.
Par... | python | {
"resource": ""
} |
q20797 | Workspace.new_project | train | def new_project(self, name=None):
r"""
Creates a new empty Project object
Parameters
----------
name : string (optional)
The unique name to give to the project. If none is given, one
will be automatically generated (e.g. 'sim_01`)
Returns
... | python | {
"resource": ""
} |
q20798 | Workspace._gen_name | train | def _gen_name(self):
r"""
Generates a valid name for projects
"""
n = [0]
for item in self.keys():
if item.startswith('sim_'):
n.append(int(item.split('sim_')[1]))
name = 'sim_'+str(max(n)+1).zfill(2)
return name | python | {
"resource": ""
} |
q20799 | Workspace._gen_ids | train | def _gen_ids(self, size):
r"""
Generates a sequence of integers of the given ``size``, starting at 1
greater than the last produced value.
The Workspace object keeps track of the most recent value, which
persists until the current python session is restarted, so the
retu... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.