-
Notifications
You must be signed in to change notification settings - Fork 102
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
adds B/2 term to Paasch element, fixes #251 #256
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,6 +345,7 @@ def T(p, f): | |
.. math:: | ||
|
||
Z = A\\frac{\\coth{\\beta}}{\\beta} + B\\frac{1}{\\beta\\sinh{\\beta}} | ||
+ \\frac{B}{2} | ||
|
||
where | ||
|
||
|
@@ -377,7 +378,7 @@ def T(p, f): | |
else: | ||
sinh.append(1e10) | ||
Comment on lines
378
to
379
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't comment on the whole block but L374-379 make me a bit uneasy. L376 checks whether values of Next, if If we use a frequency of 35 Hz, then Idk... pragmatically speaking 1e10 is 10GOhm so maybe it's not something to really worry about? I also have problems with overflow in tanh that don't happen in the CI testing pipeline. I'm guessing that's because I'm on Windows, but the pipeline uses Unix? I've fixed this locally by replacing L374-379 with sinh, tanh = [], []
for x in beta:
# beta will be dtype np.complex128 by default, so real and imag components are each float64
if x.real < 100:
sinh.append(np.sinh(x))
tanh.append(np.tanh(x))
else:
sinh.append(1e10)
tanh.append(1 + 0j) |
||
|
||
Z = A / (beta * np.tanh(beta)) + B / (beta * np.array(sinh)) | ||
Z = A / (beta * np.tanh(beta)) + B / (beta * np.array(sinh)) + B / 2 | ||
return Z | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh boy, this one is a doozy. So, I haven't really read the paper to understand the full context of this model, but am I correct in assuming that$\rho_1$ , $\rho_2$ , $k$ , $K$ , and $d$ )?
A
,B
,a
, andb
are defined in order to reduce the number of fitting parameters (from 5 down to 4, since as written we'd haveI understand the point of that, but it does come at the cost of additional complexity while reading the code since the audience has to work through the conversion of$\rho_1$ and $\rho_2$ , etc. Rewriting the code in terms of parameters as written in the paper would be (I think) a breaking change since it introduces an additional fitting parameter for the element, and changes the meaning of each parameter. I'm not super inclined towards this unless we first added a deprecation notice for a couple of minor version releases.
A
toRegardless, I think there's some documentation we should add to this element. The first thing is that Eq. 22 in the paper is for$AZ(\omega)$ , where A is the geometric area of the electrode. This means $Z(\omega)$ has units of $\Omega cm^{-2}$ , but I believe all other elements are written with units $\Omega$ . So I think we need to call that out. Maybe add something like (
CAUTION: This element, in agreement with Eq. 22 Paasch et al., has units of Ohms cm ^-2. All other elements in this package
)It's also a bit confusing that the paper uses "A" as an area, but the code uses
A
as a lumped parameter. Maybe we can refactorA
andB
toM
andN
? I'm not attached toM
andN
, but ideally we use something that isn't already meaningful in electrochemistry, and isn't already used in the paper. (Kind of tough when the paper uses nearly the whole Latin and Greek alphabets!)Another thing is that we have$\beta$ defined slightly differently than the paper, where $\beta_{code} = d \beta_{paper}$ . That fact is a little bit hidden by how $\beta$ is defined in terms of lumped parameters
a
andb
. Maybe we can add something likeNOTE: \\beta defined here differed from Eq. 23 of Paasch et al. by a factor of d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I regularly use this element and I can confirm the current bundle of parameters makes interpretation and initial estimation/guess cumbersome.
If I had to refactor the code I would add electrode area 'A' and thickness 'd' as optional parameters that default to a value of 1. With both having a value of 1, the electronic and ionic resistivities$\rho_1$ , $\rho_2$ (unit $\Omega \cdot m$ ) would then assume the meaning of electronic and ionic resistance of the sample generating the dataset. Area and thickness are normalization values and should not be included in the fitting/optimization directly imho.
Something like this would have 4 open parameters ($\rho_1$ , $\rho_2$ , $k$ , $K$ ) , coherence with the paper and a 'straightforward' physical interpretation:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etrevis Excellent work, could perhaps make it a custom circuit element?