Lukas has identified another serious bug!
SOSlib doesn't support variable compartments.
We initialize sundials with ODEs for concentrations
d[A]/dt, and sundials
calculates [A] + (d[A]/dt)*h, where h is a small time
step and [A] is the
initial condition or the current value.
If we have a variable, e.g time-dependent compartment,
then d[A]/dt will
change with changing compartment because the
compartment size is part of the
right hand side.
However, not only d[A]/dt is dependent on the volume,
but also [A], i.e. the
current value in data->value!
The attached example file exemplifies this.
So we actually should use an ODE system in amount/time
instead of
concentration/time, and have a second data->value array
for concentrations
to be used in formula evaluation.