comparison +sbp/D4Variable.m @ 309:8fafe97bf27b feature/beams

Renamed file.
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 23 Sep 2016 10:52:53 +0200
parents +sbp/D4CompatibleVariable.m@067fd13ba320
children ffa5d557942b
comparison
equal deleted inserted replaced
308:067fd13ba320 309:8fafe97bf27b
1 classdef D4CompatibleVariable < sbp.OpSet
2 properties
3 D1 % SBP operator approximating first derivative
4 H % Norm matrix
5 HI % H^-1
6 Q % Skew-symmetric matrix
7 e_l % Left boundary operator
8 e_r % Right boundary operator
9 D2 % SBP operator for second derivative
10 M % Norm matrix, second derivative
11 d1_l % Left boundary first derivative
12 d1_r % Right boundary first derivative
13 D3 % SBP operator for third derivative
14 Q3 % Skew-symmetric matrix in third derivative
15 d2_l % Left boundary second derivative
16 d2_r % Right boundary second derivative
17 D4 % SBP operator for fourth derivative
18 M4 % Norm matrix, fourth derivative
19 d3_l % Left boundary third derivative
20 d3_r % Right boundary third derivative
21 m % Number of grid points.
22 h % Step size
23 x % grid
24 borrowing % Struct with borrowing limits for different norm matrices
25 end
26
27 methods
28 function obj = D4CompatibleVariable(m, lim, order, opt)
29 default_arg('opt', '')
30
31 x_l = lim{1};
32 x_r = lim{2};
33 L = x_r-x_l;
34 obj.h = L/(m-1);
35 obj.x = linspace(x_l, x_r,m)';
36
37 if order == 2
38 [obj.H, obj.HI, ~, obj.D2, ~, obj.D4, obj.e_l, obj.e_r,...
39 obj.M4, ~, obj.d2_l, obj.d2_r, obj.d3_l,...
40 obj.d3_r, obj.d1_l, obj.d1_r] =...
41 sbp.implementations.d4_compatible_halfvariable_2(m,obj.h);
42 obj.borrowing.N.S2 = 1.2500;
43 obj.borrowing.N.S3 = 0.4000;
44
45 elseif order == 4
46 switch opt
47 case 'min_boundary_points'
48 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
49 sbp.higher_variable4_min_boundary_points(m, obj.h);
50 % obj.borrowing.N.S2 = 0.5055;
51 % obj.borrowing.N.S3 = 0.9290;
52 otherwise
53 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
54 sbp.implementations.d4_compatible_halfvariable_4(m, obj.h);
55 obj.borrowing.N.S2 = 0.5055;
56 obj.borrowing.N.S3 = 0.9290;
57 end
58
59 elseif order == 6
60 switch opt
61 case '2'
62 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
63 sbp.higher_variable6_2(m, obj.h);
64 % obj.borrowing.N.S2 = 0.3259;
65 % obj.borrowing.N.S3 = 0.1580;
66 case '3'
67 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
68 sbp.higher_variable6_3(m, obj.h);
69 % obj.borrowing.N.S2 = 0.3259;
70 % obj.borrowing.N.S3 = 0.1580;
71 case 'min_boundary_points'
72 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
73 sbp.higher_variable6_min_boundary_points(m, obj.h);
74 % obj.borrowing.N.S2 = 0.3259;
75 % obj.borrowing.N.S3 = 0.1580;
76 otherwise
77 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
78 sbp.implementations.d4_compatible_halfvariable_6(m, obj.h);
79 obj.borrowing.N.S2 = 0.3259;
80 obj.borrowing.N.S3 = 0.1580;
81 end
82
83 elseif order == 8
84 switch opt
85 case 'min_boundary_points'
86 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
87 sbp.higher_variable8_min_boundary_points(m, obj.h);
88 % obj.borrowing.N.S2 = 0.3259;
89 % obj.borrowing.N.S3 = 0.1580;
90 otherwise
91 [H, HI, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ...
92 sbp.higher_variable8_higher_boundary_order(m, obj.h);
93 % obj.borrowing.N.S2 = 0.3259;
94 % obj.borrowing.N.S3 = 0.1580;
95 end
96 else
97 error('Invalid operator order.');
98 end
99
100 obj.m = m;
101
102 obj.H = H;
103 obj.HI = HI;
104 obj.D2 = D2;
105 obj.D4 = D4;
106 obj.M4 = M4;
107 obj.e_l = e_l;
108 obj.e_r = e_r;
109 obj.d1_l = d1_l;
110 obj.d1_r = d1_r ;
111 obj.d2_l = d2_l;
112 obj.d2_r = d2_r;
113 obj.d3_l = d3_l;
114 obj.d3_r = d3_r;
115
116 obj.D1 = [];
117 obj.D3 = [];
118 end
119 end
120 end