comparison +scheme/Burgers1D.m @ 832:5573913a0949 feature/burgers1d

Merged with default, and updated +scheme/Burgers1D accordingly
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 11 Sep 2018 15:58:35 +0200
parents d0934d1143b7
children 9f4c45a2d271
comparison
equal deleted inserted replaced
831:d0934d1143b7 832:5573913a0949
1 classdef Burgers1D < scheme.Scheme 1 classdef Burgers1D < scheme.Scheme
2 properties 2 properties
3 m % Number of points in each direction, possibly a vector 3 grid % Physical grid
4 h % Grid spacing
5 x % Grid
6 order % Order accuracy for the approximation 4 order % Order accuracy for the approximation
5
7 params 6 params
8 7
9 D % Non-stabalized scheme operator 8 D % Non-stabalized scheme operator
10 M % Derivative norm 9 M % Derivative norm
11 H % Discrete norm 10 H % Discrete norm
15 d_l 14 d_l
16 d_r 15 d_r
17 end 16 end
18 17
19 methods 18 methods
20 function obj = Burgers1D(pde_form, operator_type, order, m, lim, params) 19 function obj = Burgers1D(grid, pde_form, operator_type, order, params)
21 [x, h] = util.get_grid(lim{:},m); 20 assert(grid.D == 1);
21 assert(grid.size() == length(params.eps));
22 m = grid.size();
23 h = grid.scaling();
24 lim = grid.lim{1}; % Ugly, and only applicable for cartesian grids.
22 default_arg('pde_form','skew-symmetric'); 25 default_arg('pde_form','skew-symmetric');
23 default_arg('operator_type','narrow'); 26 default_arg('operator_type','narrow');
24 27
25 switch operator_type 28 switch operator_type
26 case 'narrow' 29 case 'narrow'
36 D = @(v, viscosity) -1/3*v.*D1*v - 1/3*D1*v.^2 + D2(params.eps + viscosity)*v; 39 D = @(v, viscosity) -1/3*v.*D1*v - 1/3*D1*v.^2 + D2(params.eps + viscosity)*v;
37 case 'conservative' 40 case 'conservative'
38 D = @(v, viscosity) -1/2*D1*v.^2 + D2(params.eps + viscosity)*v; 41 D = @(v, viscosity) -1/2*D1*v.^2 + D2(params.eps + viscosity)*v;
39 end 42 end
40 43
41 obj.m = m; 44 obj.grid = grid;
42 obj.h = h;
43 obj.order = order; 45 obj.order = order;
44 obj.x = x;
45 obj.params = params; 46 obj.params = params;
46 47
47 %% TODO: Figure out how to evaluate viscosity as viscosity(v,t) here instead of parametrizing D on the viscosity. 48 %% TODO: Figure out how to evaluate viscosity as viscosity(v,t) here instead of parametrizing D on the viscosity.
48 obj.D = D; 49 obj.D = D;
49 obj.M = ops.M; 50 obj.M = ops.M;
105 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) 106 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)
106 error('An interface function does not exist yet'); 107 error('An interface function does not exist yet');
107 end 108 end
108 109
109 function N = size(obj) 110 function N = size(obj)
110 N = obj.m; 111 N = obj.grid.m;
111 end 112 end
112
113 end 113 end
114 end 114 end