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

#872 added ambient temperature #873

Merged
merged 4 commits into from
Mar 9, 2020

Conversation

viviantran27
Copy link
Contributor

Description

Added ambient temperature

Fixes #872

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Mar 5, 2020

Codecov Report

Merging #873 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #873   +/-   ##
========================================
  Coverage    97.70%   97.70%           
========================================
  Files          201      201           
  Lines        10415    10433   +18     
========================================
+ Hits         10176    10194   +18     
  Misses         239      239           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ff39b9...e6c877b. Read the comment docs.

Copy link
Contributor

@rtimms rtimms left a comment

Choose a reason for hiding this comment

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

This is a nice feature, thanks! Just a couple of comments re the stuff in 2D. I think we could improve the documentation for how to write the source terms in finite elements. It is a bit hacky at the moment, and could be reviewed in the future.

@@ -33,6 +35,10 @@ def get_fundamental_variables(self):
T_cp = T_x_av

variables = self._get_standard_fundamental_variables(T, T_cn, T_cp)
variables.update(
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be moved to base_thermalto avoid repeating in each of the separate base classes?

pybamm.laplacian(T_av)
+ self.param.B * pybamm.source(Q_av, T_av)
+ cooling_coeff * pybamm.source(T_av, T_av)
pybamm.laplacian(T_av - T_amb)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there should be a T_amb inside the laplacian

+ self.param.B * pybamm.source(Q_av, T_av)
+ cooling_coeff * pybamm.source(T_av, T_av)
pybamm.laplacian(T_av - T_amb)
+ self.param.B * pybamm.source(Q_av, T_av - T_amb)
Copy link
Contributor

Choose a reason for hiding this comment

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

the second argument in pybamm.source is just the variable for which this is the equation for and the first argument is the source term in the equation (so that boundary conditions are handled correctly in finite elements). sorry, I don't think that is particularly well documented. As a result this should just be pybamm.source(Q_av, T_av)

Copy link
Contributor

Choose a reason for hiding this comment

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

same for laplacian in other files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ohh i see, thanks for the clarification

+ cooling_coeff * pybamm.source(T_av, T_av)
pybamm.laplacian(T_av - T_amb)
+ self.param.B * pybamm.source(Q_av, T_av - T_amb)
+ cooling_coeff * pybamm.source(T_av, T_av - T_amb)
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to above this should be pybamm.source T_av-T_amb,T_av)

- (self.param.h / self.param.delta)
* pybamm.source(T_av, T_av, boundary=True)
* pybamm.source(T_av - T_amb, T_av - T_amb, boundary=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

pybamm.source T_av-T_amb,T_av, boundary=True)

pybamm.laplacian(T_av - T_amb)
+ self.param.B * Q_av
+ cooling_coeff * (T_av - T_amb)
)
/ self.param.C_th
}
Copy link
Contributor

@rtimms rtimms Mar 6, 2020

Choose a reason for hiding this comment

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

just thought - for the model x-lumped with 1D current collectors I think you also need to change the boundary conditions to T-T_amb as well. the colling in the rhs should just be from the large faces of the cell, and the boundary conditions are cooling around the remaining edges (y,z). it shouldn't actually make that much differences as the cooling from those sides is small by comparison. I think the details of these model are a bit opaque -- I'll make a separate issue to simplify the thermal models and make the cooling and boundary conditions more explicit

@rtimms
Copy link
Contributor

rtimms commented Mar 6, 2020

is there an implicit assumption that the dimensionless ambient temp is zero at t=t0? i.e. you start at the reference temperature? if so, maybe there could be a check for this?

@viviantran27
Copy link
Contributor Author

is there an implicit assumption that the dimensionless ambient temp is zero at t=t0? i.e. you start at the reference temperature? if so, maybe there could be a check for this?

Should we keep T_init separate from T_amb(0)? For example, it could be used to simulate a case where an EV exits an air-conditioned garage to a different temperature outside or other rapid temperature change. Can you clarify what sort of check you're imagining?

@rtimms
Copy link
Contributor

rtimms commented Mar 6, 2020

is there an implicit assumption that the dimensionless ambient temp is zero at t=t0? i.e. you start at the reference temperature? if so, maybe there could be a check for this?

Should we keep T_init separate from T_amb(0)? For example, it could be used to simulate a case where an EV exits an air-conditioned garage to a different temperature outside or other rapid temperature change. Can you clarify what sort of check you're imagining?

ah yeah I hadn’t thought of that use case. Yeah I agree to keep T_init and T_amb(0) separate. I had in my head that the battery would start at the ambient temperature, but I see now that isn’t the case, so no need to check. Thanks!

@valentinsulzer valentinsulzer requested a review from rtimms March 6, 2020 20:55
Copy link
Contributor

@rtimms rtimms left a comment

Choose a reason for hiding this comment

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

great, thanks!

@@ -0,0 +1,52 @@
#
# Example showing how to load and solve the DFN
Copy link
Contributor

Choose a reason for hiding this comment

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

the title could be updated to explain this is showing the ambient temperature feature

Copy link
Member

Choose a reason for hiding this comment

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

I'll merge this PR and make that change before merging #868

@valentinsulzer valentinsulzer merged commit a9b1081 into pybamm-team:develop Mar 9, 2020
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.

Adding option to change ambient temperature profile v time
3 participants