Implement Discontinuity Detection Algorithm#3121
Conversation
|
|
| fsallast::FSALType | ||
| rng::RNGType | ||
| #disco_prob::IntervalNonlinearProblem | ||
| disco_probs::Vector{IntervalNonlinearProblem} #should we change this? |
There was a problem hiding this comment.
yeah what Oscar and I had discussed was that once the callbacks are function wrapped we would store a single disco_prob and remake it each time, instead of storing a vector of all of them. Not sure if you had another approach in mind though
| @inline zero_condition(cb::ContinuousCallback, out::Nothing, u, t, z, ind) = cb.condition(u, t, z) | ||
| @inline function zero_condition(cb::VectorContinuousCallback, out, u, t, z, ind) | ||
| cb.condition(out, u, t, z) | ||
| return out[ind] |
| return zero_condition(z.callback, z.out, z.u₁, z.dt + θ * z.dt, z, z.ind) | ||
| end | ||
|
|
||
| @inline zero_condition(cb::ContinuousCallback, out::Nothing, u, t, z, ind) = cb.condition(u, t, z) | ||
| @inline function zero_condition(cb::VectorContinuousCallback, out, u, t, z, ind) |
There was a problem hiding this comment.
this seems like code smell... it needs to do the whole array not an ind.
There was a problem hiding this comment.
but for a VCC we want to check per condition if it was hit, so the approach in disco is to iterate over the entire VCC and find the components that could be the discontinuity:
i.condition(out_prev, uprev, t, integrator)
i.condition(out_curr, u, t + dt, integrator)
for j in 1:len_cb
if (out_prev[j] * out_curr[j] < zero(out_prev[j]))
disco_zero.ind = j
sol = solve(disco_prob; bracket = bracket)
tmp = sol[]
if (!isnan(tmp) && (breakpointθ == -1 || tmp < breakpointθ))
breakpointθ = tmp
end
end
end
So we do disco on each index of the VCC that could have triggered the step reject
|
@ChrisRackauckas @oscardssmith If you could review when you get a chance, that would be great. Test failures seem to be a strange error independent of this. |
|
The CI machine maybe ran out of disk space? |
|
The test failure looks real. |
I'm not really sure what is failing here (e.g. failure in AD test), |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
A preliminary implementation of autonomous discontinuity detection in Radau. Uses a PR to SciML base at SciML/SciMLBase.jl#1219 to modify callbacks to support a is_discontinuous flag.