OpenModelica / OMSimulator

The OpenModelica FMI & SSP-based co-simulation environment.
Other
71 stars 51 forks source link

Algebraic loops are solved with insufficient accuracy for Jacobian estimation by CVODE #1327

Open rruusu opened 1 week ago

rruusu commented 1 week ago

Description

When using CVODE, some state derivatives may be highly dependent on the solutions to algebraic loops between the components.

CVODE uses difference quotients to evaluate Jacobians between states and state derivatives, it uses very small steps for evaluating the difference quotients. When the state derivatives depend on algebraic loop solutions, the errors in these solutions may overwhelm the true effects of the difference quotient steps. This results in bad quality Jacobian estimates, which affects the error tolerance calculations performed by CVODE.

Unfortunately, the absolute tolerance that is provided to the algebraic loop solver is 100 greater than the absolute tolerance given the CVODE, which practically guarantees that the algebraic loop errors are too high for CVODE.

Expected behavior

When using CVODE, the algebraic loops should be solved to an accuracy that is sufficient for the difference quotient evaluations done by CVODE. (This is not so trivial.)

Version and OS

rruusu commented 1 week ago

This might be considered more like a feature request rather than a bug report.

I will push some remedies for this to my fork shortly.