def set_residual(self, pores=None, throats=None, mode='add'):
        r"""
        Specify locations of the residual invading (nonwetting) phase

        Parameters
        ----------
        pores and throats : array_like
            The pore and throat locations that are to be filled with invading
            phase at the beginning of the simulation.

        mode : string
            Controls how the new values are handled.  Options are:

            **'add'** : (default) Adds the newly recieved locations to any
            existing locations.  This is useful for incrementally adding
            outlets.

            **'overwrite'** : Deletes any present locations and adds new ones.
            This is useful for fixing mistaken outlets, or rerunning the
            algorithm with different outlet locations.

            **'remove'** : Removes the received locations from the list of
            residual pores and/or throats.  Both can be specified
            simultaneously.

            **'clear'** : Removes all existing residual locations.  This
            ignores any specified locations and is equivalent to calling the
            method with a mode of 'overwrite' and pores = [] or None.

        Notes
        -----
        Setting pores as initially filled only affects the saturation at the
        start of the capillary pressure curve since pre-filled pores do not
        contribute to the invasion process.  Setting throats as filled,
        however, has a significant impact on the subsequent invasion since
        these throats act as bridges to the percolation process.  Of course,
        they also contribute to the starting saturation as well.

        """
        bool_val = True
        if mode is 'clear':
            self['pore.residual'] = False
            self['throat.residual'] = False
            return
        if pores is not None:
            Ps = self._parse_locations(pores)
            if mode in ['clear', 'overwrite']:
                self['pore.residual'] = False
            if mode is 'remove':
                bool_val = False
            self['pore.residual'][Ps] = bool_val
        if throats is not None:
            Ts = self._parse_locations(throats)
            if mode in ['clear', 'overwrite']:
                self['throat.residual'] = False
            if mode is 'remove':
                bool_val = False
            self['throat.residual'][Ts] = bool_val
dataset/ETHPy150Open PMEAL/OpenPNM/OpenPNM/Algorithms/__Drainage__.py/Drainage.set_residual/original