Mercurial > repos > public > sbplib
diff +time/+rk4/rungekutta_6.m @ 845:1e057b0f2fed feature/burgers1d
Add RK6 with residual viscosity update and reduce computational effort of spatial scheme
- Add RK6 with residual updates
- Change the D2 operator for upwind schemes to one less computationally expensive.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 19 Sep 2018 16:32:05 +0200 |
parents | 48b6fb693025 |
children |
line wrap: on
line diff
--- a/+time/+rk4/rungekutta_6.m Tue Sep 18 10:32:00 2018 +0200 +++ b/+time/+rk4/rungekutta_6.m Wed Sep 19 16:32:05 2018 +0200 @@ -1,7 +1,7 @@ -% Takes one time step of size k using the rungekutta method +% Takes one time step of size dt using the rungekutta method % starting from v_0 and where the function F(v,t) gives the % time derivatives. -function v = rungekutta_6(v, t , k, F) +function v = rungekutta_6(v, t , dt, F) s = 7 k = zeros(length(v),s) a = zeros(7,6); @@ -15,17 +15,17 @@ 229/1200 - 29/6000*sqrt(5), 119/240 - 187/1200*sqrt(5), -14/75 + 34/375*sqrt(5), -3/100*sqrt(5), 0, 0; 71/2400 - 587/12000*sqrt(5), 187/480 - 391/2400*sqrt(5), -38/75 + 26/375*sqrt(5), 27/80 - 3/400*sqrt(5), (1+sqrt(5))/4, 0; -49/480 + 43/160*sqrt(5), -425/96 + 51/32*sqrt(5), 52/15 - 4/5*sqrt(5), -27/16 + 3/16*sqrt(5), 5/4 - 3/4*sqrt(5), 5/2 - 1/2*sqrt(5); - ] + ]; for i = 1:s - u = v - for j = 1: i-1 - u = u + h*a(i,j) * k(:,j) + u = v; + for j = 1:i-1 + u = u + dt*a(i,j)*k(:,j); end - k(:,i) = F(t+c(i)*k,u) + k(:,i) = F(t+c(i)*dt,u); end for i = 1:s - v = v + k*b(i)*k(:,i) + v = v + dt*b(i)*k(:,i); end end