[Kinetics] Add test that reaction path fluxes are correct
This commit is contained in:
parent
5a0fb579a8
commit
092e00744b
1 changed files with 26 additions and 0 deletions
|
|
@ -460,6 +460,32 @@ class TestReactionPath(utilities.CanteraTest):
|
||||||
for spec in species:
|
for spec in species:
|
||||||
self.assertTrue(gas.n_atoms(spec, element) > 0)
|
self.assertTrue(gas.n_atoms(spec, element) > 0)
|
||||||
|
|
||||||
|
def test_fluxes(self):
|
||||||
|
gas = ct.Solution('h2o2.cti')
|
||||||
|
gas.TPX = 1100, 10*ct.one_atm, 'H:0.1, HO2:0.1, AR:6'
|
||||||
|
diagram = ct.ReactionPathDiagram(gas, 'H')
|
||||||
|
ropf = gas.forward_rates_of_progress
|
||||||
|
ropr = gas.reverse_rates_of_progress
|
||||||
|
|
||||||
|
fluxes = {}
|
||||||
|
for line in diagram.get_data().strip().split('\n')[1:]:
|
||||||
|
s = line.split()
|
||||||
|
fwd = float(s[2])
|
||||||
|
rev = float(s[3])
|
||||||
|
if fwd:
|
||||||
|
fluxes[s[0],s[1]] = fwd
|
||||||
|
if rev:
|
||||||
|
fluxes[s[1],s[0]] = -rev
|
||||||
|
|
||||||
|
self.assertNear(fluxes['HO2','H'], ropr[5] + ropr[8], 1e-5)
|
||||||
|
self.assertNear(fluxes['H', 'H2'], 2*ropf[10] + ropf[15], 1e-5)
|
||||||
|
self.assertNear(fluxes['H', 'H2O'], ropf[14], 1e-5)
|
||||||
|
self.assertNear(fluxes['H', 'OH'], ropf[16], 1e-5)
|
||||||
|
self.assertNear(fluxes['HO2','H2'], ropf[15], 1e-5)
|
||||||
|
self.assertNear(fluxes['HO2', 'H2O'], ropf[14], 1e-5)
|
||||||
|
self.assertNear(fluxes['HO2', 'OH'], ropf[16], 1e-5)
|
||||||
|
self.assertNear(fluxes['HO2', 'H2O2'], 2*ropf[25] + 2*ropf[26], 1e-5)
|
||||||
|
|
||||||
|
|
||||||
class TestChemicallyActivated(utilities.CanteraTest):
|
class TestChemicallyActivated(utilities.CanteraTest):
|
||||||
def test_rate_evaluation(self):
|
def test_rate_evaluation(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue