We are solving differential equations defined on a graph using NetworkDynamics.jl and DifferentialEquations.jl. In this context we have the two questions outlined below.
Thx. Domenico Lahaye.
1/ Switching the automatic Jacobian off in NetworkDynamics.jl
We would like to convince ourselves that using the Jacobian indeed makes sense by comparing the CPU time of a run with and without the Jacobian. We, however, do not manage to switch off the automatic computation (or use) of the Jacobian. That is, the two runs outlined below give identical CPU time. What are we doing wrong or overseeing?
(ModelingToolkit does not allow to switch off Jacobian computation? Use of Jacobian should be switched off as option for time-integration method? What are solver options for TRBDF2 aside from linsolve= … ?)
RUN 1: prob = ODEProblem(network!, u0, tspan, p, jac=true)
RUN 2: prob = ODEProblem(network!, u0, tspan, p, jac=false)
2/ Specifying ILU preconditioned GMRES as solver within TRBDF2 in NetworkDynamics.jl
We managed to run TRBDF2 with unpreconditioned GMRES as Krylov method. Next we would like to switch on ILU as a preconditioner. The use of ILU requires the detection of the sparsity pattern. The sparsity detection conflicts with the definition by NetworkDynamics of ODEFuntion. Details (including the error message) are given at https://github.com/bszhu/SIR.jl/blob/8a7a9a8bb0fdbcc615030a2da755461a39a1d266/main/preconditioner.jl
(network! = network_dynamics(node, edge, g_directed) # key constructor network_dynamics returns an ODEFunction)
(Should we call the function generate_jacobian(network!,output,input) instead? What does aspreconditioner refer to?)