-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
[Bug]: Electrolyte concentration not conserved for non-constant transference number #2666
Comments
Posting here the images reported by @MarcAntoine88 in #2681 |
Thank you @brosaplanella , the issue is exactly what @DrSOKane explained. What is our action plan for this one ? I'll try to see how to fix it locally |
I decided to rewrite the entire set_rhs function, with an additional term to correct for the gradient of the transference number: def set_rhs(self, variables):
However, I get the following error: ShapeError: Cannot find shape (original error: operands could not be broadcast together with shapes (59,1) (61,1) ) One possible fix would be to create a new FunctionParameter for grad(t_plus), which would remove the need to use pybamm.grad. But that would be messy, not to mention extra work for anyone creating parameter sets... |
@brosaplanella 's suggestion is how it used to be done but it didn't quite conserve mass for some reason that I can't remember. But it was definitely better than what I changed it to so maybe it should just be reverted. Regarding @DrSOKane 's shape error, it's because it needs boundary conditions for |
Is it possible to apply boundary conditions to a FunctionParameter? |
Yes, for boundary conditions it can be any object, it just needs to be exactly the same as the argument of |
Are there any examples of adding boundary conditions to a FunctionParameter? I know how to do it for variables (add a set_boundary_conditions function to the submodel) but not for a parameter. |
Hi all I am having the same issue when I add my transference number function. I need to plot the electrolyte concentration gradient over time for a paper revision however, the concentration gradient continues to shift up infinitely due to this issue described above I believe. Do you know of a temporary fix I can use? I am using a half cell DFN model, but when I use the full cell I don't seem to have the same issue which is odd. Many thanks for your help. |
Hi all, I try to deepen the equations and I have 1 question that come to me:
|
Hi all, I started to derive the equations of the set_rhs from the mass balance of the anion/cation and can not make it match with the ones in the non dimensionless full diffusion submodel, does anyone see why ? I get (1-tplus) instead of tplus and for me the convection is already taken into account in the div operator. Thanks a lot |
@MarcAntoine88 the PyBaMM implementation right now Should be fixed by #2758 By the way, models are no longer dimensionless, make sure you check out the latest version of develop |
Thanks for the feedback @tinosulzer, I got confused by sum_s_a_j and sum_a_j, with no side reactions we have sum_s_a_j = sum_a_j and (1-t_+) * aj. I agree for the t_+ The fact that models are no longer dimensionless is a really good thing :) |
…ervation #2666 put t_+ back inside div, loosen tolerance for test
PyBaMM Version
23.1
Python Version
3.8.10
Describe the bug
The change to full_diffusion.py in PR#2552 fixed lithium conservation for algebraic surface form. However, by moving the migration flux outside the divergence operator, the same fix now violates conservation for the case where transference number is a FunctionParameter, e.g. in the ORegan2022 parameter set.
There must be a general fix that solves this issue for both cases but to solve this issue I would need to learn how the surface form option works and why putting that term inside the divergence operator breaks it.
Steps to Reproduce
Run any model with the ORegan2022 parameter set and you'll find that "Total lithium [mol]" changes over time
Relevant log output
No response
The text was updated successfully, but these errors were encountered: