Mercurial > repos > public > sbplib
comparison +sbp/D4CompatibleVariable.m @ 307:fefb2f9884f7 feature/beams
Merge with default.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 23 Sep 2016 10:40:12 +0200 |
parents | 4b9310edcdf8 |
children | 067fd13ba320 |
comparison
equal
deleted
inserted
replaced
306:8368beb0d1b3 | 307:fefb2f9884f7 |
---|---|
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 | |
28 | |
29 methods | |
30 function obj = D4CompatibleVariable(m, lim, order, opt) | |
31 default_arg('opt', '') | |
32 | |
33 x_l = lim{1}; | |
34 x_r = lim{2}; | |
35 L = x_r-x_l; | |
36 obj.h = L/(m-1); | |
37 obj.x = linspace(x_l, x_r,m)'; | |
38 | |
39 if order == 2 | |
40 [obj.H, obj.HI, ~, obj.D2, ~, obj.D4, obj.e_l, obj.e_r,... | |
41 obj.M4, ~, obj.d2_l, obj.d2_r, obj.d3_l,... | |
42 obj.d3_r, obj.d1_l, obj.d1_r] =... | |
43 sbp.implementations.d4_compatible_halfvariable_2(m,obj.h); | |
44 obj.borrowing.N.S2 = 1.2500; | |
45 obj.borrowing.N.S3 = 0.4000; | |
46 elseif order == 4 | |
47 switch opt | |
48 case 'min_boundary_points' | |
49 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1, S_m] = sbp.higher_variable4_min_boundary_points(m,h); | |
50 % obj.borrowing.N.S2 = 0.5055; | |
51 % obj.borrowing.N.S3 = 0.9290; | |
52 otherwise | |
53 [obj.H, obj.HI, obj.D2, obj.D4, obj.e_l, obj.e_r, obj.M4,... | |
54 obj.d2_l, obj.d2_r, obj.d3_l, obj.d3_r, obj.d1_l,... | |
55 obj.d1_r] =... | |
56 sbp.implementations.d4_compatible_halfvariable_4(m,obj.h); | |
57 obj.borrowing.N.S2 = 0.5055; | |
58 obj.borrowing.N.S3 = 0.9290; | |
59 end | |
60 | |
61 elseif order == 6 | |
62 | |
63 | |
64 switch opt | |
65 case '2' | |
66 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1, S_m] = sbp.higher_variable6_2(m,h); | |
67 % obj.borrowing.N.S2 = 0.3259; | |
68 % obj.borrowing.N.S3 = 0.1580; | |
69 case '3' | |
70 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1, S_m] = sbp.higher_variable6_3(m,h); | |
71 % obj.borrowing.N.S2 = 0.3259; | |
72 % obj.borrowing.N.S3 = 0.1580; | |
73 case 'min_boundary_points' | |
74 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1, S_m] = sbp.higher_variable6_min_boundary_points(m,h); | |
75 % obj.borrowing.N.S2 = 0.3259; | |
76 % obj.borrowing.N.S3 = 0.1580; | |
77 otherwise | |
78 [obj.H, obj.HI, obj.D2, obj.D4, obj.e_l, obj.e_r, obj.M4,... | |
79 obj.d2_l, obj.d2_r, obj.d3_l, obj.d3_r, obj.d1_l,... | |
80 obj.d1_r] =... | |
81 sbp.implementations.d4_compatible_halfvariable_6(m,obj.h); | |
82 obj.borrowing.N.S2 = 0.3259; | |
83 obj.borrowing.N.S3 = 0.1580; | |
84 end | |
85 elseif order == 8 | |
86 switch opt | |
87 case 'min_boundary_points' | |
88 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1, S_m] = sbp.higher_variable8_min_boundary_points(m,h); | |
89 % obj.borrowing.N.S2 = 0.3259; | |
90 % obj.borrowing.N.S3 = 0.1580; | |
91 otherwise | |
92 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1, S_m] = sbp.higher_variable8_higher_boundary_order(m,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.D1 = []; | |
103 obj.D3 = []; | |
104 | |
105 | |
106 end | |
107 end | |
108 | |
109 | |
110 | |
111 end |