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

General thermal bcs #3330

Merged
merged 7 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

## Bug fixes

- Fixed a bug where there was a missing thermal conductivity in the thermal pouch cell models ([#3330](https://github.com/pybamm-team/PyBaMM/pull/3330))
- Fixed a bug that occured in `check_ys_are_not_too_large` when trying to reference `y-slice` where the referenced variable was not a `pybamm.StateVector` ([#3313](https://github.com/pybamm-team/PyBaMM/pull/3313)
- Fixed a bug with `_Heaviside._evaluate_for_shape` which meant some expressions involving heaviside function and subtractions did not work ([#3306](https://github.com/pybamm-team/PyBaMM/pull/3306))
- The `OneDimensionalX` thermal model has been updated to account for edge/tab cooling and account for the current collector volumetric heat capacity. It now gives the correct behaviour compared with a lumped model with the correct total heat transfer coefficient and surface area for cooling. ([#3042](https://github.com/pybamm-team/PyBaMM/pull/3042))
Expand Down
19 changes: 14 additions & 5 deletions docs/source/examples/notebooks/models/pouch-cell-model.ipynb

Large diffs are not rendered by default.

26 changes: 8 additions & 18 deletions pybamm/models/submodels/current_collector/potential_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ def set_boundary_conditions(self, variables):

param = self.param
applied_current_density = variables["Total current density [A.m-2]"]
cc_area = self._get_effective_current_collector_area()
total_current = applied_current_density * param.A_cc

# cc_area appears here due to choice of non-dimensionalisation
pos_tab_bc = (
-applied_current_density * cc_area / (param.p.sigma_cc * param.p.L_cc)
)
# In the 1+1D model, the behaviour is averaged over the y-direction, so the
# effective tab area is the cell width multiplied by the current collector
# thickness
positive_tab_area = param.L_y * param.p.L_cc
pos_tab_bc = -total_current / (param.p.sigma_cc * positive_tab_area)

# Boundary condition needs to be on the variables that go into the Laplacian,
# even though phi_s_cp isn't a pybamm.Variable object
Expand All @@ -100,10 +101,6 @@ def set_boundary_conditions(self, variables):
},
}

def _get_effective_current_collector_area(self):
"""In the 1+1D models the current collector effectively has surface area l_z"""
return self.param.L_z


class PotentialPair2plus1D(BasePotentialPair):
"""Base class for a 2+1D potential pair model"""
Expand All @@ -117,21 +114,18 @@ def set_boundary_conditions(self, variables):

param = self.param
applied_current_density = variables["Total current density [A.m-2]"]
cc_area = self._get_effective_current_collector_area()
total_current = applied_current_density * param.A_cc

# Note: we divide by the *numerical* tab area so that the correct total
# current is applied. That is, numerically integrating the current density
# around the boundary gives the applied current exactly.

positive_tab_area = pybamm.BoundaryIntegral(
pybamm.PrimaryBroadcast(param.p.L_cc, "current collector"),
region="positive tab",
)

# cc_area appears here due to choice of non-dimensionalisation
pos_tab_bc = (
-applied_current_density * cc_area / (param.p.sigma_cc * positive_tab_area)
)
pos_tab_bc = -total_current / (param.p.sigma_cc * positive_tab_area)

# Boundary condition needs to be on the variables that go into the Laplacian,
# even though phi_s_cp isn't a pybamm.Variable object
Expand Down Expand Up @@ -160,7 +154,3 @@ def set_boundary_conditions(self, variables):
"positive tab": (pos_tab_bc, "Neumann"),
},
}

def _get_effective_current_collector_area(self):
"""Return the area of the current collector."""
return self.param.L_y * self.param.L_z
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def set_rhs(self, variables):

self.rhs = {
T_av: (
pybamm.laplacian(T_av)
pybamm.div(self.param.lambda_eff(T_av) * pybamm.grad(T_av))
+ Q_av
+ total_cooling_coefficient * (T_av - T_amb)
)
Expand Down Expand Up @@ -131,25 +131,28 @@ def set_boundary_conditions(self, variables):
bottom_cooling_coefficient = (
param.n.h_tab * neg_tab_area * neg_tab_bottom_bool
+ param.p.h_tab * pos_tab_area * pos_tab_bottom_bool
+ 10 * non_tab_bottom_area
+ param.h_edge(L_y / 2, 0) * non_tab_bottom_area
) / total_area

# just use left and right for clarity
# left = bottom of cell (z=0)
# right = top of cell (z=L_z)
lambda_eff = param.lambda_eff(T_av)
self.boundary_conditions = {
T_av: {
"left": (
bottom_cooling_coefficient
* pybamm.boundary_value(
T_av - T_amb,
pybamm.boundary_value(
bottom_cooling_coefficient * (T_av - T_amb),
"left",
),
)
/ pybamm.boundary_value(lambda_eff, "left"),
"Neumann",
),
"right": (
-top_cooling_coefficient
* pybamm.boundary_value(T_av - T_amb, "right"),
pybamm.boundary_value(
-top_cooling_coefficient * (T_av - T_amb), "right"
)
/ pybamm.boundary_value(lambda_eff, "right"),
"Neumann",
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def set_rhs(self, variables):
# correct mass matrix when discretised. The first argument is the source term
# and the second argument is the variable governed by the equation that the
# source term appears in.
# Note: not correct if lambda_eff is a function of T_av - need to implement div
# in 2D rather than doing laplacian directly
self.rhs = {
T_av: (
pybamm.laplacian(T_av)
self.param.lambda_eff(T_av) * pybamm.laplacian(T_av)
+ pybamm.source(Q_av, T_av)
+ pybamm.source(yz_surface_cooling_coefficient * (T_av - T_amb), T_av)
+ pybamm.source(
Expand Down Expand Up @@ -112,10 +114,12 @@ def set_boundary_conditions(self, variables):
)

negative_tab_bc = pybamm.boundary_value(
-h_tab_n_corrected * (T_av - T_amb), "negative tab"
-h_tab_n_corrected * (T_av - T_amb) / self.param.n.lambda_cc(T_av),
"negative tab",
)
positive_tab_bc = pybamm.boundary_value(
-h_tab_p_corrected * (T_av - T_amb), "positive tab"
-h_tab_p_corrected * (T_av - T_amb) / self.param.p.lambda_cc(T_av),
"positive tab",
)

self.boundary_conditions = {
Expand Down
1 change: 1 addition & 0 deletions pybamm/parameters/lithium_ion_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def _set_parameters(self):
self.h_edge = self.therm.h_edge
self.h_total = self.therm.h_total
self.rho_c_p_eff = self.therm.rho_c_p_eff
self.lambda_eff = self.therm.lambda_eff

# Macroscale geometry
self.L_x = self.geo.L_x
Expand Down
10 changes: 10 additions & 0 deletions pybamm/parameters/thermal_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ def rho_c_p_eff(self, T):
+ self.p.rho_c_p_cc(T) * self.geo.p.L_cc
) / self.geo.L

def lambda_eff(self, T):
"""Effective thermal conductivity [W.m-1.K-1]"""
return (
self.n.lambda_cc(T) * self.geo.n.L_cc
+ self.n.lambda_(T) * self.geo.n.L
+ self.s.lambda_(T) * self.geo.s.L
+ self.p.lambda_(T) * self.geo.p.L
+ self.p.lambda_cc(T) * self.geo.p.L_cc
) / self.geo.L


class DomainThermalParameters(BaseParameters):
def __init__(self, domain, main_param):
Expand Down
Loading