Skip to content

Commit

Permalink
[1D] Check for Soret diffusion in auto flame solver
Browse files Browse the repository at this point in the history
Don't use Soret diffusion for the initial solve steps, and re-enable it
at the end if the user desires
  • Loading branch information
bryanwweber committed Mar 13, 2018
1 parent a03afbd commit 4bd5e92
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion interfaces/cython/cantera/onedim.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,11 @@ cdef class Sim1D:
dom.set_steady_tolerances(default=(1e-4, 1e-9))
dom.set_transient_tolerances(default=(1e-4, 1e-11))

# Do initial steps without Soret diffusion
soret_doms = [dom for dom in self.domains if getattr(dom, 'soret_enabled', False)]
for dom in soret_doms:
dom.soret_enabled = False

# Do initial solution steps without multicomponent transport
solve_multi = self.gas.transport_model == 'Multi'
if solve_multi:
Expand Down Expand Up @@ -963,6 +968,11 @@ cdef class Sim1D:
if isinstance(dom, _FlowBase):
dom.set_transport(self.gas)

if soret_doms:
log('Solving with Soret diffusion')
for dom in soret_doms:
dom.soret_enabled = True

if have_user_tolerances:
log('Solving with user-specifed tolerances')
for i in range(len(self.domains)):
Expand All @@ -972,7 +982,7 @@ cdef class Sim1D:
rel=rtol_ts_final[i])

# Final call with expensive options enabled
if have_user_tolerances or solve_multi:
if have_user_tolerances or solve_multi or soret_doms:
self.sim.solve(loglevel, <cbool>True)


Expand Down

0 comments on commit 4bd5e92

Please sign in to comment.