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

Method test_max_time_step

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

Source from the content-addressed store, hash-verified

1885 assert sim.distance == 0.0
1886
1887 def test_max_time_step(self):
1888 surf, gas = self.import_phases()
1889 gas.TPX = 1500, 4000, 'NH3:1.0, SiF4:0.4'
1890 surf.TP = gas.TP
1891 r, rsurf, sim = self.make_reactors(gas, surf)
1892
1893 sim.max_time_step = 0.002
1894 sim.advance(0.01)
1895 sim.step()
1896 x1 = sim.distance
1897 x2 = sim.step()
1898 dx_limit = 0.1 * (x2-x1)
1899
1900 sim.max_time_step = dx_limit
1901 assert sim.max_time_step == dx_limit
1902
1903 # Setting a step size limit seems to take one additional step before it's
1904 # fully enforced
1905 sim.step()
1906
1907 for i in range(20):
1908 tPrev = sim.distance
1909 tNow = sim.step()
1910 assert tNow - tPrev <= 1.0001 * dx_limit
1911
1912 def test_tolerances(self):
1913 surf, gas = self.import_phases()

Callers

nothing calls this directly

Calls 4

import_phasesMethod · 0.95
make_reactorsMethod · 0.95
advanceMethod · 0.80
stepMethod · 0.45

Tested by

no test coverage detected