Optimizing Mesh Size for Smooth Voltage Profiles in aging simulations

Hi everyone,

I’m simulating the aging of an LG M50T 21700 cylindrical cell using a DFN model with ORegan2022 parameters and OKane2022 degradation parameters. My goal is to analyze the voltage profile during CC-CCCV cycling to extract health indicators from my CCCV profile. However, I’ve noticed that the voltage profile becomes quite oscillatory after a few cycles with a small mesh size (x_n = x_s = 5 & x_p = r_p = r_n = 30):

I found that a finer mesh smooths the voltage profile (e.g., changing x_n = x_s = x_p to 10 and r_p = r_n to 60), but my solver (IDAKLUSolver) often crashes with a “the error test failed repeatedly or with |h| = hmin” error:


(The results are showed across different C-rate discharges, but they remain consistent when comparing simulations at the same C-rate discharges.)

Here is my simulation:

parameter_values_ORegan = pybamm.ParameterValues("ORegan2022")
parameter_values_okane = pybamm.ParameterValues("OKane2022")
combined_dict = {**parameter_values_okane, **parameter_values_ORegan}
combined_parameters = pybamm.ParameterValues(combined_dict)
parameter_values_298 = combined_parameters
# -------------------- MODEL ---------------------
model_partially_reversible = pb.lithium_ion.DFN(options={
    "SEI": "interstitial-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", "swelling only"),
    "SEI on cracks": "true",
    "loss of active material": "stress-driven",
    "thermal": "lumped"
})
var_pts = {
    "x_n": 10,
    "x_s": 10,
    "x_p": 10,
    "r_n": 60,
    "r_p": 60,
}

# -------------------------- Experiment --------------------------
cycle_number = 10
rpt_number = 20

inner_cycle = (
    [
        "Discharge at 1C until 2.5 V",
        "Charge at 0.3C until 4.4 V",
        "Hold at 4.4 V until C/100",
    ] * cycle_number +
    ["Discharge at C/10 until 2.5 V"]
) * rpt_number
experiment_298 = pybamm.Experiment(
    [
        # Initial capacity check
        "Discharge at C/10 until 2.5 V",  # Measure initial capacity
        "Charge at 0.3C until 4.4 V",     # CCCV charge
        "Hold at 4.4 V until C/100",
        "Rest for 4 hours",               # Rest to stabilize
    ] + inner_cycle
)

solver = pybamm.IDAKLUSolver(options={"dt_max": 0.0})

sim_298_pr = pb.Simulation(
    model=model_partially_reversible,
    parameter_values=parameter_values_298,
    experiment=experiment_298,
    solver=solver,
    var_pts=var_pts,
)

Do you have any recommendation on the mesh sizes (x_n, x_s, x_p, r_n, r_p) that offer a good trade-off between a smooth voltage profile and computational cost? Any other advice on model settings or solver stability would also be greatly appreciated!

My advice is to not run “swelling and cracking” unless absolutely necessary. Moving to “swelling only” and setting SEI on cracks to “false” will help a lot with stability!