I'm trying to solve an ODE problem (with Julia), that can stop early when a specific condition is satisfied.
Let's say I have a Lorenz system as below
using DifferentialEquations
function lorenz!(du,u)
du[1] = 10.0*(u[2]-u[1]);
du[2] = u[1]*(28.0-u[3]) - u[2];
du[3] = u[1]*u[2] - (8/3)*u[3];
end
u0 = [1.0;0.0;0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz!,u0, tspan);
sol = solve(prob);
And, For example, I want to stop the ODE solver when u[3] is higher than 10, like below.
sol = solve(prob, stopcondition = u[3]>10);
But I'm not sure that there is a possible way to stop ODE solver with a given condition.
Any relevant comments would be thankful :)