Mercurial > repos > public > sbplib
comparison +sbp/D1Gauss.m @ 405:4d9d8064e58b feature/SBPInTimeGauss
Implementation of D1 based on Gauss quadrature formula with 4 nodes.
| author | Martin Almquist <martin.almquist@it.uu.se> |
|---|---|
| date | Thu, 02 Feb 2017 17:05:43 +0100 |
| parents | |
| children | 42c4f0b545d6 |
comparison
equal
deleted
inserted
replaced
| 404:d6d27fdc342a | 405:4d9d8064e58b |
|---|---|
| 1 classdef D1Gauss < sbp.OpSet | |
| 2 % Diagonal-norm SBP operators based on the Gauss quadrature formula | |
| 3 % with m nodes, which is of degree 2m-1. Hence, The operator D1 is | |
| 4 % accurate of order m. | |
| 5 properties | |
| 6 D1 % SBP operator approximating first derivative | |
| 7 H % Norm matrix | |
| 8 HI % H^-1 | |
| 9 Q % Skew-symmetric matrix | |
| 10 e_l % Left boundary operator | |
| 11 e_r % Right boundary operator | |
| 12 m % Number of grid points. | |
| 13 h % Step size | |
| 14 x % grid | |
| 15 borrowing % Struct with borrowing limits for different norm matrices | |
| 16 end | |
| 17 | |
| 18 methods | |
| 19 function obj = D1Gauss(m,lim) | |
| 20 | |
| 21 x_l = lim{1}; | |
| 22 x_r = lim{2}; | |
| 23 L = x_r-x_l; | |
| 24 | |
| 25 switch m | |
| 26 case 4 | |
| 27 [obj.D1,obj.H,obj.x,obj.h,obj.e_l,obj.e_r] = ... | |
| 28 sbp.implementations.d1_gauss_4(m,L); | |
| 29 otherwise | |
| 30 error('Invalid operator order %d.',order); | |
| 31 end | |
| 32 | |
| 33 | |
| 34 obj.x = obj.x + x_l; | |
| 35 obj.HI = inv(obj.H); | |
| 36 obj.Q = obj.H*obj.D1 - obj.e_r*obj.e_r' + obj.e_l*obj.e_l'; | |
| 37 | |
| 38 obj.borrowing = []; | |
| 39 end | |
| 40 end | |
| 41 end |
