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

Exposing getDeltaEnthalpies to Matlab interface. #659

Merged
merged 1 commit into from
Jun 27, 2019

Conversation

decaluwe
Copy link
Member

The general intent here was to enable calculating reaction enthalpies in the Matlab toolbox, as part of the li-ion battery simulations in PR #563.

This required several changes:

  • Create getDeltaEnthalpies.m in Matlab toolbox/@kinetics
  • Add kin_getDelta to kineticsmethods.cpp. Note that this can be easily extended to create other functions in the matlab Kinetics toolbox (see the other fucntions listed in kin_getDelta in src/clib/ct.cpp).
  • Add getPartialMolarEnthalpies to metalPhase class (it returns all zeros).

Copy link
Member

@bryanwweber bryanwweber left a comment

Choose a reason for hiding this comment

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

Seems fine, some typos to fix though 😃

interfaces/matlab/toolbox/@Kinetics/getDeltaEnthalpies.m Outdated Show resolved Hide resolved
interfaces/matlab/toolbox/@Kinetics/getDeltaEnthalpies.m Outdated Show resolved Hide resolved
interfaces/matlab/toolbox/@Kinetics/getDeltaEnthalpies.m Outdated Show resolved Hide resolved
interfaces/matlab/toolbox/@Kinetics/getDeltaEnthalpies.m Outdated Show resolved Hide resolved
src/matlab/kineticsmethods.cpp Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 25, 2019

Codecov Report

Merging #659 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #659      +/-   ##
==========================================
- Coverage   68.49%   68.49%   -0.01%     
==========================================
  Files         368      368              
  Lines       40027    40030       +3     
==========================================
+ Hits        27418    27419       +1     
- Misses      12609    12611       +2
Impacted Files Coverage Δ
include/cantera/thermo/MetalPhase.h 43.47% <0%> (-3.04%) ⬇️
src/transport/GasTransport.cpp 90.98% <0%> (+0.2%) ⬆️

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 444ef91...d676b9a. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 26, 2019

Codecov Report

Merging #659 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #659      +/-   ##
==========================================
- Coverage   70.78%   70.78%   -0.01%     
==========================================
  Files         373      373              
  Lines       43447    43450       +3     
==========================================
  Hits        30754    30754              
- Misses      12693    12696       +3
Impacted Files Coverage Δ
include/cantera/thermo/MetalPhase.h 52.94% <0%> (-3.31%) ⬇️

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 ae792dd...3bc64ef. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 26, 2019

Codecov Report

Merging #659 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #659      +/-   ##
==========================================
- Coverage   70.78%   70.78%   -0.01%     
==========================================
  Files         373      373              
  Lines       43451    43450       -1     
==========================================
- Hits        30758    30754       -4     
- Misses      12693    12696       +3
Impacted Files Coverage Δ
include/cantera/thermo/MetalPhase.h 52.94% <0%> (-3.31%) ⬇️
src/zeroD/ReactorBase.cpp 71.42% <0%> (-1.13%) ⬇️
src/zeroD/ConstPressureReactor.cpp 65.82% <0%> (-0.85%) ⬇️
src/zeroD/Reactor.cpp 84.29% <0%> (-0.24%) ⬇️
src/zeroD/IdealGasConstPressureReactor.cpp 81.94% <0%> (ø) ⬆️
src/transport/GasTransport.cpp 90.58% <0%> (ø) ⬆️
src/zeroD/IdealGasReactor.cpp 88.75% <0%> (+0.14%) ⬆️
src/thermo/ThermoPhase.cpp 68.05% <0%> (+0.16%) ⬆️

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 8502d18...e90da55. Read the comment docs.

% reaction. Units: J/kmol-K
%

dH = kinetics_get(a.id, 17, 2);
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I know I already approved this, but this should probably be dS and the Gibbs should probably be dG

Copy link
Member

Choose a reason for hiding this comment

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

I was about to make the same request! 😁

Copy link
Member Author

Choose a reason for hiding this comment

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

You guys are so rigid in your style preferences. :)

Fixed now - thanks for the catch!

The general intent here was to enable calculating reaction enthalpies in the
Matlab toolbox, as part of the li-ion battery simulations in PR Cantera#563.

This required several changes:

- Create getDeltaEnthalpies.m in Matlab toolbox/@kinetics, as well as similar
methods for Gibbs free energy and entropy of reaction
- Add kin_getDelta to kineticsmethods.cpp.
- Add getPartialMolarEnthalpies to metalPhase class (it returns all zeros).

Note that similar methods are not enabled for the corresponding
'Standard State' methods, for the time being.  Mainly because it is
difficult for me to envision a significant use case, but also because of
some lingering confusion between 'standard' and 'reference' states in
Cantera's codebase.
@speth speth merged commit 2d2004d into Cantera:master Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants