270
|
1 classdef Utux < scheme.Scheme
|
|
2 properties
|
|
3 m % Number of points in each direction, possibly a vector
|
|
4 h % Grid spacing
|
|
5 x % Grid
|
|
6 order % Order accuracy for the approximation
|
|
7
|
|
8 H % Discrete norm
|
|
9 M % Derivative norm
|
|
10 D
|
|
11
|
|
12 D1
|
|
13 Hi
|
|
14 e_l
|
|
15 e_r
|
|
16 v0
|
|
17 end
|
|
18
|
|
19
|
|
20 methods
|
|
21 function obj = Utux(m,xlim,order)
|
|
22 default_arg('a',1);
|
|
23 [x, h] = util.get_grid(xlim{:},m);
|
|
24 ops = sbp.Ordinary(m,h,order);
|
|
25
|
|
26 obj.D1 = sparse(ops.derivatives.D1);
|
|
27 obj.H = sparse(ops.norms.H);
|
|
28 obj.Hi = sparse(ops.norms.HI);
|
|
29 obj.M = sparse(ops.norms.M);
|
|
30 obj.e_l = sparse(ops.boundary.e_1);
|
|
31 obj.e_r = sparse(ops.boundary.e_m);
|
|
32 obj.D=obj.D1;
|
|
33
|
|
34 obj.m = m;
|
|
35 obj.h = h;
|
|
36 obj.order = order;
|
|
37 obj.x = x;
|
|
38
|
|
39 end
|
|
40 % 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.
|
|
42 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
|
|
43 % type is a string specifying the type of boundary condition if there are several.
|
|
44 % data is a function returning the data that should be applied at the boundary.
|
|
45 % neighbour_scheme is an instance of Scheme that should be interfaced to.
|
|
46 % neighbour_boundary is a string specifying which boundary to interface to.
|
|
47 function [closure, penalty] = boundary_condition(obj,boundary,type,data)
|
|
48 default_arg('type','neumann');
|
|
49 default_arg('data',0);
|
|
50 tau = -1*obj.e_l;
|
|
51 closure = obj.Hi*tau*obj.e_l';
|
|
52 penalty = 0*obj.e_l;
|
|
53
|
|
54 end
|
|
55
|
|
56 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)
|
|
57 error('An interface function does not exist yet');
|
|
58 end
|
|
59
|
|
60 function N = size(obj)
|
|
61 N = obj.m;
|
|
62 end
|
|
63
|
|
64 end
|
|
65
|
|
66 methods(Static)
|
|
67 % Calculates the matrcis need for the inteface coupling between boundary bound_u of scheme schm_u
|
|
68 % and bound_v of scheme schm_v.
|
|
69 % [uu, uv, vv, vu] = inteface_couplong(A,'r',B,'l')
|
|
70 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v)
|
|
71 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v);
|
|
72 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u);
|
|
73 end
|
|
74 end
|
|
75 end |