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

Bug when mixing symmetric and asymmetric conductance in different domains #2843

Open
mkaguer opened this issue Oct 10, 2023 · 5 comments · May be fixed by #2849
Open

Bug when mixing symmetric and asymmetric conductance in different domains #2843

mkaguer opened this issue Oct 10, 2023 · 5 comments · May be fixed by #2849
Assignees

Comments

@mkaguer
Copy link
Contributor

mkaguer commented Oct 10, 2023

Please refer to this line here

I ran into this problem when working on my lithium ion battery model. In the electrolyte phase I have diffusive-migrative conductance that is asymmetric meaning that the conductance is a Nt by 2 array. However, in the active material phase, I have pure diffusive conductance that is a Nt by 1 array. The code runs into a problem when it tries to merge these models from each domain. The bug occurs at the line I linked to above. To get around this issue, I wrote my own diffusive conductance model in the active material phase that writes it as an Nt by 2 array (where the conductance is the same for the first and second columns). I know this is how OpenPNM used to return conductances. Maybe we should revert back to this? Or be able to merge symmetric and asymmetric conductances together.

@mkaguer mkaguer self-assigned this Oct 10, 2023
@ma-sadeghi
Copy link
Member

I'd say let's always use Nt by 2. One downside is memory footprint, but we're storing lots of other properties (like T, p, etc.), so it's not really noticeable. Any other downsides? @jgostick @mkaguer

@jgostick
Copy link
Member

I can't think of any reason why not. Just be careful with the ordering of the elements, like C vs F. I recently rediscovered that you can't just flatten our conns array and use it an an index because the two columns interlace rather than stack. I mention this because Mehrez has an explicit comment about this where he builds the Nt-by-2 conductances for advection-diffusion.

@mkaguer
Copy link
Contributor Author

mkaguer commented Oct 11, 2023

Should I go ahead and fix this then? I will make all conductances Nt-by-2.

@ma-sadeghi
Copy link
Member

Yes, please make PR

@ma-sadeghi
Copy link
Member

While you're at it, you could also add a test that goes through all our conductance models and ensures the shape is correct. Don't hardcore it, you can programmatically do this so it'll catch future conductance models as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants