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

WIP - Update electrochemical reaction type input for BV and Marcus kinetics #1416

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

korffdm
Copy link

@korffdm korffdm commented Dec 19, 2022

Changes proposed in this pull request

  • Change input method from YAML to choose Butler-Volmer kinetics for electrochemical reactions by string instead of bool
  • Adds input option for electrochemical reactions to use Marcus theory kinetics

The current WIP updates the input field of the YAML for reactions to choose specific electrochemical kinetics models. This new field is called "echem-kinetics-form" and accepts a string input for either "Butler-Volmer" or "Marcus". If either of these strings is used then the appropriate term to modify the reaction rate evaluation will be added to the correction factor in voltageCorrection of InterfaceRate.h

Related to Cantera/enhancements#38

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

The marcus correction term was using deltaGibbs0_RT and it now uses
deltaGibbs_RT calculated using chemPotentials instead of
standardChemPotentials. This was done to address asymmetry when generating
a Tafel plot of the current Marcus kinetics implementation.
Implementation of Marcus theory into the voltageCorrection of
InterfaceRate.h produces symmetric Tafel plot for Marcus kinetics.
@decaluwe
Copy link
Member

Hi everyone, this begins our long-awaited move to overhaul and expand our electrochemistry. @korffdm and I decided to stop and do a WIP PR to hash things out before moving too much farther and making test, documentation, etc.

We decide to add the Marcus kinetics routine, for now, as a parallel option to the current Butler-Volmer for (mostly accomplished via m_exchangeCurrentDensityFormulation in InterfaceRate.h header file), rather than radically changing how both are done. But honestly I am not in love with the current approach. One of the attractive aspects of the B-V type reaction rate form (I would call the Marcus rate a "flavor" of the B-V form) is its simplicity:
$$\dot{q}_{\rm rop} =\frac{i_o}{nF}\left[\exp\left( -\frac{\beta nF\eta}{RT}\right) - \exp\left( \frac{(1-\beta) nF\eta}{RT}\right) \right]$$
where the exchange current density $i_o$ is a function of the forward rate constant and the activity concentrations, and the overpotential $\eta$ is the net electrochemical driving force on the reaction (calculated in Cantera via the echemPotentials property in the C++ code.

Anyway, long story short: if you look at our earlier implementation of these kinetics (here, for example), it was much easier to trace the theory than in our current implementation. This was all before the creation of the KineticsFactory approach. I certainly get why the new approach is preferable over a series of flags, bools, and switch statements. But even as someone who knew what he was looking for, it was very difficult to even verify that the current Butler-Volmer routine does what I think it should do.

So, even shorter: is there any way to implement this kinetics in the new framework that looks more similar to the earlier implementation (again, here)? If not, we have the current approach working and can stick with it. But it really will make it difficult (imho) for new developers to follow behind and verify, alter, or expand the approach, unless they are extremely motivated.

@speth
Copy link
Member

speth commented Dec 20, 2022

I think it would make sense to set a direction for this in the context of some previous discussions we've had on the topic of electrochemical reactions. Namely, Cantera/enhancements#38, which includes what I think is the most detailed description of the theory that we have as written up by @decaluwe, and Cantera/enhancements#44.

Quite a bit has changed since those topics were opened, from the complete transition to the YAML input format to the major refactoring and generalization of how reaction rates are handled in the C++ layer, so I think there should be an opportunity to implement this in a much cleaner way that might have been possible in the past.

I'd suggest that either of those Enhancement discussions would be a better location for hashing out the details of these features, rather than in a PR review, where GitHub has the unfortunate habit of starting to hide posts in once there are detailed code reviews mixed in with the higher-level discussion.

@speth speth self-requested a review February 17, 2023 13:02
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.

4 participants