Bug in TSALPHA
Dear to whom it may concern,
I've found a bug when running TSALPHA for a linear system with TS_EXACTFINALTIME_INTERPOLATE (not sure how it affects a wider class of problems).
A small code example to illustrate the issue is attached [in fact, it solves a 1*1 linear problem x_dot = 1, with the exact solution being x(t) = t].
There are two manifestations of the bug:
-
./ex1_alphabug -ts_view_solution -ts_monitor
When making the final interpolation of the solution, the result is wrong. Namely, interpolation at t=0.9 between x1=0.861 and x2=0.984 always returns x2 instead of the correct answer x*==0.9. The interpolation routine
TSInterpolate_Alpha()
looks ok at the first glance, so the bug may be rooted somewhere deeper. Monitoring this routine, I've found that th->V0 and th->V1 are two opposite vectors, which cancel each other, which is why the interpolation result is always "x2". I've also monitored the routineTSAlpha_StageVecs()
, which is called here once for each TS step, and in this routine: X0 == X1, so V0 == -V1. I didn't check deeper than this. -
./ex1_alphabug -ts_view_solution -ts_monitor -snes_monitor
Simply adding a SNES monitor changes the situation.
TSAlpha_StageVecs()
is now invoked twice per TS step, and the second invocation results in V0 != -V1, so the final interpolation is ok now. However, it looks weird that presence of a monitor affects the behaviour of the solver.
Please, have a look at the problem.
Regards,
Ilya