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

[Bug]: #4075

Closed
Not-slytherin opened this issue May 8, 2024 · 2 comments
Closed

[Bug]: #4075

Not-slytherin opened this issue May 8, 2024 · 2 comments
Assignees
Labels
bug Something isn't working needs-reply Needs further information from the author and may be closed if no response is received

Comments

@Not-slytherin
Copy link

PyBaMM Version

23.4.1

Python Version

3.11.5

Describe the bug

I wanted to perform a simulation for a pouch cell and based on the provided example of the model i just simply run the code but it keeps on giving the following error.
I also have a problem on the other hand when i change the capacity of the cell from 5 to 65 Ah. it gives a debug and i know it's because i should also change gemetrical parameters besides concentrations and so on. So, knowing that all the parameters set are for cylindrical cells, can you please indicate to me where i can find Electrochemical model parameters of a pouch cell so i can get close and help the model perform the simulation with less excpected errors.

Thank you for your understanding,

Steps to Reproduce

import pybamm
import matplotlib.pyplot as plt
import numpy as np

param= pybamm.ParameterValues("OKane2022")
dfn = pybamm.lithium_ion.DFN( {"current collector": "potential pair", "dimensionality": 2, "thermal": "x-lumped"},

)
npts = 16
var_pts = {
"x_n": npts,
"x_s": npts,
"x_p": npts,
"r_n": npts,
"r_p": npts,
"z": npts,
}
experiment = pybamm.Experiment(
[
(
"Charge at 0.5 C for 4 hours or until 4.2 V",
"Rest for 30 minutes",
"Discharge at 0.5 C for 4 hours or until 2.5 V",
"Rest for 7 hours",
),
]
* 3
+ [
(
"Charge at 26 A for 2 hours or until 4.2 V",
)
]
)

Create a simulation with the model and experiment

sim = pybamm.Simulation(model=dfn, experiment=experiment, parameter_values=param, var_pts=var_pts)

Solve the simulation

sim.solve()

Relevant log output

