-
-
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
Add Blowers Masel reaction to GasKinetics and InterfaceKinetics #987
Conversation
Codecov Report
@@ Coverage Diff @@
## main #987 +/- ##
==========================================
+ Coverage 72.39% 72.52% +0.12%
==========================================
Files 364 364
Lines 46433 46744 +311
==========================================
+ Hits 33616 33900 +284
- Misses 12817 12844 +27
Continue to review full report at Codecov.
|
Thanks. As noted in Cantera/enhancements#66...
|
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 submitting this PR, @12Chao. Can you please rebase this on to the current main
branch? The recent PR #982 made some changes to reaction handling that have generated some conflicts that need to be resolved.
Overall, I think this looks like it's in pretty good shape, and I appreciate the comprehensive set of tests included.
As far as the interaction with the changes in #982 go, I think there are some things that will need to be changed in order for this to work correctly (i.e. the code for wrapping Reaction
objects in Python. There is an opportunity to simplify some of the implementation of these reaction types and how they interact with the GasKinetics
class using the new structure introduced in #982, but it might be simpler to merge this using the old style and pursue that update as a separate PR.
In addition to the specific comments below, please go through your commits and eliminate the changes that remove the end-of-file newline in several files, and changes that introduce trailing whitespace. If you haven't already, I would highly recommend configuring your editor to highlight whitespace at the end of lines so you can avoid introducing such changes.
As the one to 'blame' for #982, I tend to agree that it would make sense to finish this PR using the old style and update in a separate PR. I am currently working through the 'basic' reactions in #995, which - once done - should provide good templates for how things can be ported. As long as everything is locked in properly with unit tests, an eventual conversion should be relatively straight-forward. |
Thanks for the review @speth, @bryanwweber and @ischoegl! I believe I have addressed most of the comments. The only one left is how to make the |
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.
Hi @12Chao, thanks for making these updates to your PR. Besides the specific comments below, I had a couple of other requests:
- Please add yourself to the AUTHORS file
- Regarding the code duplication you noted in
InterfaceKinetics::buildBMSurfaceArrhenius
, can you
just add a comment starting with//! @todo
there, and briefly mention that this could potentially be refactored to reduce code duplication, with the challenge being that the two methods end up returning slightly different object types. I think as we adopt the new Reaction framework from Make reactions extendable #982 in the InterfaceKinetics class, the opportunity to refactor this will become apparent, so I'm not in a rush to do it now. - Can you write a Python example that uses the Blowers-Masel rate type that might help users understand how this is useful? Maybe an example drawn from the original B-M paper could be an option.
Thanks for the review @speth! I have addressed all the comments and working on the Python example about Blowers-Masel approximation. |
Hi @speth. We're discussing several usage examples, but all our meaningful ideas involve a decent amount of work, and will probably lead to a paper. Can I suggest we don't hold up this pull request until they're ready, else we'll forever be rebasing it and fixing merge conflicts? We'll definitely add examples to the examples repository as part of that work, which is the next thing that we'll work on, so I don't think it'll get forgotten. |
bc19059
to
55e10c6
Compare
The CI on Windows and macOS are failing due to some upstream failures, not your fault. Regarding 55e10c6, if you make it a raw string, it will work out. |
@bryanwweber Thanks for the help! |
@12Chao In Python, a raw string is prefixed with plt.title(r"Ea versus $\Delta H$ For O+H2<=>H+OH", y=1.1) You can also escape the backslash (which is usually used to give control characters like plt.title("Ea versus $\\Delta H$ For O+H2<=>H+OH", y=1.1) |
2492d05
to
572fc75
Compare
Thanks for all the work on this, @12Chao. I'm looking forward to seeing the more interesting use cases for this model. Will you be able to open the companion PR for on the website repo to update the "Science" docs soon? I think what you wrote in the class docstrings here is already a good start for that. @Cantera/committers - Since the last commit here is mine (modifying the example), I'd like someone else's approval before merging. |
Your last two commits look good to me. |
Further updates: I fixed the conflicts that were introduced by merging #984, and added the methods necessary to enable serialization of B-M rates. Also thought this was a reasonable time to advance the alpha version number. |
I will take a look, but IIRC--we decided that the website needs at least a PR before merging codebase changes--is that correct? |
Thanks for all the feedbacks, I will add a PR on the website ASAP |
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.
Hi @12Chao -- very nice work! I have a few very minor comments, below, but nothing that shouldn't prevent this from being merged very soon. I appreciate all the thought and detail that went into this.
k2 = surf.forward_rate_constants[0] | ||
surf.coverages = 'O(S):0.2, PT(S):0.6, H(S):0.2' | ||
k3 = surf.forward_rate_constants[0] | ||
self.assertNotAlmostEqual(k1, k2) |
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.
Is there a way to use the theory to figure out what their ratio should be so that we could use an assertNear
test, here? I'll admit I'm not familiar with how assertNotAlmostEqual
works, but my naive sense is that it is not a equality test of any sort. Apologies if I'm wrong, there...
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.
According to the python doc , assertNotAlmostEqual
compares the difference between 2 numbers which are rounded to 7 decimal places by default to zero, the assertion is true if the difference is not approximately equal to zero. I am not sure about how to modify the code here because I basically just copied test_modify_interface
.
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.
I think @decaluwe's point is that it's possible to know how different k1 and k2 should be, so you can do a much more meaningful test than just checking that the numbers aren't the same. In this particular case, they should differ by the ratio exp( delta_theta * E_k / RT )
.
Thanks for the review @decaluwe, I have resolved most of the comments, except the one about |
This commit inclues Blowers Masel rate class and Blowers Masel reaction class, which are aimed to be used in GasKinetics. The changes are implemented in both C++ and Python/Cython interfaces.
The C++ test is only for Blowers Masel rate test, and the tests in Python interface are for both the reaction and rate classes. Two minimal yaml files are added as the input file for the tests
reaction rate classes in InterfaceKinetics The changes are made in both C++ and Cython interfaces.
reaction and reaction rates classes The tests are added in both C++ and Python interfaces. Two minimal yaml files are included for the tests.
…ut surface in the surface phase in yaml file
… type of Blowers-Masel reaction rates
Create a shorter leading paragraph which will be shown in the index of examples on the website. Document the dependencies. Modify plot formatting slightly and display them before the script exits.
before and after change the coverage dependencies
Thanks for the help @speth ! I have resolved the comment. |
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, @12Chao! This looks good to me.
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.
Very nice work, @12Chao !
Changes proposed in this pull request
If applicable, fill in the issue number this pull request is fixing
Fixes 66
Checklist
scons build
&scons test
) and unit tests address code coverage