Plot Voltage Components for Composite Electrodes
Description
I would like to see the functionality for plotting the different over potentials separated by particle phases for a composite electrode, in the plot_voltage_components function.
Motivation
Having visibility into the contributions of each phase toward the net overpotentials would allow for better understanding of the dynamics in composite electrode systems.
Possible Implementation
I suggest that the definitions of overpotentials and labels be done differently when the cell is a half-cell. I also suggest that the new 'battery' overpotential variables be defined when the composite electrode model is being used.
Additional context
I attempted to make the changes locally, when I noticed a few interesting things that may deserve attention. I noticed in the BaseBatteryModel.set_voltage_variables() method, it appeared that there was no case where the secondary phase overpotentials would be extracted from the variables.
def set_voltage_variables(self):
if self.options.negative["particle phases"] == "1":
# Only one phase, no need to distinguish between
# "primary" and "secondary"
phase_n = ""
else:
# add a space so that we can use "" or (e.g.) "primary " interchangeably
# when naming variables
phase_n = "primary "
if self.options.positive["particle phases"] == "1":
phase_p = ""
else:
phase_p = "primary "
I wasn't sure if this behavior was a bug, or if this is the intended behavior. Maybe I am missing it, but I don't see where exactly the secondary phase overpotentials would be stored or accessed.
I opened a pull request (draft) just to demonstrate an example and ask others for their opinion. In this version, I pulled both primary and secondary reaction and particle concentration overpotentials for a half cell, and took the average of the two. I know this isn't the correct way to go about this, but this is the result:
The dashed voltage line is not aligned with the sum of the overpotentials. Maybe there is something fundamentally different for half-cell plot voltage_components that I don't understand yet.