Mercurial > repos > public > sbplib
comparison +sbp/D2VariablePeriodic.m @ 812:6b83dcb46f54 feature/grids
Merge with feature/poroelastic
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 27 Jul 2018 10:31:51 -0700 |
parents | 5ccf6aaf6d6b |
children | bf2554f1825d |
comparison
equal
deleted
inserted
replaced
798:e76321b89c1e | 812:6b83dcb46f54 |
---|---|
1 classdef D2VariablePeriodic < 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 = D2VariablePeriodic(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; | |
26 x = linspace(x_l,x_r,m+1)'; | |
27 obj.x = x(1:end-1); | |
28 | |
29 switch order | |
30 | |
31 case 6 | |
32 [obj.H, obj.HI, obj.D1, obj.D2, obj.e_l,... | |
33 obj.e_r, obj.d1_l, obj.d1_r] = ... | |
34 sbp.implementations.d2_variable_periodic_6(m,obj.h); | |
35 obj.borrowing.M.d1 = 0.1878; | |
36 obj.borrowing.R.delta_D = 0.3696; | |
37 % Borrowing e^T*D1 - d1 from R | |
38 | |
39 case 4 | |
40 [obj.H, obj.HI, obj.D1, obj.D2, obj.e_l,... | |
41 obj.e_r, obj.d1_l, obj.d1_r] = ... | |
42 sbp.implementations.d2_variable_periodic_4(m,obj.h); | |
43 obj.borrowing.M.d1 = 0.2505765857; | |
44 | |
45 obj.borrowing.R.delta_D = 0.577587500088313; | |
46 % Borrowing e^T*D1 - d1 from R | |
47 case 2 | |
48 [obj.H, obj.HI, obj.D1, obj.D2, obj.e_l,... | |
49 obj.e_r, obj.d1_l, obj.d1_r] = ... | |
50 sbp.implementations.d2_variable_periodic_2(m,obj.h); | |
51 obj.borrowing.M.d1 = 0.3636363636; | |
52 % Borrowing const taken from Virta 2014 | |
53 | |
54 obj.borrowing.R.delta_D = 1.000000538455350; | |
55 % Borrowing e^T*D1 - d1 from R | |
56 | |
57 otherwise | |
58 error('Invalid operator order %d.',order); | |
59 end | |
60 obj.borrowing.H11 = obj.H(1,1)/obj.h; % First element in H/h, | |
61 | |
62 obj.m = m; | |
63 obj.M = []; | |
64 end | |
65 function str = string(obj) | |
66 str = [class(obj) '_' num2str(obj.order)]; | |
67 end | |
68 end | |
69 | |
70 | |
71 end |