@@ -765,7 +765,7 @@ def test_solve_ch3_coverage_dependence(self):
765765
766766 def test_solve_h2_thermo_coverage_dependence (self ):
767767 """
768- Test the surface batch reactor can properly apply thermo coverage dependent parameters
768+ Test the surface batch reactor can properly apply thermodynamic coverage dependent parameters
769769 with the dissociative adsorption of H2.
770770
771771 Here we choose a kinetic model consisting of the dissociative adsorption reaction
@@ -802,9 +802,9 @@ def test_solve_h2_thermo_coverage_dependence(self):
802802 Cpdata = ([1.50 , 2.58 , 3.40 , 4.00 , 4.73 , 5.13 , 5.57 ], "cal/(mol*K)" ),
803803 H298 = (- 11.26 , "kcal/mol" ),
804804 S298 = (0.44 , "cal/(mol*K)" ),
805+ thermo_coverage_dependence = {"1 H u0 p0 {2,S} \n 2 X u0 p0 {1,S}" :{'model' :'polynomial' , 'enthalpy-coefficients' :[1 ,2 ,3 ], "entropy-coefficients" :[1 ,5 ,3 ]},}
805806 ),
806807 )
807- hx .thermo .thermo_coverage_dependence = {hx :{'model' :'polynomial' , 'enthalpy-coefficients' :[1 ,2 ,3 ], "entropy-coefficients" :[1 ,5 ,3 ]},}
808808
809809 rxn1 = Reaction (
810810 reactants = [h2 , x , x ],
@@ -844,6 +844,7 @@ def test_solve_h2_thermo_coverage_dependence(self):
844844 surface_volume_ratio = (1e1 , "m^-1" ),
845845 surface_site_density = (2.72e-9 , "mol/cm^2" ),
846846 coverage_dependence = True ,
847+ thermo_coverage_dependence = True ,
847848 termination = [],
848849 )
849850
@@ -853,11 +854,15 @@ def test_solve_h2_thermo_coverage_dependence(self):
853854
854855 assert isinstance (hx .thermo .thermo_coverage_dependence , dict ) # check to make sure coverage_dependence is still the correct type
855856 for species , parameters in hx .thermo .thermo_coverage_dependence .items ():
856- assert isinstance (species , Species ) # species should be a Species
857+ assert isinstance (species , str ) # species should be an ajacency list
857858 assert isinstance (parameters , dict )
858859 assert parameters ["model" ] is not None
859860 assert parameters ["enthalpy-coefficients" ] is not None
860861 assert parameters ["entropy-coefficients" ] is not None
862+ assert np .array_equal (rxn_system .stoi_matrix , np .array ([[- 1. , - 2. , 2. ]]))
863+ thermo_coeffs = np .array ([np .zeros ((3 ,6 ))]* 3 )
864+ thermo_coeffs [- 1 ][- 1 ] = [1. , 2. , 3. , 1. , 5. , 3. ]
865+ assert np .array_equal (rxn_system .thermo_coeff_matrix , thermo_coeffs )
861866 # Integrate to get the solution at each time point
862867 t = []
863868 y = []
@@ -899,7 +904,7 @@ def test_solve_h2_thermo_coverage_dependence(self):
899904
900905 def test_solve_ch3_thermo_coverage_dependence (self ):
901906 """
902- Test the surface batch reactor can properly apply coverage dependent parameters
907+ Test the surface batch reactor can properly apply thermodynamic coverage dependent parameters
903908 with the nondissociative adsorption of CH3
904909
905910 Here we choose a kinetic model consisting of the adsorption reaction
@@ -1002,10 +1007,11 @@ def test_solve_ch3_thermo_coverage_dependence(self):
10021007 Tmin = (298 , "K" ),
10031008 Tmax = (2000 , "K" ),
10041009 E0 = (- 39.1285 , "kJ/mol" ),
1010+ thermo_coverage_dependence = {"1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S} \n 2 H u0 p0 c0 {1,S} \n 3 H u0 p0 c0 {1,S} \n 4 H u0 p0 c0 {1,S} \n 5 X u0 p0 c0 {1,S}" :
1011+ {'model' :'polynomial' , 'enthalpy-coefficients' :[1e5 ,2 ,3 ], "entropy-coefficients" :[1 ,5 ,3 ]},},
10051012 comment = """Thermo library: surfaceThermoNi111""" ,
10061013 ),
10071014 )
1008- ch3x .thermo .thermo_coverage_dependence = {ch3x :{'model' :'polynomial' , 'enthalpy-coefficients' :[1 ,2 ,3 ], "entropy-coefficients" :[1 ,5 ,3 ]},}
10091015
10101016 rxn1 = Reaction (
10111017 reactants = [ch3 , x ],
@@ -1017,7 +1023,6 @@ def test_solve_ch3_thermo_coverage_dependence(self):
10171023 T0 = (1 , "K" ),
10181024 Tmin = (200 , "K" ),
10191025 Tmax = (3000 , "K" ),
1020- coverage_dependence = {x : {"a" : 0.0 , "m" : - 1.0 , "E" : (0.0 , "J/mol" )}},
10211026 comment = """Exact match found for rate rule (Adsorbate;VacantSite)""" ,
10221027 ),
10231028 )
@@ -1036,7 +1041,7 @@ def test_solve_ch3_thermo_coverage_dependence(self):
10361041 initial_surface_coverages = {x : 1.0 },
10371042 surface_volume_ratio = (1.0 , "m^-1" ),
10381043 surface_site_density = (2.72e-9 , "mol/cm^2" ),
1039- coverage_dependence = True ,
1044+ thermo_coverage_dependence = True ,
10401045 termination = [],
10411046 )
10421047 # in chemkin, the sites are mostly occupied in about 1e-8 seconds.
@@ -1052,13 +1057,21 @@ def test_solve_ch3_thermo_coverage_dependence(self):
10521057 rxn1 .get_surface_rate_coefficient (rxn_system .T .value_si , rxn_system .surface_site_density .value_si ),
10531058 )
10541059
1055- assert isinstance (ch3 .thermo .thermo_coverage_dependence , dict ) # check to make sure coverage_dependence is still the correct type
1056- for species , parameters in ch3 .thermo .thermo_coverage_dependence .items ():
1057- assert isinstance (species , Species ) # species should be a Species
1060+ assert isinstance (ch3x .thermo .thermo_coverage_dependence , dict ) # check to make sure coverage_dependence is still the correct type
1061+ for species , parameters in ch3x .thermo .thermo_coverage_dependence .items ():
1062+ assert isinstance (species , str ) # species should be an ajacency list
10581063 assert isinstance (parameters , dict )
10591064 assert parameters ["model" ] is not None
10601065 assert parameters ["enthalpy-coefficients" ] is not None
10611066 assert parameters ["entropy-coefficients" ] is not None
1067+
1068+ # check thermo_coverage_dependence is on
1069+ # and thermo_coeff_matrix and stoi_matrix are correctly created
1070+ assert rxn_system .thermo_coverage_dependence is True
1071+ assert np .array_equal (rxn_system .stoi_matrix , np .array ([[- 1 , - 1 , 1 ]], dtype = float ))
1072+ thermo_coeff_matrix = np .array ([np .zeros ((3 ,6 ))]* 3 )
1073+ thermo_coeff_matrix [- 1 ][- 1 ] = [1e5 , 2 , 3 , 1 , 5 , 3 ]
1074+ assert np .array_equal (rxn_system .thermo_coeff_matrix , thermo_coeff_matrix )
10621075
10631076 # Integrate to get the solution at each time point
10641077 t = []
@@ -1122,6 +1135,12 @@ def test_solve_ch3_thermo_coverage_dependence(self):
11221135 )
11231136
11241137 rxn_system .initialize_model (core_species , core_reactions , edge_species , edge_reactions )
1138+
1139+ # check thermo_coverage_dependence is off
1140+ # and thermo_coeff_matrix and stoi_matrix are not created
1141+ assert rxn_system .thermo_coverage_dependence is False
1142+ assert rxn_system .thermo_coeff_matrix is None
1143+ assert rxn_system .stoi_matrix is None
11251144
11261145 tlist = np .logspace (- 13 , - 5 , 81 , dtype = float )
11271146
0 commit comments