Interface to DifferentialEquations.jl

Since version 0.9 VoronoiFVM provides an experimental interface to the ODE solvers in DifferentialEquations.jl. The general pattern is as follows:

using VoronoiFVM
using DifferentialEquations

sys=VoronoiFVM.System(...)

tspan = (t0,tend)
    
ode_func = ODEFunction(eval_rhs!,
                       jac=eval_jacobian!,
                       jac_prototype=jac_prototype(sys),
                       mass_matrix=mass_matrix(sys))
    
problem = ODEProblem(ode_func,vec(inival),tspan,sys)
    sol = DifferentialEquations.solve(problem,Rodas5())

Some caveats with this evolving implementation:

  • Ensure that you handle problems wit "trivial" storage function:
    storage!(f,u,node)= f.=u
  • Eventually it is possible to generalize this to multiplication of u by species and/or region dependent constants, but this has to be implemented with the mass matrix
VoronoiFVM.eval_jacobian!Method
eval_jacobian!(J, u, sys, t)

Assume the discrete problem is an ODE problem. Provide the jacobi matrix calculation function for DifferentialEquations.jl.

source
VoronoiFVM.eval_rhs!Method
eval_rhs!(du, u, sys, t)

Assume the discrete problem is an ODE problem. Provide the rhs function for DifferentialEquations.jl.

source