The followin erros is the response of the simulation code provided:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Division(0x82d8dea9f08b64c, /, children=['laplacian(X-averaged cell temperature [K]) + mass(X-averaged cell temperature [K]) @ ((Negative current collector thickness [m] * Negative current collector conductivity [S.m-1] * grad squared(Negative current collector potential [V]) + (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m]) * (((Negative electrode thickness [m] * x-average(-(-Negative electrode conductivity [S.m-1] * (Negative electrode active material volume fraction ** Negative electrode Bruggeman coefficient (electrode)) * grad(Negative electrode potential [V])) inner product grad(Negative electrode potential [V])) + Positive electrode thickness [m] * x-average(-(-Positive electrode conductivity [S.m-1] * (Positive electrode active material volume fraction ** Positive electrode Bruggeman coefficient (electrode)) * grad(Positive electrode potential [V])) inner product grad(Positive electrode potential [V]))) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m])) - x-average((Electrolyte conductivity [S.m-1] * concatenation(Negative electrode porosity ** Negative electrode Bruggeman coefficient (electrolyte), Separator porosity ** Separator Bruggeman coefficient (electrolyte), Positive electrode porosity ** Positive electrode Bruggeman coefficient (electrolyte)) * (((broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K] / Faraday constant [C.mol-1]) * (2.0 - (2.0 * Cation transference number)) * Thermodynamic factor / (maximum(Porosity times concentration [mol.m-3](Negative electrode porosity times concentration [mol.m-3], Separator porosity times concentration [mol.m-3], Positive electrode porosity times concentration [mol.m-3]) / concatenation(Negative electrode porosity, Separator porosity, Positive electrode porosity), 0.01))) * grad(Porosity times concentration [mol.m-3](Negative electrode porosity times concentration [mol.m-3], Separator porosity times concentration [mol.m-3], Positive electrode porosity times concentration [mol.m-3]) / concatenation(Negative electrode porosity, Separator porosity, Positive electrode porosity))) - grad(Electrolyte potential [V](Negative electrolyte potential [V], Separator electrolyte potential [V], Positive electrolyte potential [V])))) inner product grad(Electrolyte potential [V](Negative electrolyte potential [V], Separator electrolyte potential [V], Positive electrolyte potential [V]))) + (Negative electrode thickness [m] * x-average((3.0 * Negative electrode active material volume fraction / Negative particle radius [m]) * 2.0 * Negative electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1]))) + Positive electrode thickness [m] * x-average((3.0 * Positive electrode active material volume fraction / Positive particle radius [m]) * 2.0 * Positive electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])))) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m]) + (Negative electrode thickness [m] * x-average((3.0 * Negative electrode active material volume fraction / Negative particle radius [m]) * 2.0 * Negative electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * broadcast(X-averaged cell temperature [K]) * Negative electrode OCP entropic change [V.K-1]) + Positive electrode thickness [m] * x-average((3.0 * Positive electrode active material volume fraction / Positive particle radius [m]) * 2.0 * Positive electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * broadcast(X-averaged cell temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m])) + Positive current collector thickness [m] * Positive current collector conductivity [S.m-1] * grad squared(boundary value(Positive electrode potential [V]))) / (Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m])) + (-Negative current collector surface heat transfer coefficient [W.m-2.K-1] + Positive current collector surface heat transfer coefficient [W.m-2.K-1] * Electrode width [m] * Electrode height [m] / ((Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m]) * Electrode width [m] * Electrode height [m])) * (mass(X-averaged cell temperature [K]) @ (X-averaged cell temperature [K] - Ambient temperature [K])) - (Edge heat transfer coefficient [W.m-2.K-1] * (boundary mass(X-averaged cell temperature [K]) @ (X-averaged cell temperature [K] - Ambient temperature [K])))', '(Negative current collector density [kg.m-3] * Negative current collector specific heat capacity [J.kg-1.K-1] * Negative current collector thickness [m] + Negative electrode density [kg.m-3] * Negative electrode specific heat capacity [J.kg-1.K-1] * Negative electrode thickness [m] + Separator density [kg.m-3] * Separator specific heat capacity [J.kg-1.K-1] * Separator thickness [m] + Positive electrode density [kg.m-3] * Positive electrode specific heat capacity [J.kg-1.K-1] * Positive electrode thickness [m] + Positive current collector density [kg.m-3] * Positive current collector specific heat capacity [J.kg-1.K-1] * Positive current collector thickness [m]) / (Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m])'], domains={'primary': ['current collector']})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Subtraction(-0x6bfae11aa4d97a43, -, children=['laplacian(X-averaged cell temperature [K]) + mass(X-averaged cell temperature [K]) @ ((Negative current collector thickness [m] * Negative current collector conductivity [S.m-1] * grad squared(Negative current collector potential [V]) + (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m]) * (((Negative electrode thickness [m] * x-average(-(-Negative electrode conductivity [S.m-1] * (Negative electrode active material volume fraction ** Negative electrode Bruggeman coefficient (electrode)) * grad(Negative electrode potential [V])) inner product grad(Negative electrode potential [V])) + Positive electrode thickness [m] * x-average(-(-Positive electrode conductivity [S.m-1] * (Positive electrode active material volume fraction ** Positive electrode Bruggeman coefficient (electrode)) * grad(Positive electrode potential [V])) inner product grad(Positive electrode potential [V]))) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m])) - x-average((Electrolyte conductivity [S.m-1] * concatenation(Negative electrode porosity ** Negative electrode Bruggeman coefficient (electrolyte), Separator porosity ** Separator Bruggeman coefficient (electrolyte), Positive electrode porosity ** Positive electrode Bruggeman coefficient (electrolyte)) * (((broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K] / Faraday constant [C.mol-1]) * (2.0 - (2.0 * Cation transference number)) * Thermodynamic factor / (maximum(Porosity times concentration [mol.m-3](Negative electrode porosity times concentration [mol.m-3], Separator porosity times concentration [mol.m-3], Positive electrode porosity times concentration [mol.m-3]) / concatenation(Negative electrode porosity, Separator porosity, Positive electrode porosity), 0.01))) * grad(Porosity times concentration [mol.m-3](Negative electrode porosity times concentration [mol.m-3], Separator porosity times concentration [mol.m-3], Positive electrode porosity times concentration [mol.m-3]) / concatenation(Negative electrode porosity, Separator porosity, Positive electrode porosity))) - grad(Electrolyte potential [V](Negative electrolyte potential [V], Separator electrolyte potential [V], Positive electrolyte potential [V])))) inner product grad(Electrolyte potential [V](Negative electrolyte potential [V], Separator electrolyte potential [V], Positive electrolyte potential [V]))) + (Negative electrode thickness [m] * x-average((3.0 * Negative electrode active material volume fraction / Negative particle radius [m]) * 2.0 * Negative electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1]))) + Positive electrode thickness [m] * x-average((3.0 * Positive electrode active material volume fraction / Positive particle radius [m]) * 2.0 * Positive electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])))) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m]) + (Negative electrode thickness [m] * x-average((3.0 * Negative electrode active material volume fraction / Negative particle radius [m]) * 2.0 * Negative electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * broadcast(X-averaged cell temperature [K]) * Negative electrode OCP entropic change [V.K-1]) + Positive electrode thickness [m] * x-average((3.0 * Positive electrode active material volume fraction / Positive particle radius [m]) * 2.0 * Positive electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * broadcast(X-averaged cell temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m])) + Positive current collector thickness [m] * Positive current collector conductivity [S.m-1] * grad squared(boundary value(Positive electrode potential [V]))) / (Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m])) + (-Negative current collector surface heat transfer coefficient [W.m-2.K-1] + Positive current collector surface heat transfer coefficient [W.m-2.K-1] * Electrode width [m] * Electrode height [m] / ((Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m]) * Electrode width [m] * Electrode height [m])) * (mass(X-averaged cell temperature [K]) @ (X-averaged cell temperature [K] - Ambient temperature [K]))', 'Edge heat transfer coefficient [W.m-2.K-1] * (boundary mass(X-averaged cell temperature [K]) @ (X-averaged cell temperature [K] - Ambient temperature [K]))'], domains={'primary': ['current collector']})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Addition(-0x46673e66c8f10b76, +, children=['laplacian(X-averaged cell temperature [K]) + mass(X-averaged cell temperature [K]) @ ((Negative current collector thickness [m] * Negative current collector conductivity [S.m-1] * grad squared(Negative current collector potential [V]) + (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m]) * (((Negative electrode thickness [m] * x-average(-(-Negative electrode conductivity [S.m-1] * (Negative electrode active material volume fraction ** Negative electrode Bruggeman coefficient (electrode)) * grad(Negative electrode potential [V])) inner product grad(Negative electrode potential [V])) + Positive electrode thickness [m] * x-average(-(-Positive electrode conductivity [S.m-1] * (Positive electrode active material volume fraction ** Positive electrode Bruggeman coefficient (electrode)) * grad(Positive electrode potential [V])) inner product grad(Positive electrode potential [V]))) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m])) - x-average((Electrolyte conductivity [S.m-1] * concatenation(Negative electrode porosity ** Negative electrode Bruggeman coefficient (electrolyte), Separator porosity ** Separator Bruggeman coefficient (electrolyte), Positive electrode porosity ** Positive electrode Bruggeman coefficient (electrolyte)) * (((broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K] / Faraday constant [C.mol-1]) * (2.0 - (2.0 * Cation transference number)) * Thermodynamic factor / (maximum(Porosity times concentration [mol.m-3](Negative electrode porosity times concentration [mol.m-3], Separator porosity times concentration [mol.m-3], Positive electrode porosity times concentration [mol.m-3]) / concatenation(Negative electrode porosity, Separator porosity, Positive electrode porosity), 0.01))) * grad(Porosity times concentration [mol.m-3](Negative electrode porosity times concentration [mol.m-3], Separator porosity times concentration [mol.m-3], Positive electrode porosity times concentration [mol.m-3]) / concatenation(Negative electrode porosity, Separator porosity, Positive electrode porosity))) - grad(Electrolyte potential [V](Negative electrolyte potential [V], Separator electrolyte potential [V], Positive electrolyte potential [V])))) inner product grad(Electrolyte potential [V](Negative electrolyte potential [V], Separator electrolyte potential [V], Positive electrolyte potential [V]))) + (Negative electrode thickness [m] * x-average((3.0 * Negative electrode active material volume fraction / Negative particle radius [m]) * 2.0 * Negative electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1]))) + Positive electrode thickness [m] * x-average((3.0 * Positive electrode active material volume fraction / Positive particle radius [m]) * 2.0 * Positive electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])))) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m]) + (Negative electrode thickness [m] * x-average((3.0 * Negative electrode active material volume fraction / Negative particle radius [m]) * 2.0 * Negative electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Negative electrode potential [V] - Negative electrolyte potential [V] - (Negative electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Negative particle concentration [mol.m-3]) / Maximum concentration in negative electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Negative electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * broadcast(X-averaged cell temperature [K]) * Negative electrode OCP entropic change [V.K-1]) + Positive electrode thickness [m] * x-average((3.0 * Positive electrode active material volume fraction / Positive particle radius [m]) * 2.0 * Positive electrode exchange-current density [A.m-2] * sinh(0.5 * Faraday constant [C.mol-1] * (Positive electrode potential [V] - Positive electrolyte potential [V] - (Positive electrode OCP [V] + 1e-06 * (1.0 / (maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10)) + 1.0 / (-1.0 + maximum(minimum(boundary value(Positive particle concentration [mol.m-3]) / Maximum concentration in positive electrode [mol.m-3], 0.9999999999), 1e-10))) + broadcast(X-averaged cell temperature [K] - Reference temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / broadcast(Ideal gas constant [J.K-1.mol-1] * X-averaged cell temperature [K])) * broadcast(X-averaged cell temperature [K]) * Positive electrode OCP entropic change [V.K-1])) / (Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m])) + Positive current collector thickness [m] * Positive current collector conductivity [S.m-1] * grad squared(boundary value(Positive electrode potential [V]))) / (Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m]))', '(-Negative current collector surface heat transfer coefficient [W.m-2.K-1] + Positive current collector surface heat transfer coefficient [W.m-2.K-1] * Electrode width [m] * Electrode height [m] / ((Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m]) * Electrode width [m] * Electrode height [m])) * (mass(X-averaged cell temperature [K]) @ (X-averaged cell temperature [K] - Ambient temperature [K]))'], domains={'primary': ['current collector']})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Multiplication(-0x43c650a4a2d61789, *, children=['-Negative current collector surface heat transfer coefficient [W.m-2.K-1] + Positive current collector surface heat transfer coefficient [W.m-2.K-1] * Electrode width [m] * Electrode height [m] / ((Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m]) * Electrode width [m] * Electrode height [m])', 'mass(X-averaged cell temperature [K]) @ (X-averaged cell temperature [K] - Ambient temperature [K])'], domains={'primary': ['current collector']})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Division(0x3f3bb03b781a0760, /, children=['-Negative current collector surface heat transfer coefficient [W.m-2.K-1] + Positive current collector surface heat transfer coefficient [W.m-2.K-1] * Electrode width [m] * Electrode height [m]', '(Negative current collector thickness [m] + Negative electrode thickness [m] + Separator thickness [m] + Positive electrode thickness [m] + Positive current collector thickness [m]) * Electrode width [m] * Electrode height [m]'], domains={})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Multiplication(-0x605d72555302e247, *, children=['-Negative current collector surface heat transfer coefficient [W.m-2.K-1] + Positive current collector surface heat transfer coefficient [W.m-2.K-1]', 'Electrode width [m] * Electrode height [m]'], domains={})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Negate(0x2fe5775dc7290b90, -, children=['Negative current collector surface heat transfer coefficient [W.m-2.K-1] + Positive current collector surface heat transfer coefficient [W.m-2.K-1]'], domains={})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Addition(-0xe176f9839e7d06f, +, children=['Negative current collector surface heat transfer coefficient [W.m-2.K-1]', 'Positive current collector surface heat transfer coefficient [W.m-2.K-1]'], domains={})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:603, in ParameterValues.process_symbol(self, symbol)
    602 try:
--> 603     return self._processed_symbols[symbol]
    604 except KeyError:

KeyError: Parameter(0x7d465596b4201e71, Negative current collector surface heat transfer coefficient [W.m-2.K-1], children=[], domains={})

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\util.py:58, in FuzzyDict.__getitem__(self, key)
     57 try:
---> 58     return super().__getitem__(key)
     59 except KeyError:

KeyError: 'Negative current collector surface heat transfer coefficient [W.m-2.K-1]'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
Cell In[34], line 34
     31 sim = pybamm.Simulation(model=dfn, experiment=experiment, parameter_values=param, var_pts=var_pts)
     33 # Solve the simulation
---> 34 sim.solve()

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\simulation.py:653, in Simulation.solve(self, t_eval, solver, check_model, save_at_cycles, calc_esoh, starting_solution, initial_soc, callbacks, showprogress, **kwargs)
    651 elif self.operating_mode == "with experiment":
    652     callbacks.on_experiment_start(logs)
--> 653     self.build_for_experiment(check_model=check_model, initial_soc=initial_soc)
    654     if t_eval is not None:
    655         pybamm.logger.warning(
    656             "Ignoring t_eval as solution times are specified by the experiment"
    657         )

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\simulation.py:483, in Simulation.build_for_experiment(self, check_model, initial_soc)
    481     return
    482 else:
--> 483     self.set_up_and_parameterise_experiment()
    485     # Can process geometry with default parameter values (only electrical
    486     # parameters change between parameter values)
    487     self._parameter_values.process_geometry(self._geometry)

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\simulation.py:217, in Simulation.set_up_and_parameterise_experiment(self)
    214     op_conds["time"] = dt
    216 # Set up model for experiment
--> 217 self.set_up_and_parameterise_model_for_experiment()

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\simulation.py:290, in Simulation.set_up_and_parameterise_model_for_experiment(self)
    286 if submodel is not None:
    287     new_parameter_values["Current function [A]"] = submodel.variables[
    288         "Current [A]"
    289     ]
--> 290 parameterised_model = new_parameter_values.process_model(
    291     new_model, inplace=False
    292 )
    293 self.op_string_to_model[op["string"]] = parameterised_model

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:438, in ParameterValues.process_model(self, unprocessed_model, inplace)
    434     pybamm.logger.verbose(
    435         "Processing parameters for {!r} (rhs)".format(variable)
    436     )
    437     new_variable = self.process_symbol(variable)
--> 438     new_rhs[new_variable] = self.process_symbol(equation)
    439 model.rhs = new_rhs
    441 new_algebraic = {}

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:716, in ParameterValues._process_symbol(self, symbol)
    712     return self.process_symbol(function_out)
    714 elif isinstance(symbol, pybamm.BinaryOperator):
    715     # process children
