-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in reaction path flux calculation #377
Comments
In Cantera 2.1.2, this calculation is differently wrong. Instead of giving zero flux for import cantera as ct
g = ct.Solution('h2o2.xml')
g.TPX = 900, ct.one_atm, 'H:0.1, HO2:0.1, AR:6'
diagram = ct.ReactionPathDiagram(g, 'H')
ropf = g.forward_rates_of_progress
ropr = g.reverse_rates_of_progress
for i in range(g.n_reactions):
if (ropf[i] > 1e-8 or ropr[i] > 1e-8) and ('H' in g.reaction(i).reactants or 'H' in g.reaction(i).products):
print('{:2d} {:25s} {:11.5g} {:11.5g}'.format(i, g.reaction_equation(i), ropf[i], ropr[i]))
print(diagram.get_data())
print(g['H'].net_production_rates) gives the output:
|
speth/cantera@f2ff344 is a partial fix for this issue, and restores the double-counting behavior seen before 37f71bd. speth/cantera@12f2823 is an attempt to fix the double-counting seen when computing the flux of import cantera as ct
g = ct.Solution('h2o2.xml')
g.TPX = 900, ct.one_atm, 'H:0.1, HO2:0.1, AR:6'
diagram = ct.ReactionPathDiagram(g, 'H')
ropf = g.forward_rates_of_progress
ropr = g.reverse_rates_of_progress
for i in range(g.n_reactions):
if (ropf[i] > 1e-8 or ropr[i] > 1e-8):
print('{:2d} {:25s} {:11.5g} {:11.5g}'.format(
i, g.reaction_equation(i), ropf[i], ropr[i]))
print()
for i,line in enumerate(diagram.get_data().split('\n')):
s = line.split()
if len(s) != 4:
continue
print('{:>6s} -> {:6s} {: 9.2f} {: 9.2f}'.format(
s[0], s[1], float(s[2]), float(s[3]))) gives the output:
|
This fixes the double counting that occurs in reactions like: H + HO2 => 2 OH Fixes Cantera#377
This fixes the double counting that occurs in reactions like: H + HO2 => 2 OH Fixes Cantera#377
This fixes the double counting that occurs in reactions like: H + HO2 => 2 OH Fixes #377
The reaction path flux calculation appears to fail for reactions such as:
For example, running the following code:
Produces the following output:
From this, we see:
HO2 -> H
H -> H2
H -> H2O
H -> OH
HO2 -> OH
In addition, the sum of all fluxes from
H
(-1.6e-5 - 1176 - 130 = -1306) do not equal the net production rate ofH
(-4116).The text was updated successfully, but these errors were encountered: