Ejemplo n.º 1
0
    def sensitivity(self, component='', parameter=-1, reactor=''):
        """Sensitivity of solution component 'component' with respect
        to one or more parameters.

        component -- name of the species or other variable for which
        sensitivity information is desired.

        parameter -- single integer or sequence of integers specifying
        the parameters. The parameters are numbered from zero,
        beginning with the parameters for the first reactor and
        continuing through those for the last reactor in the
        network. If omitted, the sensitivity with respect to all
        parameters will be returned.

        reactor -- reactor containing the desired component.

    
        """

        n = 0
        if reactor <> '':
            for reac in self._reactors:
                if reac.name() == reactor:
                    break
                else:
                    n = n + 1
        np = self.nSensParams()
        if parameter >= 0 and parameter < np:
            return _cantera.reactornet_sensitivity(self.__reactornet_id,
                                                   component, parameter, n)
        elif parameter == -1:
            s = []
            for m in range(np):
                s.append(
                    _cantera.reactornet_sensitivity(self.__reactornet_id,
                                                    component, m, n))
            return s
        else:
            raise CanteraError(
                "sensitivity requested for illegal parameter number:" +
                ` parameter `)
Ejemplo n.º 2
0
    def sensitivity(self, component = '', parameter = -1, reactor = ''):

        """Sensitivity of solution component 'component' with respect
        to one or more parameters.

        component -- name of the species or other variable for which
        sensitivity information is desired.

        parameter -- single integer or sequence of integers specifying
        the parameters. The parameters are numbered from zero,
        beginning with the parameters for the first reactor and
        continuing through those for the last reactor in the
        network. If omitted, the sensitivity with respect to all
        parameters will be returned.

        reactor -- reactor containing the desired component.

    
        """
        
        n = 0
        if reactor <> '':
            for reac in self._reactors:
                if reac.name() == reactor:
                    break
                else:
                    n = n+1
        np = self.nSensParams()
        if parameter >= 0 and parameter < np:
            return _cantera.reactornet_sensitivity(self.__reactornet_id,
                                                   component, parameter, n)
        elif parameter == -1:
            s = []
            for m in range(np):
                s.append(_cantera.reactornet_sensitivity(self.__reactornet_id,
                                                         component, m, n))
            return s
        else:
            raise CanteraError("sensitivity requested for illegal parameter number:"+`parameter`)