@@ -24,9 +24,9 @@ def test_implicit_three_body(self):
2424 rate-constant: {A: 2.08e+19, b: -1.24, Ea: 0.0}
2525 """
2626 rxn1 = ct .Reaction .from_yaml (yaml1 , self .gas )
27- self . assertEqual ( rxn1 .reaction_type , "three-body" )
28- self . assertEqual ( rxn1 .default_efficiency , 0. )
29- self . assertEqual ( rxn1 .efficiencies , {"O2" : 1 })
27+ assert rxn1 .rate . type == "three-body-Arrhenius"
28+ assert rxn1 .rate . default_efficiency == 0.
29+ assert rxn1 .rate . efficiencies == {"O2" : 1 }
3030
3131 yaml2 = """
3232 equation: H + O2 + M <=> HO2 + M
@@ -36,8 +36,9 @@ def test_implicit_three_body(self):
3636 efficiencies: {O2: 1.0}
3737 """
3838 rxn2 = ct .Reaction .from_yaml (yaml2 , self .gas )
39- self .assertEqual (rxn1 .efficiencies , rxn2 .efficiencies )
40- self .assertEqual (rxn1 .default_efficiency , rxn2 .default_efficiency )
39+ assert rxn2 .rate .type == "three-body-Arrhenius"
40+ assert rxn1 .rate .efficiencies == rxn2 .rate .efficiencies
41+ assert rxn1 .rate .default_efficiency == rxn2 .rate .default_efficiency
4142
4243 def test_duplicate (self ):
4344 # @todo simplify this test
@@ -46,25 +47,26 @@ def test_duplicate(self):
4647 species = self .gas .species (), reactions = [])
4748
4849 yaml1 = """
49- equation: H + O2 + H2O <=> HO2 + H2O
50+ equation: H + O2 + M <=> HO2 + M
5051 rate-constant: {A: 1.126e+19, b: -0.76, Ea: 0.0}
52+ type: three-body
53+ default-efficiency: 0
54+ efficiencies: {H2O: 1}
5155 """
5256 rxn1 = ct .Reaction .from_yaml (yaml1 , gas1 )
57+ assert rxn1 .rate .type == "three-body-Arrhenius"
5358
5459 yaml2 = """
55- equation: H + O2 + M <=> HO2 + M
60+ equation: H + O2 + H2O <=> HO2 + H2O
5661 rate-constant: {A: 1.126e+19, b: -0.76, Ea: 0.0}
57- type: three-body
58- default-efficiency: 0
59- efficiencies: {H2O: 1}
6062 """
6163 rxn2 = ct .Reaction .from_yaml (yaml2 , gas1 )
64+ assert rxn2 .rate .type == "three-body-Arrhenius"
6265
63- self .assertEqual (rxn1 .reaction_type , rxn2 .reaction_type )
6466 self .assertEqual (rxn1 .reactants , rxn2 .reactants )
6567 self .assertEqual (rxn1 .products , rxn2 .products )
66- self . assertEqual ( rxn1 .efficiencies , rxn2 .efficiencies )
67- self . assertEqual ( rxn1 .default_efficiency , rxn2 .default_efficiency )
68+ assert rxn1 .rate . efficiencies == rxn2 .rate . efficiencies
69+ assert rxn1 .rate . default_efficiency == rxn2 .rate . default_efficiency
6870
6971 gas1 .add_reaction (rxn1 )
7072 gas1 .add_reaction (rxn2 )
@@ -1286,19 +1288,40 @@ def test_efficiencies(self):
12861288 self .assertEqual (rxn .efficiencies , self ._kwargs ["efficiencies" ])
12871289
12881290
1289- class TestThreeBody (TestThreeBody2 ):
1291+ class TestThreeBody (ReactionTests , utilities . CanteraTest ):
12901292 # test updated version of three-body reaction
12911293
1294+ _cls = ct .Reaction
1295+ _equation = "2 O + M <=> O2 + M"
1296+ _rate = {"A" : 1.2e11 , "b" : - 1.0 , "Ea" : 0.0 }
1297+ _kwargs = {"efficiencies" : {"H2" : 2.4 , "H2O" : 15.4 , "AR" : 0.83 }}
1298+ _index = 1
12921299 _legacy = False
1293- _rxn_type = "three-body"
1294- _rate_type = "Arrhenius"
1300+ _rxn_type = "reaction"
1301+ _rate_type = "three-body-Arrhenius"
1302+ _rate_cls = ct .ThreeBodyArrheniusRate
12951303 _yaml = """
12961304 equation: 2 O + M <=> O2 + M
1297- type: three-body
1305+ type: three-body-Arrhenius
12981306 rate-constant: {A: 1.2e+11, b: -1.0, Ea: 0.0 cal/mol}
12991307 efficiencies: {H2: 2.4, H2O: 15.4, AR: 0.83}
13001308 """
13011309
1310+ @classmethod
1311+ def setUpClass (cls ):
1312+ ReactionTests .setUpClass ()
1313+ cls ._rate_obj = ct .ThreeBodyArrheniusRate (1.2e11 , - 1.0 , 0.0 , ** cls ._kwargs )
1314+
1315+ def from_parts (self ):
1316+ rxn = ReactionTests .from_parts (self )
1317+ rxn .rate .efficiencies = self ._kwargs ["efficiencies" ]
1318+ return rxn
1319+
1320+ def test_efficiencies (self ):
1321+ # check efficiencies
1322+ rxn = self .from_parts ()
1323+ self .assertEqual (rxn .rate .efficiencies , self ._kwargs ["efficiencies" ])
1324+
13021325
13031326class TestImplicitThreeBody (TestThreeBody ):
13041327 # test three-body reactions with explicit collision parther
@@ -1314,15 +1337,15 @@ class TestImplicitThreeBody(TestThreeBody):
13141337
13151338 def from_parts (self ):
13161339 rxn = ReactionTests .from_parts (self )
1317- rxn .efficiencies = {"O2" : 1. }
1318- rxn .default_efficiency = 0
1340+ rxn .rate . efficiencies = {"O2" : 1. }
1341+ rxn .rate . default_efficiency = 0
13191342 return rxn
13201343
13211344 def test_efficiencies (self ):
13221345 # overload of default tester
13231346 rxn = self .from_rate (self ._rate_obj )
1324- self .assertEqual (rxn .efficiencies , {"O2" : 1. })
1325- self .assertEqual (rxn .default_efficiency , 0. )
1347+ self .assertEqual (rxn .rate . efficiencies , {"O2" : 1. })
1348+ self .assertEqual (rxn .rate . default_efficiency , 0. )
13261349
13271350
13281351class TestTwoTempPlasma (ReactionTests , utilities .CanteraTest ):
0 commit comments