Increasing maximum number of timesteps in difflame (MATLAB)

311 views
Skip to first unread message

Wes Robert Jones Hellwig

unread,
Sep 23, 2022, 12:15:45 PM9/23/22
to Cantera Users' Group
Hello,

I am using difflame to validate a flamelet code I have written, however I am getting the following error: 

"CanteraError thrown by OneDim::timeStep:
Took maximum number of timesteps allowed (500) without reaching steady-state solution."

I would like to increase the maximum number of timesteps beyond 500. How can this be done? I have seen this question answered for the zero-Dim reactor problem in python, however I am using the MATLAB interface.

Thank you

Steven DeCaluwe

unread,
Sep 23, 2022, 2:50:18 PM9/23/22
to Cantera Users' Group
Hi Wes,

You are correct - it looks like the 1D flows do not have any ability to directly change the max number of time steps, via Matlab.

1. It looks like you *could* get around this, indirectly, using the function setTimeStep.

function setTimeStep(s, stepsize, steps)
% SETTIMESTEP Specify a sequence of time steps.
% setTimeStep(s, stepsize, steps)
% :param stepsize:
% Initial step size (s)
% :param steps:
% Vector of number of steps to take before
% re-attempting solution of steady-state problem. For
% example, steps = [1, 2, 5, 10] would cause one time
% step to be taken first the the steady-state
% solution attempted. If this failed, two time steps
  % would be taken, etc.


2. *However* the fact that you are not finding a steady-state solution after 500 time steps tells that there is likely some other problem, here.  The solver defaults to a Newton algorithm.  If this fails to find a solution, time steps are used to get the state to a more “reasonable” starting guess / one that might be closer to the actual steady state.  After the time steps, the Newton solver is re-attempted.

I am not very familiar with the 1D and 0D tools and can’t comment much more beyond this, but there may be underlying problems with Cantera’s 1D functionality.



That said, there is no harm in trying the approach in item 1.  Just send an array of steps that has an integer > 500 somewhere in it.

Best,
Steven




——————————————————
Steven C. DeCaluwe, Ph.D | Associate Professor of Mechanical Engineering
COLORADOSCHOOLOFMINES
Brown Building W410B
Golden, CO 80401

Twitter: @CORESresearch
He / Him / His





--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/6d11ad8e-6c37-4c6a-898e-f98d326d414bn%40googlegroups.com.

Ray Speth

unread,
Sep 24, 2022, 10:53:22 PM9/24/22
to Cantera Users' Group
Hi,

The Matlab interface does not provide a way to change the maximum number of timesteps used in the 1D solver. I don't think that Steven's suggested "workaround" will dodge this limit.

I would strongly recommend using the Python package for any 1D simulations. The interface to the underlying solver there is much more feature-rich, and provides better default behaviors that tend to aid in convergence.

That said, I think in general that if the solver isn't able to converge within 500 steps, it probably won't ever converge -- that's kind of the logic behind this default value. If you can provide a complete example of the problem you're trying to solve, including the associated mechanism, we may be able to provide some suggestions. One common issue is mechanisms with non-physical rate constants.

Regards,
Ray
Reply all
Reply to author
Forward
0 new messages