2
$\begingroup$

I'm solving a system of stiff ODEs describing atmospheric chemistry and transport. I am using CVODE BDF from Sundials Computing. I have two ways to approximate the jacobian:

  1. Allow CVODE to approximate the jacobian with finite differences.
  2. I have a function for the jacobian, which uses a mixture of finite differences and analytical derivatives, but also takes some short-cuts, omitting some jacobian terms to gain some speed.

For some reason jacobian (2) works - the integration proceeds smoothly until the end - but jacobian (1) does not work. When using jacobian (1), the integration proceeds smoothly for some time, but then gets stuck at some time, and fails to make progress.

This is the opposite of what I expected. I'm guessing jacobian (1) is a better approximation to the jacobian.

Why is the worse jacobian working better than the better approximation to the jacobian?

Hope this isn't too vague! Thanks for any ideas.

$\endgroup$
6
$\begingroup$

Finite difference approximations of the Jacobian are really only good if the step lengths are chosen appropriately for each coordinate. But a black-box solver like CVODE has no way of knowing what these step lengths should be, and so has to use heuristics to choose them. This may or may not work. You are almost always better off if you provide an approximation of the Jacobian based on expert insight, rather than black box choices.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.