Mercurial > repos > public > sbplib
comparison +sbp/D2Variable.m @ 423:a2cb0d4f4a02 feature/grids
Merge in default.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 07 Feb 2017 15:47:51 +0100 |
parents | ded4156e53e2 |
children | 359861563866 |
comparison
equal
deleted
inserted
replaced
218:da058ce66876 | 423:a2cb0d4f4a02 |
---|---|
1 classdef D2Variable < 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 m % Number of grid points. | |
14 h % Step size | |
15 x % grid | |
16 borrowing % Struct with borrowing limits for different norm matrices | |
17 end | |
18 | |
19 methods | |
20 function obj = D2Variable(m,lim,order) | |
21 | |
22 x_l = lim{1}; | |
23 x_r = lim{2}; | |
24 L = x_r-x_l; | |
25 obj.h = L/(m-1); | |
26 obj.x = linspace(x_l,x_r,m)'; | |
27 | |
28 switch order | |
29 case 4 | |
30 [obj.H, obj.HI, obj.D1, obj.D2, obj.e_l,... | |
31 obj.e_r, obj.d1_l, obj.d1_r] = ... | |
32 sbp.implementations.d2_variable_4(m,obj.h); | |
33 obj.borrowing.M.S = 0.2505765857; | |
34 case 2 | |
35 [obj.H, obj.HI, obj.D1, obj.D2, obj.e_l,... | |
36 obj.e_r, obj.d1_l, obj.d1_r] = ... | |
37 sbp.implementations.d2_variable_2(m,obj.h); | |
38 obj.borrowing.M.S = 0.3636363636; | |
39 % Borrowing const taken from Virta 2014 | |
40 | |
41 otherwise | |
42 error('Invalid operator order %d.',order); | |
43 end | |
44 | |
45 obj.m = m; | |
46 obj.M = []; | |
47 | |
48 end | |
49 end | |
50 | |
51 end | |
52 | |
53 | |
54 | |
55 | |
56 |