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

Feature/temperature effects #71

Open
wants to merge 64 commits into
base: development
Choose a base branch
from

Conversation

lightningclaw001
Copy link
Collaborator

@lightningclaw001 lightningclaw001 commented Aug 17, 2021

-added in non constant temperature diffusion/thermal diffusion effects in electrolyte only
-added in heat generation from reactions, ohmic heat, and entropy

@lightningclaw001
Copy link
Collaborator Author

@d-cogswell can we take a look at these changes some time too? I'm going to start implementing the heat generation part after this is merged in.

Copy link
Collaborator

@d-cogswell d-cogswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some code comments.

@@ -87,6 +87,66 @@ def get_asc_vec(var, Nvol, dt=False):
return out


def central_diff_bulk(array, Nvol, dx):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use a central difference? What happens at the electrode/separator interface if the computational cell size changes?


k_h = utils.weighted_linear_mean(disc["khvec"], wt)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transport properties are usually the weighted harmonic mean of the neighboring cells?

mpet/geometry.py Outdated
out["dxd1"] = utils.mean_linear(dxtmp)
out["dxd2"] = utils.mean_linear(out["dxd1"]) # for thermal finite differences
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'dxd1' is the distance between neighboring cell centers, but what is 'dxd2'?

for sectn in ["a", "c", "s"]:
# If we have information within this battery section
if sectn in ["a", "c"]:
if sectn in array.keys():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to write this with fewer ifs and loops?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I attempted to do this previously but I think it's pretty difficult because we need to consider cases where there is no separator, where the separator information should be set to 0 for every point on the separator, or where the electrode for the anode doesn't exist, which actually means that we should have no data at the anode.

Base automatically changed from development to master January 27, 2023 20:03
@lightningclaw001
Copy link
Collaborator Author

@d-cogswell @loostrum , just wondering, does the Fuller test pass on your computers? on my local environment it passes.

@lightningclaw001 lightningclaw001 changed the base branch from master to development January 29, 2023 22:15
@loostrum
Copy link
Collaborator

It's passing for me as well. The ValueError is not very insightful, it just means the error is in one of these lines:

varDataNew = newData[varKey][...]
varDataRef = refData[varKey][...]
diffMat = np.abs(varDataNew - varDataRef)

Which is just selecting the right data so it's strange that it's failing there. I'll add a line to print more info when things fail.

@loostrum
Copy link
Collaborator

Apparently there is a shape mismatch, Fail from ValueError: operands could not be broadcast together with shapes (1,19) (1,20)
Although strangely the shapes themselves are different on Python 3.8 vs other versions, and on Python 3.10 the test is now passing. It's a bit concerning that even the shape of the reference output depends on the Python version. Hopefully this helps pinning down the issue.

@lightningclaw001
Copy link
Collaborator Author

Apparently there is a shape mismatch, Fail from ValueError: operands could not be broadcast together with shapes (1,19) (1,20) Although strangely the shapes themselves are different on Python 3.8 vs other versions, and on Python 3.10 the test is now passing. It's a bit concerning that even the shape of the reference output depends on the Python version. Hopefully this helps pinning down the issue.

@loostrum I've had this problem happen before, but sometimes the solutions just print an extra time point. It was quite odd and I never pinpointed down the reason it happened. Do you think it is related to the tolerances?

@d-cogswell
Copy link
Collaborator

I'm hunting for the commit that first broke that test. Maybe that will give us some clues.

@d-cogswell
Copy link
Collaborator

d-cogswell commented Feb 3, 2023

The failing Fuller test first occurs in b4feee4. Maybe we should revert to the previous commit 14de592?

@lightningclaw001
Copy link
Collaborator Author

The failing Fuller test first occurs in b4feee4. Maybe we should revert to the previous commit 14de592?

This would work... I think the only change is from removing the ghost points and reducing the number of equations. From what I recall, the solution plots were exactly the same, with an extra time point. Maybe the ghost point method just adds another point or the tolerance is just really close? Let me try and revert this commit to see if it passes (though to test if it passes on Github I'm going to have to push it)

@lightningclaw001 lightningclaw001 force-pushed the feature/temperature_effects branch 2 times, most recently from c3e2c30 to 7f4f8ba Compare February 3, 2023 20:11
@lightningclaw001
Copy link
Collaborator Author

lightningclaw001 commented Feb 3, 2023

@loostrum I think I broke something in the DAEtools tests in python 3.9... 🙃

So I reran it and then it was fine... I have no idea what is going on. Race condition?

@lightningclaw001
Copy link
Collaborator Author

@d-cogswell all tests passing now! yay!

@d-cogswell
Copy link
Collaborator

Hi @Ombrini , we're using this branch for implementing non-constant temperature. Please keep your own work in a separate branch or fork. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants