From 09f6bc882f9686fbb7facee78f495cf9247f453b Mon Sep 17 00:00:00 2001 From: Alec Bills Date: Wed, 29 Nov 2023 14:57:57 -0800 Subject: [PATCH 1/5] add omega --- pybamm/models/submodels/particle/base_particle.py | 3 ++- .../submodels/particle_mechanics/base_mechanics.py | 4 +++- pybamm/parameters/lithium_ion_parameters.py | 12 +++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pybamm/models/submodels/particle/base_particle.py b/pybamm/models/submodels/particle/base_particle.py index dd5a94afc6..9fe08bdaf6 100644 --- a/pybamm/models/submodels/particle/base_particle.py +++ b/pybamm/models/submodels/particle/base_particle.py @@ -56,7 +56,8 @@ def _get_effective_diffusivity(self, c, T, current): if stress_option == "true": # Ai2019 eq [12] - Omega = domain_param.Omega + sto = c / phase_param.c_max + Omega = pybamm.r_average(domain_param.Omega(sto)) E = domain_param.E nu = domain_param.nu theta_M = Omega / (param.R * T) * (2 * Omega * E) / (9 * (1 - nu)) diff --git a/pybamm/models/submodels/particle_mechanics/base_mechanics.py b/pybamm/models/submodels/particle_mechanics/base_mechanics.py index feffbdd380..72ed9bebb8 100644 --- a/pybamm/models/submodels/particle_mechanics/base_mechanics.py +++ b/pybamm/models/submodels/particle_mechanics/base_mechanics.py @@ -45,7 +45,9 @@ def _get_mechanical_results(self, variables): T_xav = variables["X-averaged cell temperature [K]"] eps_s = variables[f"{Domain} electrode active material volume fraction"] - Omega = domain_param.Omega + #use a tangential approximation for omega + sto = variables[f"{Domain} particle concentration"] + Omega = pybamm.r_average(domain_param.Omega(sto)) R0 = domain_param.prim.R c_0 = domain_param.c_0 E0 = domain_param.E diff --git a/pybamm/parameters/lithium_ion_parameters.py b/pybamm/parameters/lithium_ion_parameters.py index c459a4ef1e..918a993be1 100644 --- a/pybamm/parameters/lithium_ion_parameters.py +++ b/pybamm/parameters/lithium_ion_parameters.py @@ -308,9 +308,7 @@ def _set_parameters(self): f"{Domain} electrode reference concentration for free of deformation " "[mol.m-3]" ) - self.Omega = pybamm.Parameter( - f"{Domain} electrode partial molar volume [m3.mol-1]" - ) + self.l_cr_0 = pybamm.Parameter(f"{Domain} electrode initial crack length [m]") self.w_cr = pybamm.Parameter(f"{Domain} electrode initial crack width [m]") self.rho_cr = pybamm.Parameter( @@ -349,6 +347,14 @@ def C_dl(self, T): f"{Domain} electrode double-layer capacity [F.m-2]", inputs ) + def Omega(self, sto): + """Dimensional partial molar volume of Li in solid solution [m3.mol-1]""" + Domain = self.domain.capitalize() + inputs = {f"{Domain} particle stoichiometry": sto} + return pybamm.FunctionParameter( + f"{Domain} electrode partial molar volume [m3.mol-1]" + ) + def sigma(self, T): """Dimensional electrical conductivity in electrode""" inputs = {"Temperature [K]": T} From 242c1c1c4214b663147eba901d4ad1d6232e14e2 Mon Sep 17 00:00:00 2001 From: Alec Bills Date: Wed, 29 Nov 2023 15:02:53 -0800 Subject: [PATCH 2/5] fix test failure --- pybamm/parameters/lithium_ion_parameters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pybamm/parameters/lithium_ion_parameters.py b/pybamm/parameters/lithium_ion_parameters.py index 918a993be1..5827062e4a 100644 --- a/pybamm/parameters/lithium_ion_parameters.py +++ b/pybamm/parameters/lithium_ion_parameters.py @@ -352,7 +352,7 @@ def Omega(self, sto): Domain = self.domain.capitalize() inputs = {f"{Domain} particle stoichiometry": sto} return pybamm.FunctionParameter( - f"{Domain} electrode partial molar volume [m3.mol-1]" + f"{Domain} electrode partial molar volume [m3.mol-1]", inputs ) def sigma(self, T): From 65c6dcb181acd020bab7c6c246d16ecca230682e Mon Sep 17 00:00:00 2001 From: Alec Bills Date: Wed, 29 Nov 2023 15:27:02 -0800 Subject: [PATCH 3/5] add youngs modulus --- pybamm/models/submodels/particle/base_particle.py | 2 +- .../submodels/particle_mechanics/base_mechanics.py | 7 ++++++- pybamm/parameters/lithium_ion_parameters.py | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pybamm/models/submodels/particle/base_particle.py b/pybamm/models/submodels/particle/base_particle.py index 9fe08bdaf6..cd862518f0 100644 --- a/pybamm/models/submodels/particle/base_particle.py +++ b/pybamm/models/submodels/particle/base_particle.py @@ -58,7 +58,7 @@ def _get_effective_diffusivity(self, c, T, current): # Ai2019 eq [12] sto = c / phase_param.c_max Omega = pybamm.r_average(domain_param.Omega(sto)) - E = domain_param.E + E = pybamm.r_average(domain_param.E(sto, T)) 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) diff --git a/pybamm/models/submodels/particle_mechanics/base_mechanics.py b/pybamm/models/submodels/particle_mechanics/base_mechanics.py index 72ed9bebb8..48f8a08d8f 100644 --- a/pybamm/models/submodels/particle_mechanics/base_mechanics.py +++ b/pybamm/models/submodels/particle_mechanics/base_mechanics.py @@ -43,6 +43,11 @@ def _get_mechanical_results(self, variables): sto_rav = variables[f"R-averaged {domain} particle concentration"] c_s_surf = variables[f"{Domain} particle surface concentration [mol.m-3]"] T_xav = variables["X-averaged cell temperature [K]"] + phase_name = self.phase_name + T = pybamm.PrimaryBroadcast( + variables[f"{Domain} electrode temperature [K]"], + [f"{domain} {phase_name}particle"], + ) eps_s = variables[f"{Domain} electrode active material volume fraction"] #use a tangential approximation for omega @@ -50,7 +55,7 @@ def _get_mechanical_results(self, variables): Omega = pybamm.r_average(domain_param.Omega(sto)) R0 = domain_param.prim.R c_0 = domain_param.c_0 - E0 = domain_param.E + E0 = pybamm.r_average(domain_param.E(sto, T)) nu = domain_param.nu L0 = domain_param.L sto_init = pybamm.r_average(domain_param.prim.c_init / domain_param.prim.c_max) diff --git a/pybamm/parameters/lithium_ion_parameters.py b/pybamm/parameters/lithium_ion_parameters.py index 5827062e4a..8bab4b2c4a 100644 --- a/pybamm/parameters/lithium_ion_parameters.py +++ b/pybamm/parameters/lithium_ion_parameters.py @@ -303,7 +303,6 @@ def _set_parameters(self): # Mechanical parameters self.nu = pybamm.Parameter(f"{Domain} electrode Poisson's ratio") - self.E = pybamm.Parameter(f"{Domain} electrode Young's modulus [Pa]") self.c_0 = pybamm.Parameter( f"{Domain} electrode reference concentration for free of deformation " "[mol.m-3]" @@ -355,6 +354,14 @@ def Omega(self, sto): f"{Domain} electrode partial molar volume [m3.mol-1]", inputs ) + def E(self, sto, T): + """Dimensional Young's modulus""" + Domain = self.domain.capitalize() + inputs = {f"{Domain} particle stoichiometry": sto, "Temperature [K]": T} + return pybamm.FunctionParameter( + f"{Domain} electrode Young's modulus [Pa]", inputs + ) + def sigma(self, T): """Dimensional electrical conductivity in electrode""" inputs = {"Temperature [K]": T} From 31e08c78a75a52cbabe774deff98d8a50cdf5c46 Mon Sep 17 00:00:00 2001 From: Alec Bills Date: Mon, 4 Dec 2023 17:10:49 -0800 Subject: [PATCH 4/5] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd9c751af7..0a8d46fc26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Features - Serialisation added so models can be written to/read from JSON ([#3397](https://github.com/pybamm-team/PyBaMM/pull/3397)) +- Mechanical parameters are now a function of stoichiometry ([#3576](https://github.com/pybamm-team/PyBaMM/pull/3576)) ## Bug fixes From 0fd0385f014abb6b4bf555449a18455e990971ea Mon Sep 17 00:00:00 2001 From: Alec Bills Date: Mon, 4 Dec 2023 17:15:34 -0800 Subject: [PATCH 5/5] make partial molar volume also a function of temperature --- CHANGELOG.md | 2 +- pybamm/models/submodels/particle/base_particle.py | 2 +- pybamm/models/submodels/particle_mechanics/base_mechanics.py | 2 +- pybamm/parameters/lithium_ion_parameters.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a8d46fc26..1b8e1a869b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Features - Serialisation added so models can be written to/read from JSON ([#3397](https://github.com/pybamm-team/PyBaMM/pull/3397)) -- Mechanical parameters are now a function of stoichiometry ([#3576](https://github.com/pybamm-team/PyBaMM/pull/3576)) +- Mechanical parameters are now a function of stoichiometry and temperature ([#3576](https://github.com/pybamm-team/PyBaMM/pull/3576)) ## Bug fixes diff --git a/pybamm/models/submodels/particle/base_particle.py b/pybamm/models/submodels/particle/base_particle.py index cd862518f0..0f46615724 100644 --- a/pybamm/models/submodels/particle/base_particle.py +++ b/pybamm/models/submodels/particle/base_particle.py @@ -57,7 +57,7 @@ def _get_effective_diffusivity(self, c, T, current): if stress_option == "true": # Ai2019 eq [12] sto = c / phase_param.c_max - Omega = pybamm.r_average(domain_param.Omega(sto)) + Omega = pybamm.r_average(domain_param.Omega(sto, T)) E = pybamm.r_average(domain_param.E(sto, T)) nu = domain_param.nu theta_M = Omega / (param.R * T) * (2 * Omega * E) / (9 * (1 - nu)) diff --git a/pybamm/models/submodels/particle_mechanics/base_mechanics.py b/pybamm/models/submodels/particle_mechanics/base_mechanics.py index 48f8a08d8f..35adadf47d 100644 --- a/pybamm/models/submodels/particle_mechanics/base_mechanics.py +++ b/pybamm/models/submodels/particle_mechanics/base_mechanics.py @@ -52,7 +52,7 @@ def _get_mechanical_results(self, variables): #use a tangential approximation for omega sto = variables[f"{Domain} particle concentration"] - Omega = pybamm.r_average(domain_param.Omega(sto)) + Omega = pybamm.r_average(domain_param.Omega(sto, T)) R0 = domain_param.prim.R c_0 = domain_param.c_0 E0 = pybamm.r_average(domain_param.E(sto, T)) diff --git a/pybamm/parameters/lithium_ion_parameters.py b/pybamm/parameters/lithium_ion_parameters.py index 8bab4b2c4a..12196c4044 100644 --- a/pybamm/parameters/lithium_ion_parameters.py +++ b/pybamm/parameters/lithium_ion_parameters.py @@ -346,10 +346,10 @@ def C_dl(self, T): f"{Domain} electrode double-layer capacity [F.m-2]", inputs ) - def Omega(self, sto): + def Omega(self, sto, T): """Dimensional partial molar volume of Li in solid solution [m3.mol-1]""" Domain = self.domain.capitalize() - inputs = {f"{Domain} particle stoichiometry": sto} + inputs = {f"{Domain} particle stoichiometry": sto, "Temperature [K]": T} return pybamm.FunctionParameter( f"{Domain} electrode partial molar volume [m3.mol-1]", inputs )