Beispiel #1
0
    def interpolate_data(self, propname, mode='mean'):
        r"""
        Determines a pore (or throat) property as the average of it's
        neighboring throats (or pores)

        Parameters
        ----------
        propname: str
            The dictionary key to the values to be interpolated.
        mode : str
            The method used for interpolation.  Options are 'mean' (default),
            'min', and 'max'.

        Returns
        -------
        vals : ndarray
            An array containing interpolated pore (or throat) data

        Examples
        --------
        >>> import openpnm as op
        >>> pn = op.network.Cubic(shape=[3, 1, 1])
        >>> pn['pore.value'] = [1, 2, 3]
        >>> pn.interpolate_data('pore.value')
        array([1.5, 2.5])

        """
        from openpnm.models.misc import from_neighbor_throats, from_neighbor_pores
        if propname.startswith('throat'):
            values = from_neighbor_throats(target=self,
                                           prop=propname,
                                           mode=mode)
        elif propname.startswith('pore'):
            values = from_neighbor_pores(target=self, prop=propname, mode=mode)
        if hasattr(self[propname], 'units'):
            values *= self[propname].units
        return values
Beispiel #2
0
def from_neighbor_pores(target, pore_prop='pore.seed', mode='min'):
    return _misc.from_neighbor_pores(target=target,
                                     pore_prop=pore_prop,
                                     mode=mode)
Beispiel #3
0
def from_neighbor_pores(target, prop='pore.diameter', mode='min'):
    return _misc.from_neighbor_pores(target=target, prop=prop, mode=mode)
Beispiel #4
0
def from_neighbor_pores(target, pore_prop='pore.seed', mode='min'):
    return _misc.from_neighbor_pores(target=target, pore_prop=pore_prop,
                                     mode=mode)