-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Customizable data objects for ExtensibleRate #1417
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1417 +/- ##
==========================================
- Coverage 70.84% 70.75% -0.10%
==========================================
Files 376 378 +2
Lines 54784 55117 +333
Branches 18137 18158 +21
==========================================
+ Hits 38813 38996 +183
- Misses 13506 13612 +106
- Partials 2465 2509 +44
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
b0bbddd
to
bf11a4c
Compare
I'm not sure what's going on with code coverage here. The deltas shown in Codecov seem to be all over the place for several recent PRs (for example, #1413) that should have had almost no changes, and in this case, I see lines/functions being showed as uncovered (such as |
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.
@speth ... thank you for your continued work on extensible objects! (and sorry about false starts for this review.) The implementation itself looks good to me, but I have some (minor?) comments, which will hopefully improve the user experience. It is to be expected that users will create buggy extensions, where improved exception handling will give valuable feedback.
On a separate note, it turns out that the simplistic CustomRate
is about twice as fast as ExtensibleRate
:
%run custom_reactions.py
Average time of 100 simulation runs for 'gri30.yaml' (CH4)
- New framework (YAML): 18.44 μs/step (T_final=2780.21)
- Two Custom reactions: 18.86 μs/step (T_final=2780.21) ...+2.29%
- Two Extensible reactions: 19.43 μs/step (T_final=2780.21) ...+5.37%
There is likely little that can be done about this (ExtensibleRate/ExtensibleRateData
is extremely flexible and can be serialized); at the same time, I was hoping that CustomRate
could be deprecated in favor of ExtensibleRate
. What's your opinion here?
Much of the difference between cases was coming from taking different numbers of timesteps based on small rounding errors. Running over a range of different initial conditions and calculating stats on a "per timestep" basis helps isolate the effect of the user-defined reactions.
Fixes a regression introduced in 0958f7c.
889119e
to
a302610
Compare
In terms of performance, the sample problem doesn't tell the whole story. Both I would say that the decision on whether to keep I have a few ideas on how to improve the performance of these Python rates, but those are definitely for a later PR. |
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.
@speth ... thanks for taking care of the improved exception handling, which I believe will go a long way.
PS: I also appreciate your thoughts on performance.
@ischoegl, can you re-approve? My fiddling around to clear up some unrelated CI issues cleared your previous approval. |
Changes proposed in this pull request
This PR introduces
ExtensibleRateData
class that is used for collecting state data and being passed as the argument to theeval
method ofExtensibleRate
objects, analogous to the C++ implementation of reaction rates.This is the first follow-up to #1382, and contributes to the implementation of Cantera/enhancements#79.
If applicable, provide an example illustrating new features this pull request is introducing
The implementation of an
ExtensibleRate
now looks like the following (fromcustom_reactions.py
):Checklist
scons build
&scons test
) and unit tests address code coverage