Open valentinsulzer opened 2 weeks ago
Still need to add tests and update examples
I am happy to review this when ready
@TomTranter ready for review
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.55%. Comparing base (
74381f7
) to head (b860972
). Report is 1 commits behind head on develop.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Looks like the examples are failing here:
for phase in self.options.phases[domain]:
if particle == "Fickian diffusion":
submod = pybamm.particle.FickianDiffusion(
self.param, domain, self.options, phase=phase, x_average=True
)
elif particle in [
"uniform profile",
"quadratic profile",
"quartic profile",
]:
submod = pybamm.particle.XAveragedPolynomialProfile(
self.param, domain, self.options, phase=phase
)
elif particle == "MSMR":
submod = pybamm.particle.MSMRDiffusion(
self.param, domain, self.options, phase=phase, x_average=True
)
# also set the submodel for calculating stoichiometry from
# potential
self.submodels[f"{domain} {phase} stoichiometry"] = (
pybamm.particle.MSMRStoichiometryVariables(
self.param,
domain,
self.options,
phase=phase,
x_average=True,
)
)
self.submodels[f"{domain} {phase} particle"] = submod
The variable submod does not get defined before assignment. PyCharm identifies that the variable may be undefined. We should probably make sure our inspection tools flag this
The model seems to be working but I am not sure about some of the numbers or what the constants in the equation represent. It would make more sense to me to have 3 nodes representing the core, casing and environment. I also would prefer the equations to be consistent with the other heat capacities and specify the thermal conductivity and specific heat capacity. The paper quotes these values for the parameters in the model
The thermal resistance seems ok but capacity seems a bit high unless my assumed casing thickness is a bit low.
# Assuming a 21700 cylindrical cell with Al casing
rho_Al = 2710.00 # [kg/m^3]
h_casing = 70.0e-3 # [m] height of casing
t_casing = 1.0e-3 # [m] casing thickness
r_casing = 10.50e-3 # [m] casing radius
# Volume of the cylindrical side
vol_casing_side = np.pi * ((r_casing + t_casing)**2 - r_casing**2) * h_casing # [m^3]
# Volume of the end caps
vol_casing_caps = 2 * np.pi * r_casing**2 * t_casing # [m^3]
# Total volume of the casing
vol_casing = vol_casing_side + vol_casing_caps
Cp_Al = 890.0 # [J/kg.K]
C_Al = rho_Al * vol_casing * Cp_Al
print("Casing heat capacity [J/K]:", C_Al)
k_Al = 237 # W.m-1K-1
R_casing = 1 / (k_Al * t_casing)
print("Environment thermal resistance [K/W]:", R_casing)
parameter_values = pybamm.ParameterValues("Chen2020")
parameter_values.update(
{
"Casing heat capacity [J.K-1]": C_Al,
"Environment thermal resistance [K.W-1]": R_casing,
},
check_already_exists=False,
)
Gives Casing heat capacity [J/K]: 13.33 Environment thermal resistance [K/W]: 4.21
Could we see what adding another equation does to the model to go from casing to cooling channel centre through air. It seems like the fitted parameters for this model might be doing some averaging of properties which is not that obvious to the user
I'd like to stick as closely as possible to what is implemented in the referred paper, so that we can say "this is the model from this paper" rather than having to justify choices of equations and parameters. Especially as this model already gives good fit to some data I've been looking at
Description
From Lin et al 2014 (kudos @js1tr3 et al)
![image](https://github.com/pybamm-team/PyBaMM/assets/20817509/618b00cc-b8ee-4b06-8192-eeb841367a12)
Fixes #4022
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.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: