Convergence error for very small volume reactor

609 views
Skip to first unread message

Carlos Felipe Forigua Rodriguez

unread,
May 27, 2014, 4:47:32 PM5/27/14
to canter...@googlegroups.com
Hi all,

I've been developing a PSR for a reactive fluid CFD code. This code uses very small control volumes  at various ranges of pressures and temperatures. This code also has dynamic mesh, so the control volumes are expected to go smaller.

With some reactors Cantera prints in the console:
"
***********************************************************************
CanteraError thrown by Phase::setDensity():
density must be positive
***********************************************************************


[CVODES ERROR]  CVode
  At t = 7.93512e-09 and h = 1.7748e-18, the error test failed repeatedly or with |h| = hmin.


***********************************************************************
CanteraError thrown by CVodesIntegrator:
 CVodes error encountered. Error code: -3
"

I decided to test the reactor apart from the CFD program and introduce the values in the code in Cantera alone and i got the same error. I tested in Chemkin with the same conditions and it worked. I tested modified examples in python and I got the same error. The error is the same even if you change the mechanism. So i decided to change the parameters of the reactor one by one and see when the error disappears. The variables are temperature, Reactor volume, Reactor pressure and fuel mass flux. These variables appear in the code as ins[0],  ins[1],  ins[2]  and  ins[4] respectively.

If you leave "Reactor volume=5.8e-2" you can change every other variable in the most absurd way and it works. But if you set "Reactor volume=5.8e-13" or even "Reactor volume=5.8e-03" it breaks. 

¿Why is this happening?


Thanks and my best regards,
Carlos
WSR_KIVA.cpp

Ray Speth

unread,
May 27, 2014, 5:46:47 PM5/27/14
to canter...@googlegroups.com
Hi Carlos,

There are two parameters here that also need to scale with the reactor volume. The first is the absolute integrator tolerance. Since the mass of the reactor's contents is one of the state variables, the absolute integrator tolerance needs to be much smaller than this. You can set the integrator tolerances using the 'setTolerances' method of the ReactorNet object. 

The second is the valve coefficient between your reactor and the outlet reservoir, which has units of kg/s/Pa. This introduces a time scale that is proportional to your reactor mass, and as this becomes very small, it causes problems for the integrator. You want to pick a value such that this time constant is small (but not too small) compared to the timescale you're actually interested in, and this should scale with the reactor volume.

Regards,
Ray

Carlos Felipe Forigua Rodriguez

unread,
Jun 3, 2014, 10:20:10 AM6/3/14
to canter...@googlegroups.com

Hi Ray,

That really works, it worked with several thousand reactors. I recommend to make the k value of the valve equal to the order of magnitude of the reactor. i.e. if you have a reactor with a volume of 4.0e-13 m3 you should make k=1.0e-13. The absolute reactor torerance its about 1e-50 or 1e-20 (same as CHEMKIN).
Thank you a lot

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