Skip to content

Commit 265a186

Browse files
committed
[1D] Disable free flame domain width check when auto=False
Solving with auto=True and then solving with auto=False would leave the domain width check in place, but without the logic for automatically increasing the domain width, resulting in unexpected solver failures.
1 parent 7ac0910 commit 265a186

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

interfaces/cython/cantera/onedim.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ def check_width(t):
513513

514514
for _ in range(12):
515515
try:
516-
return super().solve(loglevel, refine_grid, auto)
516+
super().solve(loglevel, refine_grid, auto)
517+
break
517518
except DomainTooNarrow:
518519
self.flame.grid *= 2
519520
if loglevel > 0:

interfaces/cython/cantera/test/test_onedim.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ def test_auto_width(self):
170170
Tad = self.gas.T
171171
self.assertNear(Tad, self.sim.T[-1], 2e-2)
172172

173+
# Re-solving with auto=False should not trigger a DomainTooNarrow
174+
# exception, and should leave domain width constant
175+
self.sim.flame.grid *= 0.3
176+
old_width = self.sim.grid[-1]
177+
self.sim.solve(loglevel=0, refine_grid=True, auto=False)
178+
self.assertNear(self.sim.grid[-1], old_width)
179+
173180
def test_auto_width2(self):
174181
self.create_sim(p=ct.one_atm, Tin=400, reactants='H2:0.8, O2:0.5',
175182
width=0.1)

0 commit comments

Comments
 (0)