Hi,
I keep getting the solver error:
2025-07-25 10:44:02.905 - [ERROR] callbacks.on_experiment_error(233): Simulation error: FAILURE IDA_CONV_FAIL: Convergence test failures occurred too many times during one internal time step or minimum step size was reached.
[IDAS ERROR] IDASolve
At t = 254878 and h = 1e-06, the corrector convergence failed repeatedly or with |h| = hmin. This occurs after a certain number of cycles. I am trying to emulate the parameters from this paper: Lithium-ion battery degradation: how to model it - Physical Chemistry Chemical Physics (RSC Publishing)
import pybamm
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pouch import get_parameter_values_pouch
import matplotlib.ticker as mticker
from scipy.signal import find_peaks
# Load the CSV file
graphite_deg = np.loadtxt("graphite_deg.csv", delimiter=",", skiprows=1)
cycle = graphite_deg[:, 0] # Cycle number
E_dis = graphite_deg[:, 1] # Discharged energy
cycle = cycle
E_dis = E_dis # Discharged energy
model1 = pybamm.lithium_ion.SPMe(
{
"SEI": "solvent-diffusion limited",
"SEI porosity change": "true",
"lithium plating": "partially reversible",
"lithium plating porosity change": "true", # alias for "SEI porosity change"
"particle mechanics": "swelling and cracking",
"SEI on cracks": "true",
"loss of active material": "stress-driven",
"thermal": "lumped",
}
)
param = pybamm.ParameterValues("OKane2022")
cycle_number = 350
def graphite_cracking_rate_Ai2020(T_dim):
k_cr = 3.9e-20 * 25
Eac_cr = 0 # to be implemented
arrhenius = np.exp(Eac_cr / pybamm.constants.R * (1 / T_dim - 1 / 298.15))
return k_cr * arrhenius
param.update({
"SEI solvent diffusivity [m2.s-1]":5e-22,
"Dead lithium decay constant [s-1]": 1e-5,
"Negative electrode cracking rate": graphite_cracking_rate_Ai2020,
"Negative electrode LAM constant proportional term [s-1]": 2.5e-06 ,
"Ambient temperature [K]": 273.15+37, # accelerate degradation temperature
})
Q_nom = param["Nominal cell capacity [A.h]"]
param.update({"Total heat transfer coefficient [W.m-2.K-1]" : 150, })
param.set_initial_stoichiometries(1)
exp = pybamm.Experiment(
# [
# "Hold at 4.2 V until C/100",
# "Rest for 4 hours",
# "Discharge at 0.1C until 2.5 V", # initial capacity check
# "Charge at 0.3C until 4.2 V",
# "Hold at 4.2 V until C/100",
# ]
[
(
"Discharge at 1.5C until 2.5 V", # ageing cycles
# "Charge at 3C until 4.2 V",
"Charge at 1.5C until 4.2 V",
"Hold at 4.2 V until C/3",
)
]
* cycle_number
# + ["Discharge at 0.1C until 2.5 V"], # final capacity check
)
solver = pybamm.IDAKLUSolver(
rtol=3e-3,
atol=3e-3,
options={
"dt_max": 10,
"dt_min": 1e-6,
"max_num_steps": 5000,
"print_stats": False,
},
)
var_pts = {"x_n": 6, "x_s": 6, "x_p": 6, "r_n": 6, "r_p": 6}
sim1 = pybamm.Simulation(
model1, parameter_values=param, experiment=exp, solver=solver, var_pts=var_pts
)
If anyone has any ideas about why this happens, please let me know!
Thanks



