MCPcopy Create free account
hub / github.com/Cantera/cantera / check_thermo

Method check_thermo

test/python/test_convert.py:878–895  ·  view source on GitHub ↗
(self, ck_phase, yaml_phase, temperatures, tol=1e-7)

Source from the content-addressed store, hash-verified

876 return ck_phase, yaml_phase
877
878 def check_thermo(self, ck_phase, yaml_phase, temperatures, tol=1e-7):
879 yaml_idx = {ck_phase.species_index(s): yaml_phase.species_index(s) for s in ck_phase.species_names}
880
881 for T in temperatures:
882 ck_phase.TP = T, ct.one_atm
883 yaml_phase.TP = T, ct.one_atm
884 cp_ck = ck_phase.partial_molar_cp
885 cp_yaml = yaml_phase.partial_molar_cp
886 h_ck = ck_phase.partial_molar_enthalpies
887 h_yaml = yaml_phase.partial_molar_enthalpies
888 s_ck = ck_phase.partial_molar_entropies
889 s_yaml = yaml_phase.partial_molar_entropies
890 assert ck_phase.density == approx(yaml_phase.density)
891 for i in range(ck_phase.n_species):
892 message = ' for species {0} at T = {1}'.format(i, T)
893 assert cp_ck[i] == approx(cp_yaml[yaml_idx[i]], rel=tol), 'cp' + message
894 assert h_ck[i] == approx(h_yaml[yaml_idx[i]], rel=tol), 'h' + message
895 assert s_ck[i] == approx(s_yaml[yaml_idx[i]], rel=tol), 's' + message
896
897 def check_kinetics(self, ck_phase, yaml_phase, temperatures, pressures, tol=1e-7):
898 for T, P in itertools.product(temperatures, pressures):

Callers 4

test_gri30Method · 0.95
test_write_chemkinMethod · 0.95

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected