pybamm-team / PyBaMM

Fast and flexible physics-based battery models in Python
https://www.pybamm.org/
BSD 3-Clause "New" or "Revised" License
876 stars 492 forks source link

Surface temperature model #4203

Open valentinsulzer opened 2 weeks ago

valentinsulzer commented 2 weeks ago

Description

From Lin et al 2014 (kudos @js1tr3 et al) image image

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:

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s quick).

Further checks:

valentinsulzer commented 2 weeks ago

Still need to add tests and update examples

TomTranter commented 2 weeks ago

I am happy to review this when ready

valentinsulzer commented 2 weeks ago

@TomTranter ready for review

codecov[bot] commented 2 weeks ago

Codecov Report

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.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #4203 +/- ## ======================================== Coverage 99.55% 99.55% ======================================== Files 288 291 +3 Lines 21856 21902 +46 ======================================== + Hits 21759 21805 +46 Misses 97 97 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kratman commented 2 weeks ago

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

TomTranter commented 1 week ago

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 image 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

valentinsulzer commented 2 days ago

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