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

Method test_component_names

test/python/test_reactor.py:1753–1773  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1751 assert r.thermo.density * r.area * r.speed == approx(mdot)
1752
1753 def test_component_names(self):
1754 surf = ct.Interface('methane_pox_on_pt.yaml', 'Pt_surf')
1755 gas = surf.adjacent['gas']
1756 r = ct.FlowReactor(gas)
1757 r.mass_flow_rate = 0.1
1758 rsurf = ct.ReactorSurface(surf, r)
1759 sim = ct.ReactorNet([r])
1760 sim.initialize()
1761
1762 assert r.n_vars == 4 + gas.n_species + surf.n_species
1763 assert sim.n_vars == r.n_vars
1764
1765 for i in range(r.n_vars):
1766 name = r.component_name(i)
1767 assert r.component_index(name) == i
1768
1769 with pytest.raises(IndexError, match="No such component: 'spam'"):
1770 r.component_index('spam')
1771
1772 with pytest.raises(ct.CanteraError, match='out of bounds'):
1773 r.component_name(200)
1774
1775class TestFlowReactor2:
1776 def import_phases(self):

Callers

nothing calls this directly

Calls 4

initializeMethod · 0.95
InterfaceMethod · 0.80
ReactorSurfaceMethod · 0.80
ReactorNetMethod · 0.45

Tested by

no test coverage detected