view +sbp/D1Upwind.m @ 774:66eb4a2bbb72 feature/grids

Remove default scaling of the system. The scaling doens't seem to help actual solutions. One example that fails in the flexural code. With large timesteps the solutions seems to blow up. One particular example is profilePresentation on the tdb_presentation_figures branch with k = 0.0005
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 18 Jul 2018 15:42:52 -0700
parents e1d11b6a68d8
children 111fcbcff2e9
line wrap: on
line source

classdef D1Upwind < sbp.OpSet
    properties
        Dp, Dm % SBP operator approximating first derivative
        H % Norm matrix
        HI % H^-1
        e_l % Left boundary operator
        e_r % Right boundary operator
        m % Number of grid points.
        h % Step size
        x % grid
        borrowing % Struct with borrowing limits for different norm matrices
    end

    methods
        function obj = D1Upwind(m,lim,order)

            x_l = lim{1};
            x_r = lim{2};
            L = x_r-x_l;
            obj.h = L/(m-1);
            obj.x = linspace(x_l,x_r,m)';

            switch order
                case 2
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_2(m,obj.h);
                case 3
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_3(m,obj.h);
                case 4
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_4(m,obj.h);
                case 5
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_5(m,obj.h);
                case 6
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_6(m,obj.h);
                case 7
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_7(m,obj.h);
                case 8
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_8(m,obj.h);
                case 9
                    [obj.H, obj.HI, obj.Dp, obj.Dm, obj.e_l, obj.e_r] = ...
                        sbp.implementations.d1_upwind_9(m,obj.h);
                otherwise
                    error('Invalid operator order %d.',order);
            end

            obj.m = m;
        	obj.borrowing = [];

        end

        function str = string(obj)
            str = [class(obj) '_' num2str(obj.order)];
        end
    end


end