Closed ischoegl closed 3 years ago
Both groups point to the same flame object ... Python treats everything as a reference
This may require a second flame
object. Note that simulations can be restarted, see:
https://github.com/Cantera/cantera/blob/d8e62addc8bc535588cbf8d1bd832010b22acf1f/interfaces/cython/cantera/onedim.py#L96
Process Process-1:
Traceback (most recent call last):
File "/home/david/anaconda3/envs/ctwrap/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/home/david/anaconda3/envs/ctwrap/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/home/david/ctwrap/ctwrap/simulation.py", line 752, in worker
obj.run(group, config, **kwargs)
File "/home/david/ctwrap/ctwrap/simulation.py", line 143, in run
self.data = self._module.run(name, **config, **kwargs)
File "/home/david/ctwrap/ctwrap/modules/adiabatic_flame.py", line 104, in run
g.solve(loglevel) # don't use 'auto' on subsequent solves
File "/home/david/anaconda3/envs/ctwrap/lib/python3.7/site-packages/cantera/onedim.py", line 864, in solve
return super().solve(loglevel, refine_grid, auto)
File "interfaces/cython/cantera/onedim.pyx", line 1139, in cantera._cantera.Sim1D.solve
cantera._cantera.CanteraError:
***********************************************************************
CanteraError thrown by OneDim::timeStep:
Time integration failed.
***********************************************************************
This is what I am trying to do.
# set up flame object
width = domain.width.m_as('meter')
f = ct.FreeFlame(gas, width=width)
f.set_refine_criteria(ratio=3, slope=0.06, curve=0.12)
if loglevel > 0:
f.show_solution()
out = {}
# Solve with mixture-averaged transport model
f.transport_model = 'Mix'
f.solve(loglevel=loglevel, auto=True)
# Solve with the energy equation enabled
if loglevel > 0:
f.show_solution()
msg = ' {0:s}: mixture-averaged flamespeed = {1:7f} m/s'
print(msg.format(name, f.velocity[0]))
group = name + "_mix"
out[group] = f
f_sol = f.to_solution_array()
# Solve with multi-component transport properties
g = ct.FreeFlame(gas, width=width)
g.set_initial_guess(data=f_sol)
g.set_refine_criteria(ratio=3, slope=0.06, curve=0.12)
g.transport_model = 'Multi'
g.solve(loglevel) # don't use 'auto' on subsequent solves
if loglevel > 0:
g.show_solution()
msg = ' {0:s}: multi-component flamespeed = {1:7f} m/s'
print(msg.format(name, g.velocity[0]))
Ok. The restart doesn’t appear to work. Can you troubleshoot this in a jupyter notebook (I.e. without ctwrap)
Okay
When you set g
, the gas won’t have the correct composition any longer
Mixture-averaged and multi-component diffusion used to give different results, see old ctwrap. They no longer do ...