comparison +sbp/+implementations/d4_variable_2.m @ 314:88584b0cfba1 feature/beams

Corrections and clean up order 4
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 23 Sep 2016 22:55:30 +0200
parents 52b4cdf27633
children b19e142fcae1
comparison
equal deleted inserted replaced
313:52b4cdf27633 314:88584b0cfba1
35 d2_l(1:3) = 1/h^2*[1 -2 1]; 35 d2_l(1:3) = 1/h^2*[1 -2 1];
36 d2_r = rot90(d2_l, 2); 36 d2_r = rot90(d2_l, 2);
37 37
38 d3_l = sparse(m,1); 38 d3_l = sparse(m,1);
39 d3_l(1:4) = 1/h^3*[-1 3 -3 1]; 39 d3_l(1:4) = 1/h^3*[-1 3 -3 1];
40 d3_r = -rot90(d3_l, 2) 40 d3_r = -rot90(d3_l, 2);
41 41
42 42
43 % First derivative SBP operator, 1st order accurate at first 6 boundary points 43 % First derivative SBP operator, 1st order accurate at first 6 boundary points
44 stencil = [-1/2, 0, 1/2]; 44 stencil = [-1/2, 0, 1/2];
45 diags = [-1 0 1]; 45 diags = [-1 0 1];
46 Q = stripeMatrix(stencil, diags, m); 46 Q = stripeMatrix(stencil, diags, m);
47 47
48 D1 = HI*(Q-1/2*(e_1*e_1') + 1/2*(e_m*e_m')); 48 D1 = HI*(Q - 1/2*e_l*e_l' + 1/2*e_r*e_r');
49 49
50 % Second derivative, 1st order accurate at first boundary points 50 % Second derivative, 1st order accurate at first boundary points
51 M = sparse(m,m); 51 M = sparse(m,m);
52 52
53 scheme_width = 3; 53 scheme_width = 3;
83 83
84 M4(1:4,1:4) = M4_U; 84 M4(1:4,1:4) = M4_U;
85 M4(m-3:m,m-3:m) = rot90(M4_U, 2); 85 M4(m-3:m,m-3:m) = rot90(M4_U, 2);
86 M4 = 1/h^3*M4; 86 M4 = 1/h^3*M4;
87 87
88 D4=HI*(M4-e_1*S3_1'+e_m*S3_m' + S_1*S2_1'-S_m*S2_m'); 88 D4=HI*(M4 - e_l*d3_l'+e_r*d3_r' + d1_l*d2_l'-d1_r*d2_r');
89 end 89 end