diff --git a/include/cantera/zeroD/ReactorNet.h b/include/cantera/zeroD/ReactorNet.h index 877fd2cf9..f0faa3f96 100644 --- a/include/cantera/zeroD/ReactorNet.h +++ b/include/cantera/zeroD/ReactorNet.h @@ -152,10 +152,10 @@ public: return m_integ->sensitivity(k, m_sensIndex[p])/m_integ->solution(k); } - //! Return the sensitivity of the species named *species* with respect to + //! Return the sensitivity of the component named *component* with respect to //! the *p*-th sensitivity parameter. - double sensitivity(const std::string& species, size_t p, int reactor=0) { - size_t k = globalComponentIndex(species, reactor); + double sensitivity(const std::string& component, size_t p, int reactor=0) { + size_t k = globalComponentIndex(component, reactor); return sensitivity(k, p); } @@ -182,10 +182,10 @@ public: return m_ntotpar; } - //! Return the index corresponding to the species named *species* in the + //! Return the index corresponding to the component named *component* in the //! reactor with index *reactor* in the global state vector for the //! reactor network. - size_t globalComponentIndex(const std::string& species, size_t reactor=0); + size_t globalComponentIndex(const std::string& component, size_t reactor=0); //! Used by Reactor and Wall objects to register the addition of //! sensitivity reactions so that the ReactorNet can keep track of the diff --git a/interfaces/cython/cantera/reactor.pyx b/interfaces/cython/cantera/reactor.pyx old mode 100755 new mode 100644 index 2580e001a..e90b21ab7 --- a/interfaces/cython/cantera/reactor.pyx +++ b/interfaces/cython/cantera/reactor.pyx @@ -817,20 +817,19 @@ cdef class ReactorNet: def __set__(self, pybool v): self.net.setVerbose(v) - def sensitivity(self, species, int p, int r=0): + def sensitivity(self, component, int p, int r=0): """ - Returns the sensitivity of the solution variable *species* in reactor - *r* with respect to the parameter *p*. Returns an empty array until the - first time step is taken. See `ReactorNet.component_index` and - `sensitivities` to determine the integer index for the variables. - Otherwise, a string can be passed into *species* to automatically look - up the index. + Returns the sensitivity of the solution variable *component* in + reactor *r* with respect to the parameter *p*. *component* can be a + string or an integer. See `component_index` and `sensitivities` to + determine the integer index for the variables. If it is not given, *r* + defaults to the first reactor. Returns an empty array until the first + time step is taken. """ - - if isinstance(species, int): - return self.net.sensitivity(species,p) - elif isinstance(species, (str, unicode)): - return self.net.sensitivity(stringify(species), p, r) + if isinstance(component, int): + return self.net.sensitivity(component, p) + elif isinstance(component, (str, unicode)): + return self.net.sensitivity(stringify(component), p, r) def sensitivities(self): """ diff --git a/src/zeroD/ReactorNet.cpp b/src/zeroD/ReactorNet.cpp index 03a34e6aa..d514bec20 100644 --- a/src/zeroD/ReactorNet.cpp +++ b/src/zeroD/ReactorNet.cpp @@ -254,7 +254,7 @@ void ReactorNet::getInitialConditions(doublereal t0, } } -size_t ReactorNet::globalComponentIndex(const string& species, size_t reactor) +size_t ReactorNet::globalComponentIndex(const string& component, size_t reactor) { if (!m_init) { initialize(); @@ -264,7 +264,7 @@ size_t ReactorNet::globalComponentIndex(const string& species, size_t reactor) for (n = 0; n < reactor; n++) { start += m_size[n]; } - return start + m_reactors[n]->componentIndex(species); + return start + m_reactors[n]->componentIndex(component); } void ReactorNet::registerSensitivityReaction(void* reactor,