Skip to content

Feature/temperature effects#71

Open
lightningclaw001 wants to merge 64 commits intodevelopmentfrom
feature/temperature_effects
Open

Feature/temperature effects#71
lightningclaw001 wants to merge 64 commits intodevelopmentfrom
feature/temperature_effects

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.

@lightningclaw001 lightningclaw001 force-pushed the feature/temperature_effects branch from 13fab0d to 63cea5a Compare November 30, 2021 19:48
@lightningclaw001 lightningclaw001 force-pushed the feature/temperature_effects branch from 63cea5a to bfb693f Compare November 30, 2021 19:51
@lightningclaw001 lightningclaw001 force-pushed the feature/temperature_effects branch from 5b51f8d to 553979e Compare July 18, 2022 19:46
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.

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?

c_edges_int = utils.weighted_linear_mean(c_lyte, wt)
T_edges_int = utils.weighted_linear_mean(T_lyte, wt)

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
dxtmp = np.hstack((out["dxvec"][0], out["dxvec"], out["dxvec"][-1]))
out["dx"] = dxtmp
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.

@lightningclaw001 lightningclaw001 force-pushed the feature/temperature_effects branch from bba9729 to f76687a Compare August 23, 2022 17:26
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 lightningclaw001 force-pushed the feature/temperature_effects branch from 7f4f8ba to 3880d4d Compare February 3, 2023 20:13
@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 d-cogswell force-pushed the feature/temperature_effects branch from 0bf3fc3 to 3880d4d Compare March 31, 2023 00:34
@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