isoutofdomain : Specifies a function
isoutofdomain(u,p,t) where, when it returns true, it will reject the timestep. Disabled by default."
That is not really what I need — I don’t want the timestep to be rejected. Would there be any help in that? Won’t the next timestep just do the same thing? I could understand that a timestep perhaps should be rejected if there is some stochasticity involved, but my equation is deterministic, and I’d guess the solver would do the same the next time??
So a little bit more concrete, in my case, state
x or whatever) is a matrix, and I have a model with a first attempt similar to:
#... current attempt
u_ = constrain.(u)
du = f(u_)
if u < 0
elseif u > 1
But this doesn’t hinder the solution to drift out of the range
So, what I look for is something like:
#... new attempt
du = f(u)
where I instead fix the problem via a solver modification.
Question: would the correct be to use a
condition(u,t,integrator) = minimum(u) < 0 || maximum(u) > 1
affect!(integrator) = integrator.u = constrain.(integrator.u)