-
-
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
Fix issues for undeclared third-bodies and implicit third-body reactions #1588
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1588 +/- ##
==========================================
- Coverage 70.60% 70.60% -0.01%
==========================================
Files 379 379
Lines 59144 59164 +20
Branches 21252 21263 +11
==========================================
+ Hits 41760 41770 +10
- Misses 14311 14320 +9
- Partials 3073 3074 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
87937e3
to
82d1487
Compare
8bb4842
to
f417cc7
Compare
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, @ischoegl. I think this mostly makes sense, with one caveat.
Namely, I think that attempting to add a reaction like 2 H + CO2 <=> H2 + CO2
to a phase that doesn't contain CO2
using the Solution
"from parts" constructor should not be treated as an error. The traditional behavior of the Solution
constructor has been to automatically skip unknown third bodies, and it shouldn't matter whether or not that the unknown species is the only valid third body for a reaction.
In part, this behavior is because we don't currently provide a way for the user to specify that unknown 3rd bodies should be skipped when using this constructor. But more importantly, it's because when constructing a mechanism directly from an input file, it's much more likely that an unknown species is typo that should be detected as an error, whereas when working with Reaction
objects, I think it's more likely that an unknown species is intentionally not part of the phase definition, and it's easier to have Cantera skip it than make the user do the additional filtering.
Fix typo - logic used wrong method name
f417cc7
to
5834839
Compare
Thanks for the comments, @speth!
The traditional treatment of this was to not detect explicit 3rd body colliders, which means that these species show up in product/reactant maps and thus these reactions were not included.
|
5834839
to
819da33
Compare
Nevermind. I removed the |
819da33
to
884565b
Compare
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, @ischoegl. These updates look good to me. Feel free to merge once the CI passes.
Changes proposed in this pull request
Fix a series of bugs and edge cases that involve undeclared third-body colliders and/or implicitly defined third-body reactions.
skip-undeclared-third-bodies
to serialization (see Unable to load serialized mechanism where reactions contain undeclared third bodies #1403)Solution
from scratchsamples/python/kinetics/extract_submechanism.py
sample, where reaction list included invalid reactionsReaction
objects are created from reactant/productComposition
, where several invalid combinations were not caught (also, implicit third-bodies were not implemented correctly).Reaction.reactants/products
setter in Python, as they allow for undefined behaviorIf applicable, fill in the issue number this pull request is fixing
Closes #1403
Closes #1587
If applicable, provide an example illustrating new features this pull request is introducing
Checklist
scons build
&scons test
) and unit tests address code coverage