Arkode incorrect first step for Euler method
Bug Description
Arkode with Euler method specified by Butcher table incorrectly calculates first step. 2nd and following steps are calculated correctly.
Steps to reproduce
Run code below
dt = 0.05
tf = dt*3
y0 = 20
function dydt = odefun(t,y)
dydt = -y
endfunction
t1 = 0:dt:tf
y1 = y0
for ii=2:size(t1,"*")
y1(ii) = y1(ii-1) + dt*odefun(t1(ii-1), y1(ii-1))
end
[t2,y2] = arkode(odefun,[0 tf],y0,ERKButcherTab=[0 0;1 1],fixedStep=dt);
plot(t1,y1,t2,y2)
legend("ad hoc Euler method","arkode")
What is the expected correct behavior?
Correct integration
Error log
No error
Notes
Other tested methods - Heun, Midpoint, Ralston, RK4 - do not suffer by this bug when specified by Butcher table