From a55c522ca0da07c96939caf77c36036bb4c587f5 Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Sat, 5 Nov 2022 01:02:24 -0400 Subject: [PATCH] #2418 working on thermal and mechanical models --- .../lead_acid/basic_full.py | 8 +-- .../active_material/base_active_material.py | 4 +- .../active_material/loss_active_material.py | 17 ++--- .../active_material/total_active_material.py | 5 +- .../submodels/particle/base_particle.py | 9 ++- .../submodels/particle/fickian_diffusion.py | 1 + .../particle_mechanics/base_mechanics.py | 63 +++++++++---------- .../particle_mechanics/crack_propagation.py | 24 +++---- .../porosity/reaction_driven_porosity_ode.py | 7 ++- .../models/submodels/thermal/base_thermal.py | 12 ++-- pybamm/models/submodels/thermal/lumped.py | 5 +- .../pouch_cell_1D_current_collectors.py | 4 +- .../pouch_cell_2D_current_collectors.py | 4 +- pybamm/models/submodels/thermal/x_full.py | 17 +++-- pybamm/parameters/lead_acid_parameters.py | 22 +------ pybamm/parameters/lithium_ion_parameters.py | 14 ++++- .../size_distribution_parameters.py | 10 ++- pybamm/parameters/thermal_parameters.py | 18 ++++-- 18 files changed, 124 insertions(+), 120 deletions(-) diff --git a/pybamm/models/full_battery_models/lead_acid/basic_full.py b/pybamm/models/full_battery_models/lead_acid/basic_full.py index 05e2ed6691..b0051ba925 100644 --- a/pybamm/models/full_battery_models/lead_acid/basic_full.py +++ b/pybamm/models/full_battery_models/lead_acid/basic_full.py @@ -213,12 +213,12 @@ def __init__(self, name="Basic full model"): ###################### # Porosity ###################### - beta_surf = pybamm.concatenation( - pybamm.PrimaryBroadcast(param.n.beta_surf, "negative electrode"), + Delta_V = pybamm.concatenation( + pybamm.PrimaryBroadcast(param.n.Delta_V, "negative electrode"), pybamm.PrimaryBroadcast(0, "separator"), - pybamm.PrimaryBroadcast(param.p.beta_surf, "positive electrode"), + pybamm.PrimaryBroadcast(param.p.Delta_V, "positive electrode"), ) - deps_dt = -beta_surf * a * j / param.F + deps_dt = -Delta_V * a * j / param.F self.rhs[eps] = deps_dt self.initial_conditions[eps] = param.epsilon_init self.events.extend( diff --git a/pybamm/models/submodels/active_material/base_active_material.py b/pybamm/models/submodels/active_material/base_active_material.py index 5c94b77a8e..16f07e0277 100644 --- a/pybamm/models/submodels/active_material/base_active_material.py +++ b/pybamm/models/submodels/active_material/base_active_material.py @@ -121,9 +121,9 @@ def _get_standard_active_material_change_variables(self, deps_solid_dt): variables = { f"{Domain} electrode {self.phase_name}" - "active material volume fraction change": deps_solid_dt, + "active material volume fraction change [s-1]": deps_solid_dt, f"X-averaged {domain} electrode {self.phase_name}" - "active material volume fraction change": deps_solid_dt_av, + "active material volume fraction change [s-1]": deps_solid_dt_av, } return variables diff --git a/pybamm/models/submodels/active_material/loss_active_material.py b/pybamm/models/submodels/active_material/loss_active_material.py index 93d5b31092..305bae641f 100644 --- a/pybamm/models/submodels/active_material/loss_active_material.py +++ b/pybamm/models/submodels/active_material/loss_active_material.py @@ -65,16 +65,18 @@ def get_coupled_variables(self, variables): # This is loss of active material model by mechanical effects if self.x_average is True: stress_t_surf = variables[ - f"X-averaged {domain} particle surface tangential stress" + f"X-averaged {domain} particle surface tangential stress [Pa]" ] stress_r_surf = variables[ - f"X-averaged {domain} particle surface radial stress" + f"X-averaged {domain} particle surface radial stress [Pa]" ] else: stress_t_surf = variables[ - f"{Domain} particle surface tangential stress" + f"{Domain} particle surface tangential stress [Pa]" + ] + stress_r_surf = variables[ + f"{Domain} particle surface radial stress [Pa]" ] - stress_r_surf = variables[f"{Domain} particle surface radial stress"] beta_LAM = self.domain_param.beta_LAM stress_critical = self.domain_param.stress_critical @@ -112,7 +114,7 @@ def get_coupled_variables(self, variables): # until other reactions are implemented j_sei = 0 - j_stress_reaction = beta_LAM_sei * a * j_sei + j_stress_reaction = beta_LAM_sei * a * j_sei / param.F deps_solid_dt += j_stress_reaction variables.update( self._get_standard_active_material_change_variables(deps_solid_dt) @@ -127,12 +129,13 @@ def set_rhs(self, variables): f"X-averaged {domain} electrode active material volume fraction" ] deps_solid_dt = variables[ - f"X-averaged {domain} electrode active material volume fraction change" + f"X-averaged {domain} electrode active material " + "volume fraction change [s-1]" ] else: eps_solid = variables[f"{Domain} electrode active material volume fraction"] deps_solid_dt = variables[ - f"{Domain} electrode active material volume fraction change" + f"{Domain} electrode active material volume fraction change [s-1]" ] self.rhs = {eps_solid: deps_solid_dt} diff --git a/pybamm/models/submodels/active_material/total_active_material.py b/pybamm/models/submodels/active_material/total_active_material.py index 3906678e7e..839a05b7be 100644 --- a/pybamm/models/submodels/active_material/total_active_material.py +++ b/pybamm/models/submodels/active_material/total_active_material.py @@ -33,8 +33,9 @@ def get_coupled_variables(self, variables): for variable_template in [ f"{Domain} electrode {{}}active material volume fraction", f"X-averaged {domain} electrode {{}}active material volume fraction", - f"{Domain} electrode {{}}active material volume fraction change", - f"X-averaged {domain} electrode {{}}active material volume fraction change", + f"{Domain} electrode {{}}active material volume fraction change [s-1]", + f"X-averaged {domain} electrode {{}}active material " + "volume fraction change [s-1]", ]: sumvar = sum( variables[variable_template.format(phase + " ")] for phase in phases diff --git a/pybamm/models/submodels/particle/base_particle.py b/pybamm/models/submodels/particle/base_particle.py index a2a7647040..4b32dfe812 100644 --- a/pybamm/models/submodels/particle/base_particle.py +++ b/pybamm/models/submodels/particle/base_particle.py @@ -42,9 +42,12 @@ def _get_effective_diffusivity(self, c, T): stress_option = getattr(self.options, domain)["stress-induced diffusion"] if stress_option == "true": - stress_factor = 1 + domain_param.theta * (c - domain_param.c_0) / ( - 1 + param.Theta * T - ) + # Ai2019 eq [12] + Omega = domain_param.Omega + E = domain_param.E + nu = domain_param.nu + theta_M = Omega / (param.R * T) * (2 * Omega * E) / (9 * (1 - nu)) + stress_factor = 1 + theta_M * (c - domain_param.c_0) else: stress_factor = 1 diff --git a/pybamm/models/submodels/particle/fickian_diffusion.py b/pybamm/models/submodels/particle/fickian_diffusion.py index 1fc89c826f..1c17505475 100644 --- a/pybamm/models/submodels/particle/fickian_diffusion.py +++ b/pybamm/models/submodels/particle/fickian_diffusion.py @@ -212,6 +212,7 @@ def get_coupled_variables(self, variables): ) if self.size_distribution is True: + R = variables[f"{Domain} {phase_name}particle sizes [m]"] # Size-dependent flux variables variables.update(self._get_standard_flux_distribution_variables(N_s)) f_a_dist = self.phase_param.f_a_dist(R) diff --git a/pybamm/models/submodels/particle_mechanics/base_mechanics.py b/pybamm/models/submodels/particle_mechanics/base_mechanics.py index 52e2876c34..62e740f9e4 100644 --- a/pybamm/models/submodels/particle_mechanics/base_mechanics.py +++ b/pybamm/models/submodels/particle_mechanics/base_mechanics.py @@ -57,32 +57,32 @@ def _get_mechanical_results(self, variables): T_xav = variables["X-averaged cell temperature [K]"] eps_s = variables[f"{Domain} electrode active material volume fraction"] - if "Cell thickness change [m]" not in variables: - # thermal expansion - cell_thickness_change = T_xav * self.param.alpha_T_cell - else: - cell_thickness_change = variables["Cell thickness change [m]"] - Omega = domain_param.Omega R0 = domain_param.prim.R c_0 = domain_param.c_0 E0 = domain_param.E nu = domain_param.nu - L0 = domain_param.L c_init = pybamm.r_average(domain_param.prim.c_init) v_change = pybamm.x_average( eps_s * domain_param.prim.t_change(c_s_rav) ) - pybamm.x_average(eps_s * domain_param.prim.t_change(c_init)) - cell_thickness_change += self.param.n_electrodes_parallel * v_change + electrode_thickness_change = self.param.n_electrodes_parallel * v_change + # Ai2019 eq [10] disp_surf_dim = Omega * R0 / 3 * (c_s_rav - c_0) # c0 reference concentration for no deformation # stress evaluated at the surface of the particles + # Ai2019 eq [7] with r=R stress_r_surf = pybamm.Scalar(0) - # c_s_rav is already multiplied by 3/R^3 + # Ai2019 eq [8] with r=R + # c_s_rav is already multiplied by 3/R^3 inside r_average stress_t_surf = Omega * E0 / 3.0 / (1.0 - nu) * (c_s_rav - c_s_surf) - return { + # Averages + stress_r_surf_av = pybamm.x_average(stress_r_surf) + stress_t_surf_av = pybamm.x_average(stress_t_surf) + + variables = { f"{Domain} particle surface tangential stress [Pa]": stress_t_surf, f"{Domain} particle surface radial stress [Pa]": stress_r_surf, f"{Domain} particle surface displacement [m]": disp_surf, @@ -90,26 +90,26 @@ def _get_mechanical_results(self, variables): "radial stress [Pa]": stress_r_surf_av, f"X-averaged {domain} particle surface " "tangential stress [Pa]": stress_t_surf_av, - "Cell thickness change [m]": cell_thickness_change, + f"{Domain} electrode thickness change [m]": electrode_thickness_change, } + if ( + "Negative electrode thickness change [m]" in variables + and "Positive electrode thickness change [m]" in variables + ): + # thermal expansion + # Ai2019 eq [13] + thermal_expansion = self.param.alpha_T_cell * (T_xav - self.param.T_ref) + # calculate total cell thickness change + neg_thickness_change = variables["Negative electrode thickness change [m]"] + pos_thickness_change = variables["Positive electrode thickness change [m]"] + variables["Cell thickness change [m]"] = ( + neg_thickness_change + pos_thickness_change + thermal_expansion + ) + + return variables + def _get_standard_surface_variables(self, variables): - """ - A private function to obtain the standard variables which - can be derived from the local particle crack surfaces. - - Parameters - ---------- - l_cr : :class:`pybamm.Symbol` - The crack length in electrode particles. - a0 : :class:`pybamm.Symbol` - Smooth surface area to volume ratio. - - Returns - ------- - variables : dict - The variables which can be derived from the crack length. - """ domain, Domain = self.domain_Domain phase_name = self.phase_name @@ -119,14 +119,13 @@ def _get_standard_surface_variables(self, variables): ] R0 = self.domain_param.prim.R rho_cr = self.domain_param.rho_cr - roughness = l_cr * 2 * rho_cr + 1 # the ratio of cracks to normal surface - a_cr = (roughness - 1) * a # normalised crack surface area - a_cr_dim = a_cr / R0 # crack surface area to volume ratio [m-1] + w_cr = self.domain_param.w_cr + roughness = 1 + 2 * l_cr * rho_cr * w_cr # ratio of cracks to normal surface + a_cr = (roughness - 1) * a # crack surface area to volume ratio roughness_xavg = pybamm.x_average(roughness) variables = { - f"{Domain} crack surface to volume ratio [m-1]": a_cr_dim, - f"{Domain} crack surface to volume ratio": a_cr, + f"{Domain} crack surface to volume ratio [m-1]": a_cr, f"{Domain} electrode roughness ratio": roughness, f"X-averaged {domain} electrode roughness ratio": roughness_xavg, } diff --git a/pybamm/models/submodels/particle_mechanics/crack_propagation.py b/pybamm/models/submodels/particle_mechanics/crack_propagation.py index 98c3dc9ef8..3e8fc48c2e 100644 --- a/pybamm/models/submodels/particle_mechanics/crack_propagation.py +++ b/pybamm/models/submodels/particle_mechanics/crack_propagation.py @@ -66,15 +66,17 @@ def get_coupled_variables(self, variables): k_cr = self.domain_param.k_cr(T) m_cr = self.domain_param.m_cr b_cr = self.domain_param.b_cr - stress_t_surf = variables[f"{Domain} particle surface tangential stress"] + stress_t_surf = variables[f"{Domain} particle surface tangential stress [Pa]"] l_cr = variables[f"{Domain} particle crack length [m]"] # # compressive stress will not lead to crack propagation - dK_SIF = stress_t_surf * b_cr * pybamm.Sqrt(np.pi * l_cr) * (stress_t_surf >= 0) + dK_SIF = stress_t_surf * b_cr * pybamm.sqrt(np.pi * l_cr) * (stress_t_surf >= 0) dl_cr = k_cr * (dK_SIF**m_cr) / self.param.t0_cr variables.update( { - f"{Domain} particle cracking rate": dl_cr, - f"X-averaged {domain} particle cracking rate": pybamm.x_average(dl_cr), + f"{Domain} particle cracking rate [m.s-1]": dl_cr, + f"X-averaged {domain} particle cracking rate [m.s-1]": pybamm.x_average( + dl_cr + ), } ) return variables @@ -84,22 +86,22 @@ def set_rhs(self, variables): if self.x_average is True: l_cr = variables[f"X-averaged {domain} particle crack length [m]"] - dl_cr = variables[f"X-averaged {domain} particle cracking rate"] + dl_cr = variables[f"X-averaged {domain} particle cracking rate [m.s-1]"] else: l_cr = variables[f"{Domain} particle crack length [m]"] - dl_cr = variables[f"{Domain} particle cracking rate"] + dl_cr = variables[f"{Domain} particle cracking rate [m.s-1]"] self.rhs = {l_cr: dl_cr} def set_initial_conditions(self, variables): domain, Domain = self.domain_Domain + l_cr_0 = self.domain_param.l_cr_0 if self.x_average is True: l_cr = variables[f"X-averaged {domain} particle crack length [m]"] - l0 = 1 else: l_cr = variables[f"{Domain} particle crack length [m]"] - l0 = pybamm.PrimaryBroadcast(1, f"{domain} electrode") - self.initial_conditions = {l_cr: l0} + l_cr_0 = pybamm.PrimaryBroadcast(l_cr_0, f"{domain} electrode") + self.initial_conditions = {l_cr: l_cr_0} def set_events(self, variables): domain, Domain = self.domain_Domain @@ -111,8 +113,6 @@ def set_events(self, variables): self.events.append( pybamm.Event( f"{domain} particle crack length larger than particle radius", - self.domain_param.prim.R_typ / self.domain_param.l_cr_0 - - pybamm.max(l_cr), - pybamm.EventType.TERMINATION, + self.domain_param.prim.R - pybamm.max(l_cr), ) ) diff --git a/pybamm/models/submodels/porosity/reaction_driven_porosity_ode.py b/pybamm/models/submodels/porosity/reaction_driven_porosity_ode.py index 199075e34b..5a79a64deb 100644 --- a/pybamm/models/submodels/porosity/reaction_driven_porosity_ode.py +++ b/pybamm/models/submodels/porosity/reaction_driven_porosity_ode.py @@ -48,6 +48,7 @@ def get_fundamental_variables(self): return variables def get_coupled_variables(self, variables): + param = self.param depsdt_dict = {} for domain in self.options.whole_cell_domains: @@ -59,12 +60,14 @@ def get_coupled_variables(self, variables): j_k_av = variables[ f"X-averaged {domain} interfacial current density" ] - depsdt_k_av = -domain_param.beta_surf * j_k_av + depsdt_k_av = ( + -domain_param.DeltaV * domain_param.a * j_k_av / param.F + ) depsdt_k = pybamm.PrimaryBroadcast(depsdt_k_av, domain) else: Domain = domain.capitalize() j_k = variables[f"{Domain} interfacial current density [A.m-2]"] - depsdt_k = -domain_param.beta_surf * j_k + depsdt_k = -domain_param.DeltaV * domain_param.a * j_k / param.F depsdt_dict[domain] = depsdt_k variables.update(self._get_standard_porosity_change_variables(depsdt_dict)) diff --git a/pybamm/models/submodels/thermal/base_thermal.py b/pybamm/models/submodels/thermal/base_thermal.py index 7b8d4ea14c..d68beb9ef9 100644 --- a/pybamm/models/submodels/thermal/base_thermal.py +++ b/pybamm/models/submodels/thermal/base_thermal.py @@ -144,8 +144,8 @@ def _get_standard_coupled_variables(self, variables): else: T_n = variables["Negative electrode temperature [K]"] dUdT_n = variables["Negative electrode entropic change [V.K-1]"] - Q_rev_n = a_j_n * (param.Theta ** (-1) + T_n) * dUdT_n - Q_rev_p = a_j_p * (param.Theta ** (-1) + T_p) * dUdT_p + Q_rev_n = a_j_n * T_n * dUdT_n + Q_rev_p = a_j_p * T_p * dUdT_p Q_rev = pybamm.concatenation( *[ Q_rev_n, @@ -231,10 +231,10 @@ def _x_average(self, var, var_cn, var_cp): and positive current collectors in the geometry). """ out = ( - self.param.n.l_cc * var_cn - + self.param.l_x * pybamm.x_average(var) - + self.param.p.l_cc * var_cp - ) / self.param.l + self.param.n.L_cc * var_cn + + self.param.L_x * pybamm.x_average(var) + + self.param.p.L_cc * var_cp + ) / self.param.L return out def _yz_average(self, var): diff --git a/pybamm/models/submodels/thermal/lumped.py b/pybamm/models/submodels/thermal/lumped.py index 26ab361364..bcc2b5575f 100644 --- a/pybamm/models/submodels/thermal/lumped.py +++ b/pybamm/models/submodels/thermal/lumped.py @@ -109,9 +109,10 @@ def set_rhs(self, variables): self.rhs = { T_vol_av: ( - self.param.B * Q_vol_av + total_cooling_coefficient * (T_vol_av - T_amb) + self.lambda_eff(T_vol_av) * Q_vol_av + + total_cooling_coefficient * (T_vol_av - T_amb) ) - / (self.param.C_th * self.param.rho(T_vol_av)) + / self.param.rho_c_p_eff(T_vol_av) } def set_initial_conditions(self, variables): diff --git a/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_1D_current_collectors.py b/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_1D_current_collectors.py index f5e131e3d5..491a12571d 100644 --- a/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_1D_current_collectors.py +++ b/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_1D_current_collectors.py @@ -89,10 +89,10 @@ def set_rhs(self, variables): self.rhs = { T_av: ( pybamm.laplacian(T_av) - + self.param.B * Q_av + + Q_av + total_cooling_coefficient * (T_av - T_amb) ) - / (self.param.C_th * self.param.rho(T_av)) + / self.param.rho_c_p(T_av) } def set_boundary_conditions(self, variables): diff --git a/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_2D_current_collectors.py b/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_2D_current_collectors.py index 838d6dbdf9..ebec40c8a8 100644 --- a/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_2D_current_collectors.py +++ b/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_2D_current_collectors.py @@ -86,12 +86,12 @@ def set_rhs(self, variables): self.rhs = { T_av: ( pybamm.laplacian(T_av) - + self.param.B * pybamm.source(Q_av, T_av) + + pybamm.source(Q_av, T_av) + yz_surface_cooling_coefficient * pybamm.source(T_av - T_amb, T_av) - edge_cooling_coefficient * pybamm.source(T_av - T_amb, T_av, boundary=True) ) - / (self.param.C_th * self.param.rho(T_av)) + / self.param.rho_c_p(T_av) } # TODO: Make h_edge a function of position to have bottom/top/side cooled cells. diff --git a/pybamm/models/submodels/thermal/x_full.py b/pybamm/models/submodels/thermal/x_full.py index 07091b82ac..5f1fd8a529 100644 --- a/pybamm/models/submodels/thermal/x_full.py +++ b/pybamm/models/submodels/thermal/x_full.py @@ -79,27 +79,24 @@ def set_rhs(self, variables): Q = variables["Total heating [W.m-3]"] # Define volumetric heat capacity - rho_k = pybamm.concatenation( - self.param.n.rho(T_n), - self.param.s.rho(T_s), - self.param.p.rho(T_p), + rho_c_p = pybamm.concatenation( + self.param.n.rho_c_p(T_n), + self.param.s.rho_c_p(T_s), + self.param.p.rho_c_p(T_p), ) # Devine thermal conductivity - lambda_k = pybamm.concatenation( + lambda_ = pybamm.concatenation( self.param.n.lambda_(T_n), self.param.s.lambda_(T_s), self.param.p.lambda_(T_p), ) # Fourier's law for heat flux - q = -lambda_k * pybamm.grad(T) + q = -lambda_ * pybamm.grad(T) # N.B only y-z surface cooling is implemented for this model - self.rhs = { - T: (-pybamm.div(q) / self.param.delta**2 + self.param.B * Q) - / (self.param.C_th * rho_k) - } + self.rhs = {T: (-pybamm.div(q) / self.param.delta**2 + Q) / rho_c_p} def set_boundary_conditions(self, variables): T = variables["Cell temperature [K]"] diff --git a/pybamm/parameters/lead_acid_parameters.py b/pybamm/parameters/lead_acid_parameters.py index bdf99748aa..84d190050f 100644 --- a/pybamm/parameters/lead_acid_parameters.py +++ b/pybamm/parameters/lead_acid_parameters.py @@ -9,14 +9,6 @@ class LeadAcidParameters(BaseParameters): """ Standard Parameters for lead-acid battery models - - Layout: - 1. Dimensional Parameters - 2. Dimensional Functions - 3. Scalings - 4. Dimensionless Parameters - 5. Dimensionless Functions - 6. Input Current """ def __init__(self): @@ -56,7 +48,7 @@ def _set_parameters(self): self.V_cell = self.geo.V_cell self.W = self.L_y self.H = self.L_z - self.A_cs = self.A_cc + self.A_cc = self.A_cc self.delta = self.L_x / self.H # Electrical @@ -133,7 +125,6 @@ def _set_parameters(self): # SEI parameters (for compatibility) self.R_sei = pybamm.Scalar(0) - self.beta_sei = pybamm.Scalar(0) for domain in self.domain_params.values(): domain._set_parameters() @@ -149,7 +140,7 @@ def _set_parameters(self): / (self.p.prim.s_plus_S - self.n.prim.s_plus_S) ) self.Q_e_max = self.Q_e_max * self.c_e_typ * self.F - self.capacity = self.Q_e_max * self.n_electrodes_parallel * self.A_cs * self.L_x + self.capacity = self.Q_e_max * self.n_electrodes_parallel * self.A_cc * self.L_x # Concatenations self.s_plus_S = pybamm.concatenation( @@ -161,15 +152,6 @@ def _set_parameters(self): self.p.prim.s_plus_S, ["positive electrode"], "current collector" ), ) - self.beta_surf = pybamm.concatenation( - pybamm.FullBroadcast( - self.n.beta_surf, ["negative electrode"], "current collector" - ), - pybamm.FullBroadcast(0, ["separator"], "current collector"), - pybamm.FullBroadcast( - self.p.beta_surf, ["positive electrode"], "current collector" - ), - ) self.beta = pybamm.concatenation( pybamm.FullBroadcast( self.n.beta, "negative electrode", "current collector" diff --git a/pybamm/parameters/lithium_ion_parameters.py b/pybamm/parameters/lithium_ion_parameters.py index 53ab41567c..88dca4821c 100644 --- a/pybamm/parameters/lithium_ion_parameters.py +++ b/pybamm/parameters/lithium_ion_parameters.py @@ -136,6 +136,9 @@ def _set_parameters(self): # Reference OCP based on initial concentration self.ocv_init = self.p.prim.U_init - self.n.prim.U_init + # Dimensionless mechanical parameters + self.t0_cr = 3600 / self.C_rate + def chi(self, c_e, T): """ Thermodynamic factor: @@ -305,8 +308,6 @@ def _set_parameters(self): ) self.b_cr = pybamm.Parameter(f"{Domain} electrode Paris' law constant b") self.m_cr = pybamm.Parameter(f"{Domain} electrode Paris' law constant m") - # intermediate variables [K*m^3/mol] - self.theta = (self.Omega / main.R) * 2 * self.Omega * self.E / 9 / (1 - self.nu) # Loss of active material parameters self.m_LAM = pybamm.Parameter( @@ -338,6 +339,15 @@ def sigma(self, T): f"{Domain} electrode conductivity [S.m-1]", inputs ) + def k_cr(self, T): + """ + Cracking rate for the electrode; + """ + Domain = self.domain.capitalize() + return pybamm.FunctionParameter( + f"{Domain} electrode cracking rate [m.s-1]", {"Temperature [K]": T} + ) + class ParticleLithiumIonParameters(BaseParameters): def __init__(self, phase, domain_param): diff --git a/pybamm/parameters/size_distribution_parameters.py b/pybamm/parameters/size_distribution_parameters.py index 7b378cc37f..f32250f563 100644 --- a/pybamm/parameters/size_distribution_parameters.py +++ b/pybamm/parameters/size_distribution_parameters.py @@ -73,10 +73,10 @@ def get_size_distribution_parameters( R_max_p = R_max_p or (1 + sd_p * 5) # Area-weighted particle-size distributions - def f_a_dist_n_dim(R): + def f_a_dist_n(R): return lognormal(R, R_n_av, sd_n * R_n_av) - def f_a_dist_p_dim(R): + def f_a_dist_p(R): return lognormal(R, R_p_av, sd_p * R_p_av) param.update( @@ -91,10 +91,8 @@ def f_a_dist_p_dim(R): "Positive minimum particle radius [m]": R_min_p * R_p_av, "Negative maximum particle radius [m]": R_max_n * R_n_av, "Positive maximum particle radius [m]": R_max_p * R_p_av, - "Negative area-weighted " - + "particle-size distribution [m-1]": f_a_dist_n_dim, - "Positive area-weighted " - + "particle-size distribution [m-1]": f_a_dist_p_dim, + "Negative area-weighted particle-size distribution [m-1]": f_a_dist_n, + "Positive area-weighted particle-size distribution [m-1]": f_a_dist_p, }, check_already_exists=False, ) diff --git a/pybamm/parameters/thermal_parameters.py b/pybamm/parameters/thermal_parameters.py index c48f997a91..8db160163c 100644 --- a/pybamm/parameters/thermal_parameters.py +++ b/pybamm/parameters/thermal_parameters.py @@ -53,14 +53,14 @@ def T_amb(self, t): """Dimensional ambient temperature""" return pybamm.FunctionParameter("Ambient temperature [K]", {"Time [s]": t}) - def rho_eff(self, T): + def rho_c_p_eff(self, T): """Effective volumetric heat capacity [J.m-3.K-1]""" return ( - self.n.rho_cc(T) * self.n.c_p_cc(T) * self.geo.n.L_cc - + self.n.rho(T) * self.n.c_p(T) * self.geo.n.L - + self.s.rho(T) * self.s.c_p(T) * self.geo.s.L - + self.p.rho(T) * self.p.c_p(T) * self.geo.p.L - + self.p.rho_cc(T) * self.p.c_p_cc(T) * self.geo.p.L_cc + self.n.rho_c_p_cc(T) * self.geo.n.L_cc + + self.n.rho_c_p(T) * self.geo.n.L + + self.s.rho_c_p(T) * self.geo.s.L + + self.p.rho_c_p(T) * self.geo.p.L + + self.p.rho_c_p_cc(T) * self.geo.p.L_cc ) / self.geo.L def lambda_eff(self, T): @@ -157,5 +157,11 @@ def rho_cc(self, T): f"{Domain} current collector density [kg.m-3]", inputs ) + def rho_c_p(self, T): + return self.rho(T) * self.c_p(T) + + def rho_c_p_cc(self, T): + return self.rho_cc(T) * self.c_p_cc(T) + thermal_parameters = ThermalParameters()