Mercurial > repos > public > sbplib
comparison +scheme/Utux.m @ 905:459eeb99130f feature/utux2D
Include type as (optional) input parameter in the interface method of all schemes.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Thu, 22 Nov 2018 22:03:44 -0800 |
parents | efe2dbf9796e |
children | b9c98661ff5d |
comparison
equal
deleted
inserted
replaced
904:14b093a344eb | 905:459eeb99130f |
---|---|
14 e_r | 14 e_r |
15 v0 | 15 v0 |
16 end | 16 end |
17 | 17 |
18 | 18 |
19 methods | 19 methods |
20 function obj = Utux(g ,order, operator) | 20 function obj = Utux(g ,order, operator) |
21 default_arg('operator','Standard'); | 21 default_arg('operator','Standard'); |
22 | 22 |
23 m = g.size(); | 23 m = g.size(); |
24 xl = g.getBoundary('l'); | 24 xl = g.getBoundary('l'); |
25 xr = g.getBoundary('r'); | 25 xr = g.getBoundary('r'); |
26 xlim = {xl, xr}; | 26 xlim = {xl, xr}; |
27 | 27 |
28 switch operator | 28 switch operator |
29 % case 'NonEquidistant' | 29 % case 'NonEquidistant' |
30 % ops = sbp.D1Nonequidistant(m,xlim,order); | 30 % ops = sbp.D1Nonequidistant(m,xlim,order); |
31 % obj.D1 = ops.D1; | 31 % obj.D1 = ops.D1; |
32 case 'Standard' | 32 case 'Standard' |
36 % ops = sbp.D1Upwind(m,xlim,order); | 36 % ops = sbp.D1Upwind(m,xlim,order); |
37 % obj.D1 = ops.Dm; | 37 % obj.D1 = ops.Dm; |
38 otherwise | 38 otherwise |
39 error('Unvalid operator') | 39 error('Unvalid operator') |
40 end | 40 end |
41 | 41 |
42 obj.grid = g; | 42 obj.grid = g; |
43 | 43 |
44 obj.H = ops.H; | 44 obj.H = ops.H; |
45 obj.Hi = ops.HI; | 45 obj.Hi = ops.HI; |
46 | 46 |
47 obj.e_l = ops.e_l; | 47 obj.e_l = ops.e_l; |
48 obj.e_r = ops.e_r; | 48 obj.e_r = ops.e_r; |
49 obj.D = -obj.D1; | 49 obj.D = -obj.D1; |
50 | 50 |
51 obj.m = m; | 51 obj.m = m; |
60 % data is a function returning the data that should be applied at the boundary. | 60 % data is a function returning the data that should be applied at the boundary. |
61 % neighbour_scheme is an instance of Scheme that should be interfaced to. | 61 % neighbour_scheme is an instance of Scheme that should be interfaced to. |
62 % neighbour_boundary is a string specifying which boundary to interface to. | 62 % neighbour_boundary is a string specifying which boundary to interface to. |
63 function [closure, penalty] = boundary_condition(obj,boundary,type) | 63 function [closure, penalty] = boundary_condition(obj,boundary,type) |
64 default_arg('type','dirichlet'); | 64 default_arg('type','dirichlet'); |
65 tau =-1*obj.e_l; | 65 tau =-1*obj.e_l; |
66 closure = obj.Hi*tau*obj.e_l'; | 66 closure = obj.Hi*tau*obj.e_l'; |
67 penalty = -obj.Hi*tau; | 67 penalty = -obj.Hi*tau; |
68 | 68 |
69 end | 69 end |
70 | 70 |
71 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) | 71 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
72 switch boundary | 72 switch boundary |
73 % Upwind coupling | 73 % Upwind coupling |
74 case {'l','left'} | 74 case {'l','left'} |
75 tau = -1*obj.e_l; | 75 tau = -1*obj.e_l; |
76 closure = obj.Hi*tau*obj.e_l'; | 76 closure = obj.Hi*tau*obj.e_l'; |
77 penalty = -obj.Hi*tau*neighbour_scheme.e_r'; | 77 penalty = -obj.Hi*tau*neighbour_scheme.e_r'; |
78 case {'r','right'} | 78 case {'r','right'} |
79 tau = 0*obj.e_r; | 79 tau = 0*obj.e_r; |
80 closure = obj.Hi*tau*obj.e_r'; | 80 closure = obj.Hi*tau*obj.e_r'; |
81 penalty = -obj.Hi*tau*neighbour_scheme.e_l'; | 81 penalty = -obj.Hi*tau*neighbour_scheme.e_l'; |
82 end | 82 end |
83 | 83 |
84 end | 84 end |
85 | 85 |
86 function N = size(obj) | 86 function N = size(obj) |
87 N = obj.m; | 87 N = obj.m; |
88 end | 88 end |
89 | 89 |
90 end | 90 end |