-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Non-ideal capabilities for 1-D flame model #1079
Conversation
@gkogekar - If you can, please undo the merge commit and rebase this onto the current |
Codecov Report
@@ Coverage Diff @@
## main #1079 +/- ##
==========================================
+ Coverage 70.44% 70.46% +0.02%
==========================================
Files 375 375
Lines 58401 58405 +4
Branches 20897 20899 +2
==========================================
+ Hits 41142 41158 +16
+ Misses 14238 14227 -11
+ Partials 3021 3020 -1
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks @gkogekar, I just saw this was ready for review. It looks like there aren't any cases tested where you might expect to see some effect of the non-ideal EOS, can you please add something? Similarly, the difference with the existing results is somewhat concerning to me. Things are changing in the third and fourth decimal place, (although I don't have a good sense for how much change would be expected). I guess I'm surprised there's so much difference by swapping the enthalpy for the temperature. Can you comment? Can you do a comparison of a simple calculation in the zero-D case to get a sense for how much difference to expect? |
Thanks, @bryanwweber. I had derived the energy equation for non-ideal EoS (the document is attached above). But we decided to move forward with the finite difference approach (I don't exactly remember why. ) In this implementation, the enthalpy flux is calculated based on a first order finite differencing, as opposed to exact calculation of Cp value in case of ideal gas EoS. So the difference in the results is bound to happen depending on the grid size. I am creating this PR as many people on the user group have asked for this functionality. But I haven't found any particular test case that will show the non-ideal effects. Since we are modeling flames (i.e. high temperatures), the gas-phase is always near ideal condition. Nonetheless, I will create a test case using a non-ideal EoS. |
Thanks @gkogekar! I think the finite difference makes sense when we don't know anything about the underlying phase, but I wonder if there's room to allow the evaluation to specialize, analogous to As far as examples, I agree that under high-temperature (combustion) conditions, it's really unlikely to see a difference here. That'd be a reasonable test case anyways, if you compare to the ideal gas result. You can also consider something like high-pressure catalysis against a surface, a liquid flow, or something like that. |
d51cd9c
to
e0c0768
Compare
@bryanwweber Thanks for your insights. Retrieving the I will add the test for non-ideal EoS soon. |
Thanks @gkogekar this is a really nice solution, I didn't think it was possible but I'm glad it is! Definitely not something to do here, but I wonder if it makes sense to eliminate some of the class hierarchy in reactors... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for introducing this PR, @gkogekar. Overall, I think it shows that there isn't all that much required to handle the non-ideal phases in the 1D flame model. Besides the in-line comments below, there are couple of things needed for this PR:
- Please eliminate the change to the
googletest
submodule - I think we need at least a minimal test case for this. I guess that will require adding an input file that has both transport properties and Redlich-Kwong or Peng-Robinson (or critical states) parameters, which I think we currently lack.
- A Python example would be nice as well. I don't know what conditions would actually show an effect from the nonideality.
- The "science" section of the Cantera website will need to be updated as well. I think for posterity, it would be nice to have a simpler derivation of the equations somewhere. The attached PDF is useful, but it has a lot of digressions and dead ends that aren't really necessary.
Hi @gkogekar ... thanks for updating this PR. Unfortunately, it seems like #1452 introduced a couple of minor merge conflicts since the latest rebase. Apart from this, #1448 introduced a couple of changes that should make the Python side quite a bit easier. Would you mind rebasing so this can be pushed over the finishing line? I'd be happy to assist in case you're facing any hurdles. |
@ischoegl Thanks for letting me know. I will rebase and resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gkogekar ... thank you for the rebase, and for taking care of most of the review comments!
Apart from some minor comments for code style guidelines I left below, there currently are some issues with the test suite. As they're consistent across platforms, you can likely reproduce them locally?
*********************************** Testing Summary ************************************
FAILED: One or more tests failed.
Tests passed: 3447
Up-to-date tests skipped: 0
Tests failed: 301
scons: *** [test_results] Explicit exit, status 1
Failed tests:
- clib.passed ***no results for entire test suite***
- oneD.passed ***no results for entire test suite***
- python ***no results for entire test suite***
- cxx-flamespeed
****************************************************************************************
Thanks, @ischoegl. I have taken care of most of the failures from the test suite. But one test ( |
Please don't introduce the merge commit by using With your branch checked out, and with all uncommitted changes stashed or committed (or else they will be lost), you should:
|
The term (cp_k*dT/dt) in the energy equation is replaced by (dh_k/dt).
Cantera 3.0 introduces small changes for onedim calculations; as benchmark files were generated with Cantera 2.6, tolerances need to be relaxed.
Apologies for that. I am still not getting used to Git advanced commands. Anyway, I have corrected it and also rebased the code with the latest Cantera build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @gkogekar, this looks good to me. With this completed, could you also open a PR for the cantera-website
repository to document the updated 1D flame governing equations?
Changes proposed in this pull request
Add non-ideal capabilities to the existing Flame models. Currently, the flame models utilize only ideal gas phase. There has been some discussion in the user group and the feature request (Cantera/enhancements#109) to include 1-D supercritical features in the Flame code. This pull request implements the real-gas flame models (R-K EoS, P-R EoS) along with the modified transport.
StFlow
class to include real-gas thermophases (Redlich-Kwong, Peng-Robinson EoS)References
Cantera/enhancements#109
Theory Document
Non_ideal_Flame_equations.pdf