bmcage / odes

The ODES scikit for ordinary differential and algebraic equations, an extension to scipy
https://scikits-odes.readthedocs.io/
Other
124 stars 44 forks source link

[CVLS ERROR] CVodeSetJacFn Linear solver memory is NULL. #139

Open Immudzen opened 2 years ago

Immudzen commented 2 years ago

I am using scikits.odes 2.6.4 installed from conda-forge

ode_solver = scikits.odes.ode('cvode', self.rhs, atol = 1e-8, rtol = 1e-6, old_api = False, max_steps = 20000, linsolver = 'dense', lmm_type = 'ADAMS', nonlinsolver = 'fixedpoint', one_step_compute=True, jacfn=self.jac)

and

def jac(self, t, y, f, J): "computer the jacobian" def wrap(x): return self.function(t, x, self.current_feeds, jacobian=True) J[:] = scipy.optimize.approx_fprime(y, wrap)

and I get [CVLS ERROR] CVodeSetJacFn Linear solver memory is NULL. every time before my jac function is called

the entire integration seems to work fine. My function is called the Jacobian is set, J is the right shape when that function is called.

Any idea what is causing that error and how can I fix it?

Part of the reason I am doing this in the first place was I needed to debug the system and see what the approximate jacobian was and I also wanted to be able to tell apart calls to my function to approximate the jacobian and normal calls.

I don't think the issue is in the jac function since the error occurs before it is called.

Further information: If I changed fixedpoint to newton the error message goes away