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

Merge GasKinetics into BulkKinetics and simplify rate updates #1483

Merged
merged 8 commits into from
Apr 21, 2023

Conversation

speth
Copy link
Member

@speth speth commented Apr 20, 2023

Changes proposed in this pull request

With all specializations for different reaction rate parameterizations now handled by ReactionRate classes, there is very little left in the GasKinetics class that doesn't apply to kinetics in any bulk phase. From this point, I think there should be no need to specialize BulkKinetics for the purpose of representing different thermodynamic or kinetic models -- these should be handled by the specializations of ThermoPhase and ReactionRate.

  • Move methods of GasKinetics to BulkKinetics and deprecate class GasKinetics
  • Consolidate the separate (and incorrectly named) methods used for updating rate coefficients and rates of progress into updateROP
  • Deprecate creating InterfaceKinetics objects with the reacting phase not as the first phase
  • Fix some Doxygen warnings
  • Delete some unused member variables

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 Apr 21, 2023

Codecov Report

Merging #1483 (50a5211) into main (e82f932) will decrease coverage by 0.02%.
The diff coverage is 91.57%.

@@            Coverage Diff             @@
##             main    #1483      +/-   ##
==========================================
- Coverage   70.14%   70.12%   -0.02%     
==========================================
  Files         377      376       -1     
  Lines       58002    57977      -25     
  Branches    19422    19429       +7     
==========================================
- Hits        40687    40658      -29     
- Misses      14754    14755       +1     
- Partials     2561     2564       +3     
Impacted Files Coverage Δ
include/cantera/base/ExtensionManager.h 27.27% <ø> (ø)
include/cantera/base/SolutionArray.h 94.44% <ø> (ø)
include/cantera/kinetics/Arrhenius.h 90.00% <ø> (ø)
include/cantera/kinetics/InterfaceKinetics.h 87.50% <ø> (ø)
include/cantera/transport/GasTransport.h 100.00% <ø> (ø)
include/cantera/transport/MultiTransport.h 50.00% <ø> (ø)
interfaces/cython/cantera/kinetics.pyx 90.51% <ø> (-0.44%) ⬇️
interfaces/cython/cantera/reaction.pyx 82.19% <ø> (+0.52%) ⬆️
samples/cxx/flamespeed/flamespeed.cpp 83.89% <ø> (ø)
samples/f77/demo_ftnlib.cpp 51.85% <ø> (ø)
... and 8 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@ischoegl ischoegl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@speth … thanks for implementing these simplifications (I recall you hinting at wanting to do this for a while). I have only minor comments.

@@ -82,10 +82,12 @@ unique_ptr<Kinetics> newKinetics(const std::vector<ThermoPhase*>& phases,
* the reactions occur. Searches the Cantera data for this file.
* @param phase_name The name of the reacting phase in the input file (that is, the
* name of the first phase in the `phases` vector)
* @deprecated The 'phase_name' argument is deprecated and will be removed after
* Cantera 3.1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment about the new behavior?

src/kinetics/KineticsFactory.cpp Show resolved Hide resolved
if (phase_name != "" && phase_name != phases.at(0)->name()) {
warn_deprecated("newKinetics", "The reacting phase must be the first phase in "
"the 'phases' vector. Remove the 'phase_name' argument to use the first "
" phase by default. This warning will be an error after Cantera 3.0. ");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn’t the parameter removed after Cantera 3.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phase_name parameter is gone, but having the reacting phase not in first position will raise an exception from Kinetics::addThermo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was puzzled by "this warning will be an error", as the clause would have to go somewhere else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think I was making this part too complicated -- the phase_name parameter can be deprecated immediately. Specifying the first phase's name to newKinetics can issue a warning, and having the reacting phase in a different order will issue a warning from Kinetics::addThermo.

@speth speth force-pushed the deprecate-gaskinetics branch 3 times, most recently from a408283 to d388e95 Compare April 21, 2023 18:39
Copy link
Member

@ischoegl ischoegl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - looks good to me!

@ischoegl ischoegl merged commit da34f8f into Cantera:main Apr 21, 2023
@speth speth deleted the deprecate-gaskinetics branch April 22, 2023 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants