Mercurial > repos > public > sbplib
comparison +sbp/D4CompatibleVariable.m @ 263:21a180acbd49 operator_remake
Renamed standard class to D2Standard etc, Rewrote class properties.
author | Martin Almquist <martin.almquist@it.uu.se> |
---|---|
date | Thu, 08 Sep 2016 17:50:30 +0200 |
parents | 23051a86faa4 |
children | 8a625c5a3633 |
comparison
equal
deleted
inserted
replaced
262:23051a86faa4 | 263:21a180acbd49 |
---|---|
1 classdef D4CompatibleVariable < sbp.OpSet | 1 classdef D4CompatibleVariable < sbp.OpSet |
2 properties | 2 properties |
3 norms % Struct containing norm matrices such as H,Q, M | 3 D1 % SBP operator approximating first derivative |
4 boundary % Struct contanging vectors for boundry point approximations | 4 H % Norm matrix |
5 derivatives % Struct containging differentiation operators | 5 HI % H^-1 |
6 borrowing % Struct with borrowing limits for different norm matrices | 6 Q % Skew-symmetric matrix |
7 e_1 % Left boundary operator | |
8 e_m % Right boundary operator | |
9 D2 % SBP operator for second derivative | |
10 M % Norm matrix, second derivative | |
11 S_1 % Left boundary first derivative | |
12 S_m % Right boundary first derivative | |
13 D3 % SBP operator for third derivative | |
14 Q3 % Skew-symmetric matrix in third derivative | |
15 S2_1 % Left boundary second derivative | |
16 S2_m % Right boundary second derivative | |
17 D4 % SBP operator for fourth derivative | |
18 M4 % Norm matrix, fourth derivative | |
19 S3_1 % Left boundary third derivative | |
20 S3_m % Right boundary third derivative | |
7 m % Number of grid points. | 21 m % Number of grid points. |
8 h % Step size | 22 h % Step size |
23 x % grid | |
24 borrowing % Struct with borrowing limits for different norm matrices | |
9 end | 25 end |
10 | 26 |
11 | 27 |
12 | 28 |
13 methods | 29 methods |
14 function obj = D4CompatibleVariable(m,h,order) | 30 function obj = D4CompatibleVariable(m,L,order) |
31 | |
32 obj.h = L/(m-1); | |
33 obj.x = linspace(0,L,m)'; | |
15 | 34 |
16 if order == 2 | 35 if order == 2 |
17 [H, HI, ~, D2, ~, D4, e_1, e_m, M4, ~, S2_1, S2_m, S3_1,... | 36 [obj.H, obj.HI, ~, obj.D2, ~, obj.D4, obj.e_1, obj.e_m,... |
18 S3_m, S_1, S_m] =... | 37 obj.M4, ~, obj.S2_1, obj.S2_m, obj.S3_1,... |
19 sbp.implementations.d4_compatible_halfvariable_2(m,h); | 38 obj.S3_m, obj.S_1, obj.S_m] =... |
39 sbp.implementations.d4_compatible_halfvariable_2(m,obj.h); | |
20 obj.borrowing.N.S2 = 1.2500; | 40 obj.borrowing.N.S2 = 1.2500; |
21 obj.borrowing.N.S3 = 0.4000; | 41 obj.borrowing.N.S3 = 0.4000; |
22 elseif order == 4 | 42 elseif order == 4 |
23 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1,... | 43 [obj.H, obj.HI, obj.D2, obj.D4, obj.e_1, obj.e_m, obj.M4,... |
24 S_m] =... | 44 obj.S2_1, obj.S2_m, obj.S3_1, obj.S3_m, obj.S_1,... |
25 sbp.implementations.d4_compatible_halfvariable_4(m,h); | 45 obj.S_m] =... |
46 sbp.implementations.d4_compatible_halfvariable_4(m,obj.h); | |
26 obj.borrowing.N.S2 = 0.5055; | 47 obj.borrowing.N.S2 = 0.5055; |
27 obj.borrowing.N.S3 = 0.9290; | 48 obj.borrowing.N.S3 = 0.9290; |
28 elseif order == 6 | 49 elseif order == 6 |
29 [H, HI, D2, D4, e_1, e_m, M4, S2_1, S2_m, S3_1, S3_m, S_1,... | 50 [obj.H, obj.HI, obj.D2, obj.D4, obj.e_1, obj.e_m, obj.M4,... |
30 S_m] =... | 51 obj.S2_1, obj.S2_m, obj.S3_1, obj.S3_m, obj.S_1,... |
31 sbp.implementations.d4_compatible_halfvariable_6(m,h); | 52 obj.S_m] =... |
53 sbp.implementations.d4_compatible_halfvariable_6(m,obj.h); | |
32 obj.borrowing.N.S2 = 0.3259; | 54 obj.borrowing.N.S2 = 0.3259; |
33 obj.borrowing.N.S3 = 0.1580; | 55 obj.borrowing.N.S3 = 0.1580; |
34 else | 56 else |
35 error('Invalid operator order.'); | 57 error('Invalid operator order.'); |
36 end | 58 end |
37 | 59 |
38 obj.h = h; | |
39 obj.m = m; | 60 obj.m = m; |
61 | |
62 obj.D1 = []; | |
63 obj.D3 = []; | |
40 | 64 |
41 obj.norms.H = H; | |
42 obj.norms.HI = HI; | |
43 obj.norms.N = M4; | |
44 | |
45 obj.boundary.e_1 = e_1; | |
46 obj.boundary.S_1 = S_1; | |
47 obj.boundary.S2_1 = S2_1; | |
48 obj.boundary.S3_1 = S3_1; | |
49 | |
50 obj.boundary.e_m = e_m; | |
51 obj.boundary.S_m = S_m; | |
52 obj.boundary.S2_m = S2_m; | |
53 obj.boundary.S3_m = S3_m; | |
54 | |
55 obj.derivatives.D2 = D2; | |
56 obj.derivatives.D4 = D4; | |
57 | 65 |
58 end | 66 end |
59 end | 67 end |
60 | 68 |
61 | 69 |