3535
3636import cantera as ct
3737import numpy
38+ import numpy as np
3839import yaml
3940from copy import deepcopy
4041
@@ -2916,7 +2917,9 @@ def test_arrhenius(self):
29162917 # Check that the reaction string is the same
29172918 assert repr (converted_obj ) == repr (ct_obj )
29182919 # Check that the rate is the same. arrhenius string is not going to be identical
2919- assert converted_obj .rate .input_data == ct_obj .rate .input_data
2920+ assert np .isclose (converted_obj .rate .input_data ['rate-constant' ]['A' ], ct_obj .rate .input_data ['rate-constant' ]['A' ])
2921+ assert np .isclose (converted_obj .rate .input_data ['rate-constant' ]['b' ], ct_obj .rate .input_data ['rate-constant' ]['b' ])
2922+ assert np .isclose (converted_obj .rate .input_data ['rate-constant' ]['Ea' ], ct_obj .rate .input_data ['rate-constant' ]['Ea' ])
29202923
29212924 def test_multi_arrhenius (self ):
29222925 """
@@ -2936,9 +2939,9 @@ def test_multi_arrhenius(self):
29362939 # Check that the reaction string is the same
29372940 assert repr (converted_rxn ) == repr (ct_rxn )
29382941 # Check that the Arrhenius rates are identical
2939- assert round ( abs ( converted_rxn .rate .pre_exponential_factor - ct_rxn .rate .pre_exponential_factor ), 3 ) == 0
2940- assert round ( abs ( converted_rxn .rate .temperature_exponent - ct_rxn .rate .temperature_exponent ), 7 ) == 0
2941- assert round ( abs ( converted_rxn .rate .activation_energy - ct_rxn .rate .activation_energy ), 7 ) == 0
2942+ assert np . isclose ( converted_rxn .rate .pre_exponential_factor , ct_rxn .rate .pre_exponential_factor )
2943+ assert np . isclose ( converted_rxn .rate .temperature_exponent , ct_rxn .rate .temperature_exponent )
2944+ assert np . isclose ( converted_rxn .rate .activation_energy , ct_rxn .rate .activation_energy )
29422945
29432946 def test_pdep_arrhenius (self ):
29442947 """
@@ -3140,18 +3143,17 @@ def test_get_reversible_potential(self):
31403143
31413144 def test_get_rate_coeff (self ):
31423145 """Test get_rate_coefficient() method"""
3143-
31443146 # these should be the same
31453147 kf_1 = self .rxn_reduction .get_rate_coefficient (298 ,potential = 0 )
31463148 kf_2 = self .rxn_reduction .kinetics .get_rate_coefficient (298 ,0 )
31473149
3148- assert abs (kf_1 - 43870506959779.0 ) < 0.000001
3149- assert abs (kf_1 - kf_2 ) < 0.000001
3150+ assert np . isclose (kf_1 , 43870506959779.0 )
3151+ assert np . isclose (kf_1 , kf_2 )
31503152
3151- #kf_2 should be greater than kf_1
3153+ # kf_2 should be greater than kf_1
31523154 kf_1 = self .rxn_oxidation .get_rate_coefficient (298 ,potential = 0 )
31533155 kf_2 = self .rxn_oxidation .get_rate_coefficient (298 ,potential = 0.1 )
3154- assert kf_2 > kf_1
3156+ assert kf_2 > kf_1
31553157
31563158 def test_equilibrium_constant_surface_charge_transfer_kc (self ):
31573159 """
0 commit comments