get_flame_speed_reaction_sensitivitiesdef 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 species 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_0self.solve_adjoint(perturb, self.gas.n_reactions, dgdx)
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) pos = int(Nvars / len(self.grid))
# Index of spec in the global solution vector # i_spec = self.inlet.n_components + self.flame.component_index(species) + grid_point * pos i_spec = self.inlet.n_components + self.flame.component_index(species) + self.domains[1].n_components*grid_point
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_0Hello Rodolfo,
--
You received this message because you are subscribed to a topic in the Google Groups "Cantera Users' Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cantera-users/vfejZRDKKuw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cantera-user...@googlegroups.com.
To post to this group, send email to canter...@googlegroups.com.
Visit this group at https://groups.google.com/group/cantera-users.
For more options, visit https://groups.google.com/d/optout.
Hello Rodolfo,