Accuracy/Robustness of derivatives with "Warning" labels

71 views
Skip to first unread message

Rayhan Walia

unread,
Apr 14, 2025, 9:44:26 AM4/14/25
to Cantera Users' Group
Hey guys, 
I am currently on Cantera v2.6.0 and am computing the derivatives of species net production rates with respect to species molar fractions, i.e., "netProductionRates_ddX()".

Looking over the documentation on the website, it mentions a Warning message, an image of which I have attached below. Briefly, it mentions that this derivative is an experimental part of the Cantera API. I simply wonder to what extent is it "experimental". 

For context, I am using the "gri30" mechanism and testing the derivative via comparison to a finite difference jacobian*. For most values they are similar, but for others they are factors of 2-5 apart.

It would be extremely helpful for someone to help clear this up for me. Thank you to anyone who may be able to provide help!

Best,
Ray

* : I can go into further detail about the construction of this jacobian if necessary, but am primarily concerned with the "experimental" nature of this derivative.
Screenshot 2025-04-10 at 2.46.35 PM.png

Ray Speth

unread,
May 28, 2025, 9:23:24 AM5/28/25
to Cantera Users' Group

Hi Ray,

The “experimental” warning about the derivatives, as with other functions labeled as “experimental” in Cantera, is really about the stability of the API. We add this caution in cases where we haven’t necessarily settled on function names / signatures. These derivative calculations are evaluated pretty thoroughly as part of Cantera’s test suite, and I don’t believe there are any reported errors relating to these quantities.

Regarding discrepancies, I would expect the derivatives returned by netProductionRates_ddX to be more accurate than anything you can get by finite difference. Besides things like cancellation errors, it is important to note that you can’t quite compute the same partial derivative returned by this method using finite differences. As described in the docstring, netProductionRates_ddX provides derivatives with T, P, molar concentration, and other mole fractions held constant. But if you’re taking finite differences, you can’t quite do this because of the constraints imposed by the equation of state. You would need to combine a couple of the available derivatives to get a quantity that’s equivalent to what you get from a finite difference approach. You can get a lot closer with a finite difference approach by setting the state using “unnormalized” mole fractions.

Regards,
Ray

Reply all
Reply to author
Forward
0 new messages