changeset 328:31d6698c1edf feature/beams

Clean up and fixing of new operators
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 28 Sep 2016 12:39:12 +0200
parents d24869abc7cd
children bf801c3709be
files +sbp/D4Lonely.m +sbp/D4Variable.m +scheme/Beam.m
diffstat 3 files changed, 35 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/+sbp/D4Lonely.m	Tue Sep 27 09:46:58 2016 +0200
+++ b/+sbp/D4Lonely.m	Wed Sep 28 12:39:12 2016 +0200
@@ -1,16 +1,16 @@
 classdef D4Lonely < sbp.OpSet
     properties
+        m    % Number of grid points.
+        h    % Step size
+        x    % grid
         H    % Norm matrix
         HI   % H^-1
+        D4   % SBP operator for fourth derivative
+        M4   % Norm matrix, fourth derivative
         e_l,  e_r  % Left and right boundary operator
         d1_l, d1_r % Left and right boundary first derivative
         d2_l, d2_r % Left and right boundary second derivative
         d3_l, d3_r % Left and right boundary third derivative
-        D4   % SBP operator for fourth derivative
-        M4   % Norm matrix, fourth derivative
-        m    % Number of grid points.
-        h    % Step size
-        x    % grid
         borrowing % Struct with borrowing limits for different norm matrices
     end
 
--- a/+sbp/D4Variable.m	Tue Sep 27 09:46:58 2016 +0200
+++ b/+sbp/D4Variable.m	Wed Sep 28 12:39:12 2016 +0200
@@ -1,24 +1,20 @@
 classdef D4Variable < sbp.OpSet
     properties
-        D1   % SBP operator approximating first derivative
-        H    % Norm matrix
-        HI   % H^-1
-        Q    % Skew-symmetric matrix
-        e_l  % Left boundary operator
-        e_r  % Right boundary operator
-        d1_l % Left boundary first derivative
-        d1_r % Right boundary first derivative
-        d2_l % Left boundary second derivative
-        d2_r % Right boundary second derivative
-        d3_l % Left boundary third derivative
-        d3_r % Right boundary third derivative
-        D2   % SBP operator for second derivative
-        M    % Norm matrix, second derivative
-        D4   % SBP operator for fourth derivative
-        M4   % Norm matrix, fourth derivative
         m    % Number of grid points.
         h    % Step size
         x    % grid
+        H    % Norm matrix
+        HI   % H^-1
+        D1   % SBP operator approximating first derivative
+        D2   % SBP operator for second derivative
+        D4   % SBP operator for fourth derivative
+        Q    % Skew-symmetric matrix
+        M    % Norm matrix, second derivative
+        M4   % Norm matrix, fourth derivative
+        e_l,  e_r  % Left and right boundary operator
+        d1_l, d1_r % Left and right boundary first derivative
+        d2_l, d2_r % Left and right boundary second derivative
+        d3_l, d3_r % Left and right boundary third derivative
         borrowing % Struct with borrowing limits for different norm matrices
     end
 
--- a/+scheme/Beam.m	Tue Sep 27 09:46:58 2016 +0200
+++ b/+scheme/Beam.m	Wed Sep 28 12:39:12 2016 +0200
@@ -10,7 +10,7 @@
         H % Discrete norm
         Hi
 
-        e_l, e_r
+        e_l,  e_r
         d1_l, d1_r
         d2_l, d2_r
         d3_l, d3_r
@@ -26,6 +26,8 @@
         function obj = Beam(grid, order, alpha, opsGen, opt)
             default_arg('alpha', -1);
 
+            % default_arg('opsGen', @sbp.D4);
+            default_arg('opsGen', @sbp.D4Variable); % Supposed to be better
 
             opt_default.interface_l.tuning = 1.1;
             opt_default.interface_l.tau = [];
@@ -36,8 +38,7 @@
             default_struct('opt', opt_default);
 
 
-            % default_arg('opsGen', @sbp.Higher);
-            default_arg('opsGen', @sbp.HigherVariable); % Supposed to be better
+
 
             if ~isa(grid, 'grid.Cartesian') || grid.D() ~= 1
                 error('Grid must be 1d cartesian');
@@ -50,25 +51,24 @@
             m = grid.m;
             h = grid.scaling();
 
-            ops = opsGen(m, h, order);
-
-            I = speye(m);
+            x_lim = {grid.x{1}(1), grid.x{1}(end)};
+            ops = opsGen(m, x_lim, order);
 
-            D4 = sparse(ops.derivatives.D4);
-            obj.H =  sparse(ops.norms.H);
-            obj.Hi = sparse(ops.norms.HI);
-            obj.e_l = sparse(ops.boundary.e_1);
-            obj.e_r = sparse(ops.boundary.e_m);
-            obj.d1_l = sparse(ops.boundary.S_1);
-            obj.d1_r = sparse(ops.boundary.S_m);
-            obj.d2_l  = sparse(ops.boundary.S2_1);
-            obj.d2_r  = sparse(ops.boundary.S2_m);
-            obj.d3_l  = sparse(ops.boundary.S3_1);
-            obj.d3_r  = sparse(ops.boundary.S3_m);
+            D4       = ops.D4;
+            obj.H    = ops.H;
+            obj.Hi   = ops.HI;
+            obj.e_l  = ops.e_l;
+            obj.e_r  = ops.e_r;
+            obj.d1_l = ops.d1_l;
+            obj.d1_r = ops.d1_r;
+            obj.d2_l = ops.d2_l;
+            obj.d2_r = ops.d2_r;
+            obj.d3_l = ops.d3_l;
+            obj.d3_r = ops.d3_r;
 
             obj.D = alpha*D4;
 
-            alphaII = ops.borrowing.N.S2/2;
+            alphaII  = ops.borrowing.N.S2/2;
             alphaIII = ops.borrowing.N.S3/2;
 
             obj.gamm = h*alphaII;