Mercurial > repos > public > sbplib
comparison +sbp/D4Standard.m @ 423:a2cb0d4f4a02 feature/grids
Merge in default.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 07 Feb 2017 15:47:51 +0100 |
parents | 4b9310edcdf8 |
children | e1d11b6a68d8 |
comparison
equal
deleted
inserted
replaced
218:da058ce66876 | 423:a2cb0d4f4a02 |
---|---|
1 classdef D4Standard < 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 = D4Standard(m,lim,order) | |
31 | |
32 x_l = lim{1}; | |
33 x_r = lim{2}; | |
34 L = x_r-x_l; | |
35 obj.h = L/(m-1); | |
36 obj.x = linspace(x_l,x_r,m)'; | |
37 | |
38 if order == 4 | |
39 [obj.H, obj.HI, obj.D1, obj.D2, obj.D3, obj.D4,... | |
40 obj.e_l, obj.e_r, obj.M, obj.M4, obj.Q, obj.Q3, obj.d2_l,... | |
41 obj.d2_r, obj.d3_l, obj.d3_r, obj.d1_l, obj.d1_r] = ... | |
42 sbp.implementations.d4_4(m,obj.h); | |
43 obj.borrowing.N.S2 = 0.5485; | |
44 obj.borrowing.N.S3 = 1.0882; | |
45 elseif order == 6 | |
46 [obj.H, obj.HI, obj.D1, obj.D2, obj.D3, obj.D4,... | |
47 obj.e_l, obj.e_r, obj.M, obj.M4, obj.Q, obj.Q3, obj.d2_l,... | |
48 obj.d2_r, obj.d3_l, obj.d3_r, obj.d1_l, obj.d1_r] = ... | |
49 sbp.implementations.d4_6(m,obj.h); | |
50 obj.borrowing.N.S2 = 0.3227; | |
51 obj.borrowing.N.S3 = 0.1568; | |
52 else | |
53 error('Invalid operator order %d.',order); | |
54 end | |
55 | |
56 obj.m = m; | |
57 | |
58 end | |
59 end | |
60 | |
61 | |
62 end |