OMSimulator icon indicating copy to clipboard operation
OMSimulator copied to clipboard

CVODE solver statistics are reset at each event

Open rruusu opened this issue 2 months ago • 0 comments

Description

When CVODE is used to solve a strongly coupled system that contains events, the solver statistics printed at the end only contain values accumulated since the last event.

Steps to reproduce the behavior

  1. Create a ME FMU that invokes an event
  2. Simulate said FMU to the time of that event
  3. Look at the solver statistics and observe them to show counts near zero

Example with a model that has an event at the end of the experiment:

> OMSimulator.exe .\VibrationTest.fmu --stepSize=0.0001,1e-8,0.1
info:    maximum step size for 'model.root': 0.100000
info:    Result file: model_res.mat (bufferSize=10)
info:    Final Statistics for 'model.root':
         NumSteps = 0 NumRhsEvals  = 0 NumLinSolvSetups = 0
         NumNonlinSolvIters = 0 NumNonlinSolvConvFails = 0 NumErrTestFails = 0

Expected behavior

The solver statistics from the whole simulation should be summed and shown at the end.

Cause

The statistics output is taken directly from CVODE at the end of the simulation. However, CVODE resets its internal statistics at each call to CVodeReInit(), which is done at each event.

rruusu avatar Oct 31 '25 11:10 rruusu