--> 716     new_left = self.process_symbol(symbol.left)
    717     new_right = self.process_symbol(symbol.right)
    718     # make new symbol, ensure domain remains the same

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:716, in ParameterValues._process_symbol(self, symbol)
    712     return self.process_symbol(function_out)
    714 elif isinstance(symbol, pybamm.BinaryOperator):
    715     # process children
--> 716     new_left = self.process_symbol(symbol.left)
    717     new_right = self.process_symbol(symbol.right)
    718     # make new symbol, ensure domain remains the same

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:717, in ParameterValues._process_symbol(self, symbol)
    714 elif isinstance(symbol, pybamm.BinaryOperator):
    715     # process children
    716     new_left = self.process_symbol(symbol.left)
--> 717     new_right = self.process_symbol(symbol.right)
    718     # make new symbol, ensure domain remains the same
    719     new_symbol = symbol._binary_new_copy(new_left, new_right)

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:716, in ParameterValues._process_symbol(self, symbol)
    712     return self.process_symbol(function_out)
    714 elif isinstance(symbol, pybamm.BinaryOperator):
    715     # process children
--> 716     new_left = self.process_symbol(symbol.left)
    717     new_right = self.process_symbol(symbol.right)
    718     # make new symbol, ensure domain remains the same

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:716, in ParameterValues._process_symbol(self, symbol)
    712     return self.process_symbol(function_out)
    714 elif isinstance(symbol, pybamm.BinaryOperator):
    715     # process children
--> 716     new_left = self.process_symbol(symbol.left)
    717     new_right = self.process_symbol(symbol.right)
    718     # make new symbol, ensure domain remains the same

    [... skipping similar frames: ParameterValues.process_symbol at line 605 (1 times)]

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:716, in ParameterValues._process_symbol(self, symbol)
    712     return self.process_symbol(function_out)
    714 elif isinstance(symbol, pybamm.BinaryOperator):
    715     # process children
--> 716     new_left = self.process_symbol(symbol.left)
    717     new_right = self.process_symbol(symbol.right)
    718     # make new symbol, ensure domain remains the same

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:725, in ParameterValues._process_symbol(self, symbol)
    723 # Unary operators
    724 elif isinstance(symbol, pybamm.UnaryOperator):
--> 725     new_child = self.process_symbol(symbol.child)
    726     new_symbol = symbol._unary_new_copy(new_child)
    727     # ensure domain remains the same

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:716, in ParameterValues._process_symbol(self, symbol)
    712     return self.process_symbol(function_out)
    714 elif isinstance(symbol, pybamm.BinaryOperator):
    715     # process children
--> 716     new_left = self.process_symbol(symbol.left)
    717     new_right = self.process_symbol(symbol.right)
    718     # make new symbol, ensure domain remains the same

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:605, in ParameterValues.process_symbol(self, symbol)
    603     return self._processed_symbols[symbol]
    604 except KeyError:
--> 605     processed_symbol = self._process_symbol(symbol)
    606     self._processed_symbols[symbol] = processed_symbol
    608     return processed_symbol

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:614, in ParameterValues._process_symbol(self, symbol)
    611 """See :meth:`ParameterValues.process_symbol()`."""
    613 if isinstance(symbol, pybamm.Parameter):
--> 614     value = self[symbol.name]
    615     if isinstance(value, numbers.Number):
    616         # Check not NaN (parameter in csv file but no value given)
    617         if np.isnan(value):

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\parameters\parameter_values.py:136, in ParameterValues.__getitem__(self, key)
    135 def __getitem__(self, key):
--> 136     return self._dict_items[key]

File ~\AppData\Local\anaconda3\Lib\site-packages\pybamm\util.py:82, in FuzzyDict.__getitem__(self, key)
     78     if key in k and k.endswith("]"):
     79         raise KeyError(
     80             f"'{key}' not found. Use the dimensional version '{k}' instead."
     81         )
---> 82 raise KeyError(f"'{key}' not found. Best matches are {best_matches}")

KeyError: "'Negative current collector surface heat transfer coefficient [W.m-2.K-1]' not found. Best matches are ['Negative current collector thermal conductivity [W.m-1.K-1]', 'Negative current collector specific heat capacity [J.kg-1.K-1]', 'Total heat transfer coefficient [W.m-2.K-1]']"
@Not-slytherin Not-slytherin added the bug Something isn't working label May 8, 2024
@kratman
Copy link
Contributor

kratman commented May 15, 2024

@Not-slytherin Sorry for the slow response.

Unfortunately not all of the models are compatible with every option in PyBaMM. In this case your 2D simulation with x-lumped thermal requires the parameter: "Negative current collector surface heat transfer coefficient [W.m-2.K-1]", which is only properly defined in Ecker2015. A bunch of the other parameter sets define that variable to be zero, which effectively removes that aspect of the thermal model.

You could set those parameters to be zero with the understanding that the thermal analysis may be incomplete, or you can change the setup.

For example the following should work for a pouch cell with OKane2022:

import pybamm

param = pybamm.ParameterValues("OKane2022")
dfn = pybamm.lithium_ion.DFN({"cell geometry": "pouch", "thermal": "lumped"})
experiment = pybamm.Experiment(
    [
        (
            "Charge at 0.5 C for 4 hours or until 4.2 V",
            "Rest for 30 minutes",
            "Discharge at 0.5 C for 4 hours or until 2.5 V",
            "Rest for 7 hours",
        ),
    ] * 3
        +
    [
        (
            "Charge at 26 A for 2 hours or until 4.2 V",
        )
    ]
)
sim = pybamm.Simulation(model=dfn, experiment=experiment, parameter_values=param)
sim.solve()

This might not be the exact geometry/configuration you want, but gets you started.

@kratman
Copy link
Contributor

kratman commented May 15, 2024

Let me know if that helps

@kratman kratman added the needs-reply Needs further information from the author and may be closed if no response is received label May 15, 2024
@kratman kratman self-assigned this May 20, 2024
@kratman kratman closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-reply Needs further information from the author and may be closed if no response is received
Projects
None yet
Development

No branches or pull requests

2 participants