modelon-community / Assimulo

Assimulo is a simulation package for solving ordinary differential equations.
https://jmodelica.org/assimulo/index.html
GNU Lesser General Public License v3.0
66 stars 16 forks source link

Jacobian sparsity pattern #11

Closed kossikater closed 3 years ago

kossikater commented 4 years ago

It would be great if the solvers could use a Jacobian sparsity pattern indicating which entries are zero for sure, similar to scipy's solve_ivp. This could increase speed for calculations on approximating the Jacobian is no analytical one is supplied.

chria commented 3 years ago

Hi! I agree, however, this is currently not possible. What you can do instead is to override the Jacobian function in the problem definition and there implement (either and FD or AD scheme) that takes into account the sparsity pattern.

swsyoon commented 3 years ago

@chria Is it possible for you to create a simple example of how to use AD scheme to provide Jacobian for sundials solver such as IDA or CVODE ? I am using casadi python version to provide symbolic jacobian and try to use it in 'ida_with_jac.py' example but I keep getting errors such as f function return type error or Jacobian function is not callable