Pass extra arguments to ODEForwardSensitivityProblem's RHS function

For DiffEqSensitivity.jl’s ODEForwardSensitivityProblem, I was wondering if we could pass extra arguments to RHS function that are not for sensitivity analysis?

In DifferentialEquations.jl, we could pass extra arguments to ODEProblem’s RHS function as follows:

param = (p, arg)
prob = ODEProblem(RHS_func, u0, tspan, param)

function RHS_func( du, u, param, t )
    p, arg = param
   du[1] = f1(u, p)
   du[2] = f2(u, p)
end

However, I don’t think this will work for ODEForwardSensitivityProblem. Is there a possible work-abound? It will be great if I don’t need to make these arguments global.

Just use a closure or a call-overloaded struct

1 Like