comparison +time/+rk/butcherTableau.m @ 846:c6fcee3fcf1b feature/burgers1d

Add generalized RungeKutta and RungeKuttaRV class which extracts its coefficients from a butcher tableau, specified on the scheme.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 20 Sep 2018 17:51:19 +0200
parents
children e0560bc4fb7d
comparison
equal deleted inserted replaced
845:1e057b0f2fed 846:c6fcee3fcf1b
1 function [s,a,b,c] = butcherTableau(order)
2
3 switch order
4
5 case 3
6 % TVD (Total Variational Diminishing)
7 s = 3;
8 a = zeros(s,s-1);
9 a(2,1) = 1;
10 a(3,1) = 1/4; a(3,2) = 1/4;
11 b = [1/6, 1/6, 2/3];
12 c = [0 1 1/2];
13 case 4
14 % Standard RK4
15 s = 4;
16 a = zeros(s,s-1);
17 a(2,1) = 1/2;
18 a(3,1) = 0; a(3,2) = 1/2;
19 a(4,1) = 0; a(4,2) = 0; a(4,3) = 1;
20 b = [1/6 1/3 1/3 1/6];
21 c = [0, 1/2, 1/2, 1];
22 case 6
23 % Runge-Kutta 6 from Alshina07
24 s = 7;
25 a = zeros(s,s-1);
26 a(2,1) = 4/7;
27 a(3,1) = 115/112; a(3,2) = -5/16;
28 a(4,1) = 589/630; a(4,2) = 5/18; a(4,3) = -16/45;
29 a(5,1) = 229/1200 - 29/6000*sqrt(5); a(5,2) = 119/240 - 187/1200*sqrt(5); a(5,3) = -14/75 + 34/375*sqrt(5); a(5,4) = -3/100*sqrt(5);
30 a(6,1) = 71/2400 - 587/12000*sqrt(5); a(6,2) = 187/480 - 391/2400*sqrt(5); a(6,3) = -38/75 + 26/375*sqrt(5); a(6,4) = 27/80 - 3/400*sqrt(5); a(6,5) = (1+sqrt(5))/4;
31 a(7,1) = -49/480 + 43/160*sqrt(5); a(7,2) = -425/96 + 51/32*sqrt(5); a(7,3) = 52/15 - 4/5*sqrt(5); a(7,4) = -27/16 + 3/16*sqrt(5); a(7,5) = 5/4 - 3/4*sqrt(5); a(7,6) = 5/2 - 1/2*sqrt(5);
32 b = [1/12 0 0 0 5/12 5/12 1/12];
33 c = [0, 4/7, 5/7, 6/7, (5-sqrt(5))/10, (5+sqrt(5))/10, 1];
34 otherwise
35 error('That Runge-Kutta order is not implemented', order)
36
37 end