convergence error in Reactor::updateState for very specific initial temperature

828 views
Skip to first unread message

Kyle Niemeyer

unread,
May 27, 2014, 3:14:40 PM5/27/14
to canter...@googlegroups.com
Hello all,

I'm running into a strange error while trying to perform autoignition delay calculations (see the attached ignitionDriver.cpp code)—essentially, using a Reactor or ConstPressureReactor and integrating.

Using the attached mechanism, I get this error message immediately (seems to be occuring at t = 0 sec) for particular initial conditions:
***********************************************************************
CanteraError thrown by Reactor::updateState:
no convergence
U/m = 441051
T = 1000
rho = 0.367888
***********************************************************************

...(this is repeated a number of times)....

[CVODES ERROR]  CVode
  At t = 0 repeated recoverable right-hand side function errors.
terminate called after throwing an instance of 'Cantera::CVodesErr'
  what():
***********************************************************************
CanteraError thrown by CVodesIntegrator:
 CVodes error encountered. Error code: -10
Components with largest weighted error estimates:
313: 3.82476e+12
307: 2.3877e+12
78: 1.80132e+12
59: 1.56246e+12
387: 4.51253e+11
396: 2.4479e+11
397: 2.44787e+11
53: 2.288e+11
398: 1.22394e+11
51: 7.97068e+10
***********************************************************************
The weird part is that this seems to only happen for specific initial conditions: my input is a stoichiometric n-heptane and air mixture at 1 atm and 1000 K. If I change the initial temperature to 1000.01, it integrates without error.

Interestingly, this only seems to happen for constant volume (using a standard Reactor object); constant pressure (ConstPressureReactor) works fine for these initial conditions.

Also, if I use IdealGasReactor (after including "cantera/zeroD/IdealGasReactor.h"), the error also goes away.

Is this a bug with my constant volume implementation using Reactor, or something in Cantera? I can just switch to using IdealGasReactor, but it seems something is going on here.

Thanks!
Haas_TRF+EtOH.xml
ignitionDriver.cpp
input.txt

Ray Speth

unread,
May 27, 2014, 4:22:14 PM5/27/14
to canter...@googlegroups.com
Hi Kyle,

I would recommend always using IdealGasReactor and IdealGasConstPressureReactor. I implemented these models with temperature and pressure as the independent variables specifically to avoid the kind of problems you are seeing with the old Reactor class. I think you'll also find integration using the ideal gas reactor models to be faster, especially with larger mechanism, as CVODES is able to generate a better Jacobian when the the state can be set explicitly instead of needing to iterate to find the temperature at which the internal energy has the desired value.

Also, I would suggest taking a look at CanSen, a SENKIN wrapper for Cantera written by Bryan Weber, which might be easier to use as a starting point than writing your own wrapper in C++.

Regards,
Ray

Kyle Niemeyer

unread,
May 27, 2014, 4:34:02 PM5/27/14
to canter...@googlegroups.com
Thanks Ray, I'll keep that in mind.

I wasn't aware of Bryan's wrapper—it looks like his has more features (especially related to postprocessing) and is focused on a single case at a time. In my situation, I usually need to run a large number of initial conditions, and so my code uses OpenMP to integrate multiple ignition delay cases simultaneously. It's actually based on a similar "SENKIN-like" code I wrote in Fortran using DVODE for integration.

Bryan W. Weber

unread,
May 28, 2014, 9:05:12 AM5/28/14
to canter...@googlegroups.com
Kyle,

You should be able to wrap my code in a Python multi-processor. It may take some modification of the source code, but since each run of the CanSen driver initializes a new instance of a Reactor, it should be embarrassingly parallel and not too hard to set up. If you have any questions, you can shoot me an email or post an issue on the Github issue tracker. If you do end up using it, you should check the issue tracker to make sure that some of the things I haven't fixed yet aren't going to be a problem for you...

Bryan
Reply all
Reply to author
Forward
0 new messages