SciML / BoundaryValueDiffEq.jl

Boundary value problem (BVP) solvers for scientific machine learning (SciML)
Other
44 stars 35 forks source link

add warning for defect control #257

Open maysam-gholampour opened 1 day ago

maysam-gholampour commented 1 day ago

Is your feature request related to a problem? Please describe.

Yes, I ran my code to solve a two-poimt BVP system with different inputs using FIRK solver, and for some cases, the return code was Failure. However, when I increased the max_num_subintervals, it returned Success as the return code. I reviewed the source code and noticed that for all solvers with defect control (in my case, RadauIIa7), there is an if condition: if 2 * (length(cache.mesh) - 1) > cache.alg.max_num_subintervals This condition sets the return code to Failure. MRE: https://github.com/SciML/BoundaryValueDiffEq.jl/issues/242

Describe the solution you’d like

I believe adding a warning with a recommendation would be helpful in this case. In the SciMLBase documentation, it is mentioned that if the solver is Julia-based solver, an issue can be opened. https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#SciMLBase.ReturnCode.Failure

Describe alternatives you’ve considered

I believe adding a warning with a recommendation would be helpful in this case. The warning should mention not only the failure condition but also indicate that the solver still returns results, which might not be reliable.

Additional context

The code line can be modified for FIRK

maysam-gholampour commented 1 day ago

Just for your information, in my case, I increased the max_num_subintervals to 4000 and the solver returned the retcode as Success. There was a very small difference between the results for default value 3000 and 4000. I mean the results for 3000 was acceptable for me.

ErikQQY commented 1 day ago

Warning users about the maximum number of subintervals being exceeded sounds good to me, also there should be some warnings about the large defect, I can add that