Closed gyouhoc closed 3 years ago
Can you try using CasadiSolver("fast with events")
instead?
for me, ("fast with events") doesn't work. I tried three different solver options and "old safe" is working with an warning.
"safe": SolverError: Maximum number of decreased steps occurred at t=0.0. Try solving the model up to this time only or reducing dt_max (currently, dt_max=81.88051713742692).
"fast": SolverError: .../casadi/interfaces/sundials/idas_interface.cpp:569: IDASolve returned "IDA_CONV_FAIL". Consult IDAS documentation.
"old safe": working with an warning psetup failed: .../casadi/interfaces/sundials/idas_interface.cpp:827: Calculating Jacobian failed
Please provide an entire script that can be run to test this
Here is the script and required data.
On Wed, May 26, 2021 at 11:15 AM Valentin Sulzer @.***> wrote:
Please provide an entire script that can be run to test this
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pybamm-team/PyBaMM/issues/1493#issuecomment-848856146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOPG4HUKVTOZEZ2RCUTO2U3TPUF7XANCNFSM45PQUH5Q .
I don't see it
Can you please say the solution to this in case you discussed it
Hey, I have the same issue. Is there a solution to this problem?
Please provide a minimum working example and the full error log, so we can look into it.
Thank you for taking the time. I have attached a minimal working example and full error log.
import pybamm
import matplotlib.pyplot as plt
import numpy as np
model = pybamm.lithium_ion.DFN(
{
"lithium plating": "partially reversible",
"lithium plating porosity change": "true", # alias for "SEI porosity change"
}
)
param = pybamm.ParameterValues("OKane2022")
cycle_number = 1000
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 1C until 2.5 V", # ageing cycles
"Charge at 0.3C until 4.2 V",
"Hold at 4.2 V until C/100",)] * cycle_number
+ ["Discharge at 0.1C until 2.5 V"], # final capacity check
period="5 minutes"
)
sim = pybamm.Simulation(model, parameter_values=param, experiment=exp)
# safe solver
safe_solver = pybamm.CasadiSolver(atol=1e-3, rtol=1e-3, mode="safe", dt_max=100)
sol = sim.solve(solver=safe_solver)
The error message is:
At t = 299.979 and h = 4.56806e-09, the corrector convergence failed repeatedly or with |h| = hmin. 2023-08-07 08:57:26.287 - [ERROR] callbacks.on_experiment_error(224): Simulation error: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:1401: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:330: .../casadi/interfaces/sundials/idas_interface.cpp:596: IDASolve returned "IDA_CONV_FAIL". Consult IDAS documentation. ERROR:pybamm.logger:Simulation error: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:1401: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:330: .../casadi/interfaces/sundials/idas_interface.cpp:596: IDASolve returned "IDA_CONV_FAIL". Consult IDAS documentation.
Using the following solver works for me:
safe_solver = pybamm.CasadiSolver(mode="safe")
Thank you for your answer. I ran the model with your solver. Unfortunately, I still get the following error message after 319/1000 cycles.
""" At t = 299.973 and h = 1.45273e-09, the corrector convergence failed repeatedly or with |h| = hmin. 2023-08-07 19:28:09.253 - [ERROR] callbacks.on_experiment_error(224): Simulation error: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:1401: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:330: .../casadi/interfaces/sundials/idas_interface.cpp:596: IDASolve returned "IDA_CONV_FAIL". Consult IDAS documentation. ERROR:pybamm.logger:Simulation error: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:1401: Error in Function::call for 'F' [IdasInterface] at .../casadi/core/function.cpp:330: .../casadi/interfaces/sundials/idas_interface.cpp:596: IDASolve returned "IDA_CONV_FAIL". Consult IDAS documentation. """
Do you have an idea why this happens? From the IDAS documentation, it is unclear to me what causes the error IDA_CONV_FAIL.
That's strange, mine ran all 1000 cycles. Check that you are using the most recent version of PyBaMM and Casadi.
By separately installing the Casadi Solver, the new version got installed, and it works now - thank you.
%pip install casadi
%pip install pybamm
using pybamm>23.5 will output log like they said. it might be a bug.
By separately installing the Casadi Solver, the new version got installed, and it works now - thank you.
%pip install casadi %pip install pybamm
hello! I met the same problem, could you tell me your casadi and pybamm version? Thank you!
By separately installing the Casadi Solver, the new version got installed, and it works now - thank you.
%pip install casadi %pip install pybamm
hello! I met the same problem, could you tell me your casadi and pybamm version? Thank you!
Look at this: https://github.com/ArnaudOlt/dissertation_pybamm
While I conduct multiple simulation with Pybamm, I find that the simulation generates an infinite loop and causes the python program to be halted.
The script stops here (no response)