Mercurial > repos > public > sbplib
annotate +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 |
rev | line source |
---|---|
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 D | |
10 | |
11 D1 | |
12 Hi | |
13 e_l | |
14 e_r | |
15 v0 | |
16 end | |
17 | |
18 | |
19 methods | |
20 function obj = Utux(m,xlim,order) | |
21 default_arg('a',1); | |
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
22 |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
23 %Old operators |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
24 % [x, h] = util.get_grid(xlim{:},m); |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
25 %ops = sbp.Ordinary(m,h,order); |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
26 |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
27 ops = sbp.D1Nonequidistant(m,xlim,order); |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
28 % ops = sbp.D2Standard(m,xlim,order); |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
29 |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
30 obj.x=ops.x; |
270 | 31 |
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
32 obj.D1 = ops.D1; |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
33 obj.H = ops.H; |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
34 obj.Hi = ops.HI; |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
35 |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
36 obj.e_l = ops.e_l; |
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
37 obj.e_r = ops.e_r; |
270 | 38 obj.D=obj.D1; |
39 | |
40 obj.m = m; | |
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
41 obj.h = ops.h; |
270 | 42 obj.order = order; |
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
43 obj.x = ops.x; |
270 | 44 |
45 end | |
46 % Closure functions return the opertors applied to the own doamin to close the boundary | |
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. | |
48 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. | |
49 % type is a string specifying the type of boundary condition if there are several. | |
50 % data is a function returning the data that should be applied at the boundary. | |
51 % neighbour_scheme is an instance of Scheme that should be interfaced to. | |
52 % neighbour_boundary is a string specifying which boundary to interface to. | |
53 function [closure, penalty] = boundary_condition(obj,boundary,type,data) | |
54 default_arg('type','neumann'); | |
55 default_arg('data',0); | |
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
56 tau =-1*obj.e_l; |
270 | 57 closure = obj.Hi*tau*obj.e_l'; |
58 penalty = 0*obj.e_l; | |
59 | |
60 end | |
61 | |
62 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) | |
63 error('An interface function does not exist yet'); | |
64 end | |
65 | |
66 function N = size(obj) | |
67 N = obj.m; | |
68 end | |
69 | |
70 end | |
71 | |
72 methods(Static) | |
73 % Calculates the matrcis need for the inteface coupling between boundary bound_u of scheme schm_u | |
74 % and bound_v of scheme schm_v. | |
75 % [uu, uv, vv, vu] = inteface_couplong(A,'r',B,'l') | |
76 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v) | |
77 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v); | |
78 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u); | |
79 end | |
80 end | |
81 end |