-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in reaction rate calculation #1273
Comments
@NickJCSQ ... thank you for filing this issue report. While CHEMKIN II is rather dated, more recent CHEMKIN manuals still use the same equation. Please note that Cantera's code generally follows Kee, Coltrin and Glarborg, 'Chemically Reacting Flow', Wiley Interscience, 2003 (there's also a newer version of that text), where the equation is 9.91. Looking over the source code, I am actually not sure that Cantera is even using that expression? So it would be helpful if you could be more specific about where you suspect an error - please include Cantera version, as well as file and line number(s). (Note that I edited this post after looking up some references.) |
To aid discussion: the question appears to be about the calculation of the equilibrium constant. For Cantera's implementation, the docstring is cantera/include/cantera/kinetics/Kinetics.h Lines 372 to 384 in 2bc0263
where - for the case of GasKinetics - the actual code is cantera/src/kinetics/GasKinetics.cpp Lines 188 to 202 in 2bc0263
|
I believe I am currently using cantera version 2.4. I did not make the installation and I do not know where to find the version of the software, please let me know how to check it. I have not found any open source version of the documents mentioned, so I cannot check their contents. The exact function where I find the difference is Cantera::Kinetics::getRevRateConstants. Looking at the provided code snippet for the equilibrium constant calculation it seams that it calculates Kpi but does not take into account the term result of the molar difference between products and reactants, but I could be mistaken since it is not the same formula that I am using. The formula I am using for Kp is Kp[i] = exp(dS/R - dH/(RT)) which seams quite similar to the one provided for Kc[i] in the snippet. My integration strictly follows the formulas from the CHEMKIN manual. |
This version is two-versions out-of-date, please update if you can. You can write In addition, please include a minimal, complete, verifiable example code with your report. Otherwise, we have absolutely no chance of seeing what is really going on here. |
Although it would really help to have a complete example, I think you might be running into Cantera's confusing definition of "standard state". Despite the name cantera/include/cantera/thermo/ThermoPhase.h Lines 564 to 574 in e5122f0
and you can see that the calculation for the ideal gas phase does indeed include the pressure dependence: cantera/src/thermo/IdealGasPhase.cpp Lines 61 to 69 in e5122f0
The only contribution to the full chemical potentials that is not included here is the composition dependence. The end result of all this is that Cantera's calculation of the reverse reaction rates is correct. One way you can see this is by equilibrating the mixture (the equilibrium code is independent and does not use We've discussed this before (see #841) but not come to a satisfactory resolution. |
Description:
In the formula that calculates the value Kci (following CHEMKIN's notation) cantera uses the pressure of the mixture instead of 1 atm, which is what should be used (according to CHEMKIN's documentation, which cantera says it is based on). The formula used by cantera is Kci = Kpi * (P/(R*T))^(sum(vki)) whilst it sould use Patm instead of P (with Patm = 1 atm). At the end of this post I have attached the documentation.
How I found this error:
I was writing my own code in order to calculate the reaction rates of a mixture. To validate it I was comparing it to the solutions given by cantera. All intermidiate values of my code lined up but I could not manage to get the final solution just right. After much testing I found the mentioned error. If I changed the value of 1atm to the pressure of the mixture my results lined up perfectly with cantera's (all significant figures).
The error caused by this difference in the reaction rates is not much, the first 4 to 5 significant figures were the same in my code and cantera for the examples tested; this is due to the little significance of the terms affected by the formula in the example used. As I said, since changing this formula makes my code completely coincide with cantera's there are no other external factors and the difference must be located in said formula.
Documentation which I followed:
I attach CHEMKIN's documentation, where one can find said formula and where it is explicitely said that the pressure should be 1atm. As I mentioned before, cantera says in its webpage that it follows said documentation. The formula is numbered 54 in page 21.
ChemKin II Fortran theory.pdf
Please let me know if there has been any misconception from my part.
The text was updated successfully, but these errors were encountered: