I am trying to solve a DFN model with Current collector, thermal, lithium plating, and active material loss submodels. Unfortunately, I cannot share an MWE because the calibration is confidential. I am using the IDAKLU solver with tolerances around 1e-3.
The solver can converge when running at C/10, but it cannot converge at 1C. I have tried adjusting the solver settings (tolerances, number of steps, dt, etc.), but none of them work. Is there any other trick I could try or any other ideas?
Here’s the error I get!
File “/users/PAS0668/appana3/MSMD/PybammPlating/src/pybamm/solvers/base_solver.py”, line 1364, in step
solutions = self._integrate(model, t_eval, [model_inputs], t_interp)
File “/users/PAS0668/appana3/MSMD/PybammPlating/src/pybamm/solvers/idaklu_solver.py”, line 883, in _integrate
return [
File “/users/PAS0668/appana3/MSMD/PybammPlating/src/pybamm/solvers/idaklu_solver.py”, line 884, in
self._post_process_solution(soln, model, integration_time, inputs_dict)
File “/users/PAS0668/appana3/MSMD/PybammPlating/src/pybamm/solvers/idaklu_solver.py”, line 925, in _post_process_solution
raise pybamm.SolverError(f"FAILURE {self._solver_flag(sol.flag)}")
pybamm.expression_tree.exceptions.SolverError: FAILURE IDA_CONV_FAIL: Convergence test failures occurred too many times during one internal time step or minimum step size was reached.
Thank you
Hi there,
I’d suggest trying the following:
-
Meshing: Increase the mesh size/points for NE and PE (and for other domains like the separator if needed). The LAM models are highly sensitive to meshing, which can lead to solver or consistent state errors.
-
Experiment setup: Consider starting your experiment with a rest step first (or a CV hold), followed by the discharge step. This often improves stability as well.
Please let us know if this helps.
Best regards,
Sunil
Hi Sunil,
Thank you for responding!
Currently, I use a very coarse mesh (see below).
var = pybamm.standard_spatial_vars
var_pts = {
var.x_n: 10, # negative electrode
var.x_s: 5, # separator
var.x_p: 10, # positive electrode
var.r_n: 5, # negative particle
var.r_p: 5, # positive particle
var.y: 5,
var.z: 5
}
If I increase the mesh size, the terminal just gets killed without any notice/info.
When I use a custom experiment to add rest before the charging phase, I get the following error. This usually happens when I try to run a multi-step experiment with multiple submodels
raise NotImplementedError(f"Shape not recognized for {base_variables[0]}")
NotImplementedError: Shape not recognized for 32000.0 * y[2:1252]
Hi Appana,
Could you please share the snippet of your code so that I can about how you setup your experiment, the model options, the parameter set used and setting simulation till sim.solve(). This would be helpful in understanding your query better.
Regards,
Sunil
Hi Sunil,
Here’s the code snippet. I use a custom parameter set (cannot share it) and custom thermal and lithium plating models.
options = {"dimensionality": 2, "current collector": "potential pair", "lithium plating": "partially reversible", "thermal":"x-lumped"}
model = pybamm.lithium_ion.DFN(options=options)
parameter_values = pybamm.ParameterValues("Custom")
experiment = pybamm.Experiment(
[
(
"Rest for 60 seconds",
"Charge at 82 A for 100 seconds or until 4.2 V"
)
]
)
var = pybamm.standard_spatial_vars
var_pts = {
var.x_n: 10, # negative electrode
var.x_s: 5, # separator
var.x_p: 10, # positive electrode
var.r_n: 5, # negative particle
var.r_p: 5, # positive particle
var.y: 5,
var.z: 5
}
solver = pybamm.IDAKLUSolver(root_method="casadi",
rtol=1e-3,
atol=1e-3
)
sim = pybamm.Simulation(model,parameter_values=parameter_values, var_pts=var_pts, solver=solver,experiment=experiment)
sim.solve()
Abhishek