Skip to content
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

Proof-of-concept: Modify reaction rates in memory #1051

Closed
wants to merge 6 commits into from

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Jun 8, 2021

Changes proposed in this pull request

This PR builds on #995 (and will be rebased once #995 is merged, i.e. 80ish commits are not specific to this PR).

  • Allow for modifications of rate parameters without having to 'modify' reactions
  • Proof-of-concept implemented for ArrheniusRate

Addresses Cantera/enhancements#87.

If applicable, provide an example illustrating new features this pull request is introducing

In [1]: import cantera as ct
   ...: rxn = gas.reaction(0)
   ...: rxn
Out[1]: <ElementaryReaction: H2 + O <=> H + OH>

In [2]: gas.forward_rate_constants
Out[2]: 
array([5.19544737e+03, 1.34865000e+07, 2.55079922e+09, 4.25372812e+01,
       5.48180502e+06, 0.00000000e+00, 3.00385071e-09, 3.82748853e+09,
       5.81796100e+17, 1.93894637e+14, 9.91318424e+06])

In [3]: A = rxn.rate.pre_exponential_factor
   ...: A
Out[3]: 38.7

In [4]: rxn.rate.pre_exponential_factor = 2 * A
   ...: gas.reaction(0).rate.pre_exponential_factor
Out[4]: 77.4000015258789

In [5]: gas.forward_rate_constants
Out[5]: 
array([1.03908950e+04, 1.34865000e+07, 2.55079922e+09, 4.25372812e+01,
       5.48180502e+06, 0.00000000e+00, 3.00385071e-09, 3.82748853e+09,
       5.81796100e+17, 1.93894637e+14, 9.91318424e+06])

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #1051 (602111b) into main (ec85c24) will decrease coverage by 0.24%.
The diff coverage is 69.41%.

❗ Current head 602111b differs from pull request most recent head 2e73274. Consider uploading reports for the commit 2e73274 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1051      +/-   ##
==========================================
- Coverage   65.35%   65.10%   -0.25%     
==========================================
  Files         315      315              
  Lines       45995    45320     -675     
  Branches    19531    19257     -274     
==========================================
- Hits        30060    29507     -553     
+ Misses      13443    13343     -100     
+ Partials     2492     2470      -22     
Impacted Files Coverage Δ
include/cantera/kinetics/MultiRateBase.h 100.00% <ø> (ø)
include/cantera/kinetics/MultiRate.h 67.79% <51.72%> (-14.23%) ⬇️
src/kinetics/Arrhenius.cpp 90.47% <55.55%> (+0.05%) ⬆️
include/cantera/kinetics/Arrhenius.h 94.36% <60.00%> (-5.64%) ⬇️
include/cantera/kinetics/RxnRates.h 82.84% <75.00%> (ø)
src/kinetics/BulkKinetics.cpp 88.52% <83.33%> (ø)
include/cantera/kinetics/Custom.h 85.71% <100.00%> (ø)
include/cantera/kinetics/Falloff.h 77.98% <100.00%> (ø)
include/cantera/kinetics/ReactionRate.h 90.19% <100.00%> (+3.70%) ⬆️
src/kinetics/GasKinetics.cpp 84.65% <0.00%> (-4.35%) ⬇️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec85c24...2e73274. Read the comment docs.

@ischoegl ischoegl force-pushed the modify-rates-in-memory branch 2 times, most recently from 81a7d90 to 1c56d0a Compare June 12, 2021 15:52
@ischoegl ischoegl marked this pull request as ready for review June 12, 2021 16:09
@ischoegl ischoegl requested a review from a team June 12, 2021 16:09
@ischoegl

This comment has been minimized.

@ischoegl
Copy link
Member Author

ischoegl commented Aug 6, 2021

Setting this back to draft as it will require rebasing due to merge conflicts with #1061

@ischoegl
Copy link
Member Author

As anticipated, the PR now has merge conflicts after #1061 was merged (which curiously don't show up here). I moved 'easy' modifications to #1088, as the rest will likely require some discussion.

@ischoegl ischoegl mentioned this pull request Oct 14, 2021
5 tasks
@ischoegl ischoegl force-pushed the modify-rates-in-memory branch 2 times, most recently from 602111b to 13f8d29 Compare January 6, 2022 21:32
@ischoegl ischoegl changed the title Modify reaction rates in memory (new framework only) Proof-of-concept: Modify reaction rates in memory Jan 6, 2022
@ischoegl ischoegl marked this pull request as ready for review January 6, 2022 22:22
@ischoegl
Copy link
Member Author

ischoegl commented Jan 6, 2022

@speth ... I rebased the PR now that major updates based on #1101 are settling down. At the moment, modifications are only implemented for ArrheniusRate.

@ischoegl ischoegl marked this pull request as draft January 14, 2022 18:14
@ischoegl ischoegl marked this pull request as ready for review January 15, 2022 03:26
@ischoegl
Copy link
Member Author

Closing as this feature is likely premature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant