Beispiel #1
0
 def test_ispercolating(self):
     net = op.network.Cubic(shape=[10, 10, 10], connectivity=26)
     tmask = net['throat.all']
     Pin = net.pores('left')
     Pout = net.pores('right')
     am = net.create_adjacency_matrix(weights=tmask, fmt='coo')
     val = topotools.ispercolating(am=am, mode='bond',
                                   inlets=Pin, outlets=Pout)
     assert val
     val = topotools.ispercolating(am=am, mode='site',
                                   inlets=Pin, outlets=Pout)
     assert val
Beispiel #2
0
 def test_ispercolating(self):
     net = op.network.Cubic(shape=[10, 10, 10], connectivity=26)
     tmask = net['throat.all']
     Pin = net.pores('left')
     Pout = net.pores('right')
     am = net.create_adjacency_matrix(weights=tmask, fmt='coo')
     val = topotools.ispercolating(am=am,
                                   mode='bond',
                                   inlets=Pin,
                                   outlets=Pout)
     assert val
     val = topotools.ispercolating(am=am,
                                   mode='site',
                                   inlets=Pin,
                                   outlets=Pout)
     assert val
    def is_percolating(self, applied_pressure):
        r"""
        Returns a True or False value to indicate if a percolating cluster
        spans between the inlet and outlet pores that were specified at the
        given applied pressure.

        Parameters
        ----------
        applied_pressure : scalar, float
            The pressure at which percolation should be checked

        Returns
        -------
        A simple boolean True or False if percolation has occured or not.

        """
        if np.sum(self['pore.inlets']) == 0:
            raise Exception('Inlet pores must be specified first')
        else:
            Pin = self['pore.inlets']
        if np.sum(self['pore.outlets']) == 0:
            raise Exception('Outlet pores must be specified first')
        else:
            Pout = self['pore.outlets']
        # Do a simple check of pressures on the outlet pores first...
        if np.amin(self['pore.invasion_pressure'][Pout]) > applied_pressure:
            val = False
        else:  # ... and do a rigorous check only if necessary
            mask = self['throat.invasion_pressure'] < applied_pressure
            am = self.project.network.create_adjacency_matrix(weights=mask,
                                                              fmt='coo')
            val = ispercolating(am=am, mode=self.settings['mode'],
                                inlets=Pin, outlets=Pout)
        return val
Beispiel #4
0
    def is_percolating(self, applied_pressure):
        r"""
        Returns a True or False value to indicate if a percolating cluster
        spans between the inlet and outlet pores that were specified at the
        given applied pressure.

        Parameters
        ----------
        applied_pressure : scalar, float
            The pressure at which percolation should be checked

        Returns
        -------
        A simple boolean True or False if percolation has occured or not.

        """
        if np.sum(self['pore.inlets']) == 0:
            raise Exception('Inlet pores must be specified first')
        else:
            Pin = self['pore.inlets']
        if np.sum(self['pore.outlets']) == 0:
            raise Exception('Outlet pores must be specified first')
        else:
            Pout = self['pore.outlets']
        # Do a simple check of pressures on the outlet pores first...
        if np.amin(self['pore.invasion_pressure'][Pout]) > applied_pressure:
            val = False
        else:  # ... and do a rigorous check only if necessary
            mask = self['throat.invasion_pressure'] < applied_pressure
            am = self.project.network.create_adjacency_matrix(weights=mask,
                                                              fmt='coo')
            val = ispercolating(am=am, mode=self.settings['mode'],
                                inlets=Pin, outlets=Pout)
        return val