def get_species_reaction_sensitivities(self, species, grid_point):
r"""
Compute the normalized sensitivities of the species production
:math:`s_{i, spec}` with respect to the reaction rate constants :math:`k_i`:
.. math::
s_{i, spec} = \frac{k_i}{[X]} \frac{d[X]}{dk_i}
"""
def g(sim):
return sim.X[self.gas.species_index(species), grid_point]
Nvars = sum(D.n_components * D.n_points for D in self.domains)
# Index of u[0] in the global solution vector
i_spec = self.inlet.n_components + self.flame.component_index(species)
dgdx = np.zeros(Nvars)
dgdx[i_spec] = 1
spec_0 = g(self)
def perturb(sim, i, dp):
sim.gas.set_multiplier(1+dp, i)
return self.solve_adjoint(perturb, self.gas.n_reactions, dgdx) / spec_0