How do I force solve_ivp to take a smaller time step from within the function it calls

164 Views Asked by At

I have a function call of the form

ans = scipy.integrate.solve_ivp(dfdz, zbounds, f0, method='RK45', args=argslist, t_eval = zspan, vectorized=True)

If the solver takes a timestep that's too big, dfdz will sometimes fail to converge. I want dfdz to be able to force the solver to take a smaller step. How do I do this?

I tried to have dfdz return -f (i.e. "in this time step, all values become zero") hoping that would lead to non-convergence, or at least make it obvious that it failed. Instead, I see cases where my output ans jumps down, but not all the way to zero, and then the solver keeps integrating as if nothing happened.

1

There are 1 best solutions below

1
Spaceman98 On

It appears that Julia offers the capabilities I need https://www.youtube.com/live/KPEqYtEd-zY?si=zveHs2rYd518PBoD

I'm still working it out for my code, but this tutorial has been very helpful so I'm posting it here for anyone else who has the same question and finds this thread

EDIT: I was asked to clarify. As discussed here https://docs.sciml.ai/DiffEqDocs/stable/basics/faq/ isoutofdomain does what I asked for in the opening question.