I'm trying to use the EnsembleProblem
feature, where in my case prob
is a DynamicalODEProblem(f1, f2, v0, u0, tspan)
. I'd like my ensemble to span different initial conditions for the same ODE.
Example 1 in this tutorial explains how to establish an ensemble with a general ODEProblem
. For a DynamicalODEProblem
, though, I can't find a way to specify prob_func
without getting a compilation error. The issue that I get is that there doesn't seem to find a compatible overload of remake
that does the trick. My initial attempt was
function prob_func(prob, i, repeat)
remake(prob, v0[i], u0[i])
end
but compiler complains that this isn't compatible with the two supported overloads
remake(::SciMLBase.ODEProblem; f, u0, tspan, p, kwargs, _kwargs...)
and
remake(::Any; kwargs...)
I also tried wrapping v0
and u0
using an ArrayPartition
, but it didn't work either.
In short: how can I define an EnsembleProblem
where prob
is a DynamicalODEProblem
?
I found the solution: simply write the kwarg
for u0
explicitly when using ArrayPartition
:
function prob_func(prob, i, repeat)
remake(prob, u0=ArrayPartition(v0[i], u0[i]))
end