Mercurial > repos > public > sbplib
comparison +sbp/D2VariablePeriodic.m @ 681:7368affc8f78 feature/poroelastic
Add D2 variable periodic for second order.
| author | Martin Almquist <malmquist@stanford.edu> |
|---|---|
| date | Wed, 07 Feb 2018 15:42:50 -0800 |
| parents | |
| children | 5ccf6aaf6d6b |
comparison
equal
deleted
inserted
replaced
| 680:cd1a76c38565 | 681:7368affc8f78 |
|---|---|
| 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 error('Not impl') | |
| 33 | |
| 34 [obj.H, obj.HI, obj.D1, obj.D2, ... | |
| 35 ~, obj.e_l, obj.e_r, ~, ~, ~, ~, ~,... | |
| 36 obj.d1_l, obj.d1_r] = ... | |
| 37 sbp.implementations.d4_variable_periodic_6(m, obj.h); | |
| 38 obj.borrowing.M.d1 = 0.1878; | |
| 39 obj.borrowing.R.delta_D = 0.3696; | |
| 40 % Borrowing e^T*D1 - d1 from R | |
| 41 | |
| 42 case 4 | |
| 43 error('Not impl') | |
| 44 | |
| 45 [obj.H, obj.HI, obj.D1, obj.D2, obj.e_l,... | |
| 46 obj.e_r, obj.d1_l, obj.d1_r] = ... | |
| 47 sbp.implementations.d2_variable_periodic_4(m,obj.h); | |
| 48 obj.borrowing.M.d1 = 0.2505765857; | |
| 49 | |
| 50 obj.borrowing.R.delta_D = 0.577587500088313; | |
| 51 % Borrowing e^T*D1 - d1 from R | |
| 52 case 2 | |
| 53 [obj.H, obj.HI, obj.D1, obj.D2, obj.e_l,... | |
| 54 obj.e_r, obj.d1_l, obj.d1_r] = ... | |
| 55 sbp.implementations.d2_variable_periodic_2(m,obj.h); | |
| 56 obj.borrowing.M.d1 = 0.3636363636; | |
| 57 % Borrowing const taken from Virta 2014 | |
| 58 | |
| 59 obj.borrowing.R.delta_D = 1.000000538455350; | |
| 60 % Borrowing e^T*D1 - d1 from R | |
| 61 | |
| 62 otherwise | |
| 63 error('Invalid operator order %d.',order); | |
| 64 end | |
| 65 obj.borrowing.H11 = obj.H(1,1)/obj.h; % First element in H/h, | |
| 66 obj.m = m; | |
| 67 obj.M = []; | |
| 68 end | |
| 69 function str = string(obj) | |
| 70 str = [class(obj) '_' num2str(obj.order)]; | |
| 71 end | |
| 72 end | |
| 73 | |
| 74 | |
| 75 end |
