(self)
| 2833 | assert r.component_name(2) == 'temperature' |
| 2834 | |
| 2835 | def test_replace_equations(self): |
| 2836 | nsp = self.gas.n_species |
| 2837 | tau = np.linspace(0.5, 2, nsp + 3) |
| 2838 | class DummyReactor(ct.ExtensibleReactor): |
| 2839 | def __init__(self, *args, **kwargs): |
| 2840 | super().__init__(*args, **kwargs) |
| 2841 | self.y = np.ones(nsp + 3) |
| 2842 | |
| 2843 | def replace_get_state(self, y): |
| 2844 | y[:] = self.y |
| 2845 | |
| 2846 | def replace_update_state(self, y): |
| 2847 | self.y[:] = y |
| 2848 | |
| 2849 | def replace_eval(self, t, LHS, RHS): |
| 2850 | RHS[:] = - self.y / tau |
| 2851 | |
| 2852 | r = DummyReactor(self.gas) |
| 2853 | net = ct.ReactorNet([r]) |
| 2854 | net.rtol *= 0.1 |
| 2855 | |
| 2856 | while(net.time < 1): |
| 2857 | net.step() |
| 2858 | assert r.get_state() == approx(np.exp(- net.time / tau)) |
| 2859 | |
| 2860 | def test_error_handling(self): |
| 2861 | class DummyReactor1(ct.ExtensibleReactor): |
nothing calls this directly
no test coverage detected