Possibility to convert SciMLBase.SplitODEProblem to SciMLBase.ODEProblem

I was wondering whether there is a neat way of converting a split ODE problem of the form SplitODEProblem{isinplace}(f1,f2,u0,tspan,p=NullParameters();kwargs...)
to an usual ODE problem
ODEProblem{isinplace,specialize}(f,u0,tspan,p=NullParameters();kwargs...).

Mathematically, this corresponds to f_1 + f_2 = f; in code, however, I cannot simply add the functions f_1, f_2 and am thus interested in this functionality.

It does it internally automatically if you use a solver that cannot specialize on the splitting.

1 Like

Okay, the actual conversion to “standard function” takes place here

(f::SplitFunction)(u, p, t) = f.f1(u, p, t) + f.f2(u, p, t)
function (f::SplitFunction)(du, u, p, t)
    f.f1(f.cache, u, p, t)
    f.f2(du, u, p, t)
    du .+= f.cache
end

right?

yes

1 Like