comparison +scheme/Utux.m @ 290:d32f674bcbe5 feature/hypsyst

A first attempt to make a general scheme fo hyperbolic systems
author Ylva Rydin <ylva.rydin@telia.com>
date Fri, 16 Sep 2016 14:51:17 +0200
parents d755816aa0fa
children 9b3d7fc61a36
comparison
equal deleted inserted replaced
285:70184f6c6cb5 290:d32f674bcbe5
4 h % Grid spacing 4 h % Grid spacing
5 x % Grid 5 x % Grid
6 order % Order accuracy for the approximation 6 order % Order accuracy for the approximation
7 7
8 H % Discrete norm 8 H % Discrete norm
9 M % Derivative norm
10 D 9 D
11 10
12 D1 11 D1
13 Hi 12 Hi
14 e_l 13 e_l
18 17
19 18
20 methods 19 methods
21 function obj = Utux(m,xlim,order) 20 function obj = Utux(m,xlim,order)
22 default_arg('a',1); 21 default_arg('a',1);
23 [x, h] = util.get_grid(xlim{:},m); 22
24 ops = sbp.Ordinary(m,h,order); 23 %Old operators
24 % [x, h] = util.get_grid(xlim{:},m);
25 %ops = sbp.Ordinary(m,h,order);
26
27 ops = sbp.D1Nonequidistant(m,xlim,order);
28 % ops = sbp.D2Standard(m,xlim,order);
29
30 obj.x=ops.x;
25 31
26 obj.D1 = sparse(ops.derivatives.D1); 32 obj.D1 = ops.D1;
27 obj.H = sparse(ops.norms.H); 33 obj.H = ops.H;
28 obj.Hi = sparse(ops.norms.HI); 34 obj.Hi = ops.HI;
29 obj.M = sparse(ops.norms.M); 35
30 obj.e_l = sparse(ops.boundary.e_1); 36 obj.e_l = ops.e_l;
31 obj.e_r = sparse(ops.boundary.e_m); 37 obj.e_r = ops.e_r;
32 obj.D=obj.D1; 38 obj.D=obj.D1;
33 39
34 obj.m = m; 40 obj.m = m;
35 obj.h = h; 41 obj.h = ops.h;
36 obj.order = order; 42 obj.order = order;
37 obj.x = x; 43 obj.x = ops.x;
38 44
39 end 45 end
40 % Closure functions return the opertors applied to the own doamin to close the boundary 46 % Closure functions return the opertors applied to the own doamin to close the boundary
41 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. 47 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin.
42 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. 48 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
45 % neighbour_scheme is an instance of Scheme that should be interfaced to. 51 % neighbour_scheme is an instance of Scheme that should be interfaced to.
46 % neighbour_boundary is a string specifying which boundary to interface to. 52 % neighbour_boundary is a string specifying which boundary to interface to.
47 function [closure, penalty] = boundary_condition(obj,boundary,type,data) 53 function [closure, penalty] = boundary_condition(obj,boundary,type,data)
48 default_arg('type','neumann'); 54 default_arg('type','neumann');
49 default_arg('data',0); 55 default_arg('data',0);
50 tau = -1*obj.e_l; 56 tau =-1*obj.e_l;
51 closure = obj.Hi*tau*obj.e_l'; 57 closure = obj.Hi*tau*obj.e_l';
52 penalty = 0*obj.e_l; 58 penalty = 0*obj.e_l;
53 59
54 end 60 end
55 61