NDSolve cannot do a discontinuity replacement for event surfaces that depend only on time
NDSolve::nderr
Error test failure at t==…; unable to continue
which searching on google does not offer that much of the results!
I have found some relevant posts and documentations. It seems that I have to use a helper function or something like that using Piecewise and/or WhenEvent functions but I can’t get my head around it!
I would appreciate if you could explain why this error happens and how I can modify my code to avoid it?
also that error is a warning about accuracy. At the discontinuity it can’t keep the requested accuracy (machine precision). Adjust AccuracyGoal and WorkingPrecision to fit your problem with appropriate accuracy. This is not unexpected given the sudden change.