comparison +scheme/Utux.m @ 378:18525f1bb941

Merged in feature/hypsyst (pull request #4) Feature/hypsyst
author Jonatan Werpers <jonatan.werpers@it.uu.se>
date Thu, 26 Jan 2017 13:07:51 +0000
parents 05947fc2505c
children 324c927d8b1d 38c3da9675a5
comparison
equal deleted inserted replaced
374:f1289f3b86b8 378:18525f1bb941
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
16 v0 15 v0
17 end 16 end
18 17
19 18
20 methods 19 methods
21 function obj = Utux(m,xlim,order) 20 function obj = Utux(m,xlim,order,operator)
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
28 switch operator
29 case 'NonEquidistant'
30 ops = sbp.D1Nonequidistant(m,xlim,order);
31 obj.D1 = ops.D1;
32 case 'Standard'
33 ops = sbp.D2Standard(m,xlim,order);
34 obj.D1 = ops.D1;
35 case 'Upwind'
36 ops = sbp.D1Upwind(m,xlim,order);
37 obj.D1 = ops.Dm;
38 otherwise
39 error('Unvalid operator')
40 end
41 obj.x=ops.x;
25 42
26 obj.D1 = sparse(ops.derivatives.D1); 43
27 obj.H = sparse(ops.norms.H); 44 obj.H = ops.H;
28 obj.Hi = sparse(ops.norms.HI); 45 obj.Hi = ops.HI;
29 obj.M = sparse(ops.norms.M); 46
30 obj.e_l = sparse(ops.boundary.e_1); 47 obj.e_l = ops.e_l;
31 obj.e_r = sparse(ops.boundary.e_m); 48 obj.e_r = ops.e_r;
32 obj.D=obj.D1; 49 obj.D=obj.D1;
33 50
34 obj.m = m; 51 obj.m = m;
35 obj.h = h; 52 obj.h = ops.h;
36 obj.order = order; 53 obj.order = order;
37 obj.x = x; 54 obj.x = ops.x;
38 55
39 end 56 end
40 % Closure functions return the opertors applied to the own doamin to close the boundary 57 % 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. 58 % 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'. 59 % 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. 62 % neighbour_scheme is an instance of Scheme that should be interfaced to.
46 % neighbour_boundary is a string specifying which boundary to interface to. 63 % neighbour_boundary is a string specifying which boundary to interface to.
47 function [closure, penalty] = boundary_condition(obj,boundary,type,data) 64 function [closure, penalty] = boundary_condition(obj,boundary,type,data)
48 default_arg('type','neumann'); 65 default_arg('type','neumann');
49 default_arg('data',0); 66 default_arg('data',0);
50 tau = -1*obj.e_l; 67 tau =-1*obj.e_l;
51 closure = obj.Hi*tau*obj.e_l'; 68 closure = obj.Hi*tau*obj.e_l';
52 penalty = 0*obj.e_l; 69 penalty = 0*obj.e_l;
53 70
54 end 71 end
55 72