Mercurial > repos > public > sbplib
annotate +scheme/LaplaceCurvilinear.m @ 1342:d1dad4fbfe22 feature/D2_boundary_opt
Add support for glue interpolation operators, and separate wave speeds across interfaces
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 26 Aug 2022 14:19:29 +0200 |
parents | 84200bbae101 |
children |
rev | line source |
---|---|
450
8d455e49364f
Copy Wave2dCurve to new scheme LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
449
diff
changeset
|
1 classdef LaplaceCurvilinear < scheme.Scheme |
0 | 2 properties |
3 m % Number of points in each direction, possibly a vector | |
4 h % Grid spacing | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
5 |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
6 grid |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
7 |
0 | 8 order % Order accuracy for the approximation |
9 | |
552
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
10 a,b % Parameters of the operator |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
11 |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
12 |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
13 % Inner products and operators for physical coordinates |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
14 D % Laplace operator |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
15 H, Hi % Inner product |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
16 e_w, e_e, e_s, e_n |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
17 d_w, d_e, d_s, d_n % Normal derivatives at the boundary |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
18 H_w, H_e, H_s, H_n % Boundary inner products |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
19 Dx, Dy % Physical derivatives |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
20 M % Gradient inner product |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
21 |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
22 % Metric coefficients |
0 | 23 J, Ji |
24 a11, a12, a22 | |
552
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
25 x_u |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
26 x_v |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
27 y_u |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
28 y_v |
0 | 29 |
552
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
30 % Inner product and operators for logical coordinates |
0 | 31 H_u, H_v % Norms in the x and y directions |
552
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
32 Hi_u, Hi_v |
0 | 33 Hu,Hv % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir. |
34 Hiu, Hiv | |
35 du_w, dv_w | |
36 du_e, dv_e | |
37 du_s, dv_s | |
38 du_n, dv_n | |
39 gamm_u, gamm_v | |
27
97a638f91fb8
Added function spdiag(). Fixed a bunch of bugs in the Wave2dCurve scheme.
Jonatan Werpers <jonatan@werpers.com>
parents:
5
diff
changeset
|
40 lambda |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
41 |
0 | 42 end |
43 | |
44 methods | |
452
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
45 % Implements a*div(b*grad(u)) as a SBP scheme |
539 | 46 % TODO: Implement proper H, it should be the real physical quadrature, the logic quadrature may be but in a separate variable (H_logic?) |
47 | |
906
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
48 function obj = LaplaceCurvilinear(g ,order, a, b, opSet) |
303
f18142c1530b
Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents:
96
diff
changeset
|
49 default_arg('opSet',@sbp.D2Variable); |
452
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
50 default_arg('a', 1); |
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
51 default_arg('b', 1); |
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
52 |
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
53 if b ~=1 |
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
54 error('Not implemented yet') |
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
55 end |
0 | 56 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
57 % assert(isa(g, 'grid.Curvilinear')) |
743
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
58 if isa(a, 'function_handle') |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
59 a = grid.evalOn(g, a); |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
60 a = spdiag(a); |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
61 end |
0 | 62 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
63 m = g.size(); |
0 | 64 m_u = m(1); |
65 m_v = m(2); | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
66 m_tot = g.N(); |
0 | 67 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
68 h = g.scaling(); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
69 h_u = h(1); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
70 h_v = h(2); |
0 | 71 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
72 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
73 % 1D operators |
303
f18142c1530b
Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents:
96
diff
changeset
|
74 ops_u = opSet(m_u, {0, 1}, order); |
f18142c1530b
Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents:
96
diff
changeset
|
75 ops_v = opSet(m_v, {0, 1}, order); |
0 | 76 |
77 I_u = speye(m_u); | |
78 I_v = speye(m_v); | |
79 | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
80 D1_u = ops_u.D1; |
303
f18142c1530b
Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents:
96
diff
changeset
|
81 D2_u = ops_u.D2; |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
82 H_u = ops_u.H; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
83 Hi_u = ops_u.HI; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
84 e_l_u = ops_u.e_l; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
85 e_r_u = ops_u.e_r; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
86 d1_l_u = ops_u.d1_l; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
87 d1_r_u = ops_u.d1_r; |
0 | 88 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
89 D1_v = ops_v.D1; |
303
f18142c1530b
Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents:
96
diff
changeset
|
90 D2_v = ops_v.D2; |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
91 H_v = ops_v.H; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
92 Hi_v = ops_v.HI; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
93 e_l_v = ops_v.e_l; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
94 e_r_v = ops_v.e_r; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
95 d1_l_v = ops_v.d1_l; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
96 d1_r_v = ops_v.d1_r; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
97 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
98 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
99 % Logical operators |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
100 Du = kr(D1_u,I_v); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
101 Dv = kr(I_u,D1_v); |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
102 obj.Hu = kr(H_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
103 obj.Hv = kr(I_u,H_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
104 obj.Hiu = kr(Hi_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
105 obj.Hiv = kr(I_u,Hi_v); |
1342
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
106 obj.H_u = H_u; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
107 obj.H_v = H_v; |
0 | 108 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
109 e_w = kr(e_l_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
110 e_e = kr(e_r_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
111 e_s = kr(I_u,e_l_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
112 e_n = kr(I_u,e_r_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
113 obj.du_w = kr(d1_l_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
114 obj.dv_w = (e_w'*Dv)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
115 obj.du_e = kr(d1_r_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
116 obj.dv_e = (e_e'*Dv)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
117 obj.du_s = (e_s'*Du)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
118 obj.dv_s = kr(I_u,d1_l_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
119 obj.du_n = (e_n'*Du)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
120 obj.dv_n = kr(I_u,d1_r_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
121 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
122 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
123 % Metric coefficients |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
124 coords = g.points(); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
125 x = coords(:,1); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
126 y = coords(:,2); |
0 | 127 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
128 x_u = Du*x; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
129 x_v = Dv*x; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
130 y_u = Du*y; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
131 y_v = Dv*y; |
0 | 132 |
133 J = x_u.*y_v - x_v.*y_u; | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
134 a11 = 1./J .* (x_v.^2 + y_v.^2); |
0 | 135 a12 = -1./J .* (x_u.*x_v + y_u.*y_v); |
136 a22 = 1./J .* (x_u.^2 + y_u.^2); | |
137 lambda = 1/2 * (a11 + a22 - sqrt((a11-a22).^2 + 4*a12.^2)); | |
138 | |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
139 obj.x_u = x_u; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
140 obj.x_v = x_v; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
141 obj.y_u = y_u; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
142 obj.y_v = y_v; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
143 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
144 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
145 % Assemble full operators |
551
c5a7a13c03dc
Switch to using spdiag instead of spdiags
Jonatan Werpers <jonatan@werpers.com>
parents:
539
diff
changeset
|
146 L_12 = spdiag(a12); |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
147 Duv = Du*L_12*Dv; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
148 Dvu = Dv*L_12*Du; |
0 | 149 |
150 Duu = sparse(m_tot); | |
151 Dvv = sparse(m_tot); | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
152 ind = grid.funcToMatrix(g, 1:m_tot); |
0 | 153 |
154 for i = 1:m_v | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
155 D = D2_u(a11(ind(:,i))); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
156 p = ind(:,i); |
0 | 157 Duu(p,p) = D; |
158 end | |
159 | |
160 for i = 1:m_u | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
161 D = D2_v(a22(ind(i,:))); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
162 p = ind(i,:); |
0 | 163 Dvv(p,p) = D; |
164 end | |
165 | |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
166 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
167 % Physical operators |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
168 obj.J = spdiag(J); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
169 obj.Ji = spdiag(1./J); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
170 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
171 obj.D = obj.Ji*a*(Duu + Duv + Dvu + Dvv); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
172 obj.H = obj.J*kr(H_u,H_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
173 obj.Hi = obj.Ji*kr(Hi_u,Hi_v); |
0 | 174 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
175 obj.e_w = e_w; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
176 obj.e_e = e_e; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
177 obj.e_s = e_s; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
178 obj.e_n = e_n; |
376 | 179 |
557
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
180 %% normal derivatives |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
181 I_w = ind(1,:); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
182 I_e = ind(end,:); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
183 I_s = ind(:,1); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
184 I_n = ind(:,end); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
185 |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
186 a11_w = spdiag(a11(I_w)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
187 a12_w = spdiag(a12(I_w)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
188 a11_e = spdiag(a11(I_e)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
189 a12_e = spdiag(a12(I_e)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
190 a22_s = spdiag(a22(I_s)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
191 a12_s = spdiag(a12(I_s)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
192 a22_n = spdiag(a22(I_n)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
193 a12_n = spdiag(a12(I_n)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
194 |
565 | 195 s_w = sqrt((e_w'*x_v).^2 + (e_w'*y_v).^2); |
196 s_e = sqrt((e_e'*x_v).^2 + (e_e'*y_v).^2); | |
197 s_s = sqrt((e_s'*x_u).^2 + (e_s'*y_u).^2); | |
198 s_n = sqrt((e_n'*x_u).^2 + (e_n'*y_u).^2); | |
562
11d8d6ccbcd7
Add boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
561
diff
changeset
|
199 |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
200 obj.d_w = -1*(spdiag(1./s_w)*(a11_w*obj.du_w' + a12_w*obj.dv_w'))'; |
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
201 obj.d_e = (spdiag(1./s_e)*(a11_e*obj.du_e' + a12_e*obj.dv_e'))'; |
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
202 obj.d_s = -1*(spdiag(1./s_s)*(a22_s*obj.dv_s' + a12_s*obj.du_s'))'; |
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
203 obj.d_n = (spdiag(1./s_n)*(a22_n*obj.dv_n' + a12_n*obj.du_n'))'; |
554
6e71d4f8b155
Better names for the metric coefficients
Jonatan Werpers <jonatan@werpers.com>
parents:
553
diff
changeset
|
204 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
205 obj.Dx = spdiag( y_v./J)*Du + spdiag(-y_u./J)*Dv; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
206 obj.Dy = spdiag(-x_v./J)*Du + spdiag( x_u./J)*Dv; |
384
32df00102268
Fix bug in Characteristic BC for Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
360
diff
changeset
|
207 |
562
11d8d6ccbcd7
Add boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
561
diff
changeset
|
208 %% Boundary inner products |
564
9bf49338f8e6
Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
563
diff
changeset
|
209 obj.H_w = H_v*spdiag(s_w); |
9bf49338f8e6
Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
563
diff
changeset
|
210 obj.H_e = H_v*spdiag(s_e); |
9bf49338f8e6
Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
563
diff
changeset
|
211 obj.H_s = H_u*spdiag(s_s); |
9bf49338f8e6
Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
563
diff
changeset
|
212 obj.H_n = H_u*spdiag(s_n); |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
213 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
214 % Misc. |
0 | 215 obj.m = m; |
216 obj.h = [h_u h_v]; | |
217 obj.order = order; | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
218 obj.grid = g; |
0 | 219 |
452
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
220 obj.a = a; |
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
221 obj.b = b; |
0 | 222 obj.a11 = a11; |
223 obj.a12 = a12; | |
224 obj.a22 = a22; | |
27
97a638f91fb8
Added function spdiag(). Fixed a bunch of bugs in the Wave2dCurve scheme.
Jonatan Werpers <jonatan@werpers.com>
parents:
5
diff
changeset
|
225 obj.lambda = lambda; |
0 | 226 |
389
42c89b5eedc0
Add borrowing constants for D2 operators in D4Variable
Jonatan Werpers <jonatan@werpers.com>
parents:
384
diff
changeset
|
227 obj.gamm_u = h_u*ops_u.borrowing.M.d1; |
42c89b5eedc0
Add borrowing constants for D2 operators in D4Variable
Jonatan Werpers <jonatan@werpers.com>
parents:
384
diff
changeset
|
228 obj.gamm_v = h_v*ops_v.borrowing.M.d1; |
0 | 229 end |
230 | |
231 | |
232 % Closure functions return the opertors applied to the own doamin to close the boundary | |
233 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. | |
234 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. | |
235 % type is a string specifying the type of boundary condition if there are several. | |
236 % data is a function returning the data that should be applied at the boundary. | |
237 % neighbour_scheme is an instance of Scheme that should be interfaced to. | |
238 % neighbour_boundary is a string specifying which boundary to interface to. | |
347
85c2fe06d551
Implemented characteristic form BC in Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
337
diff
changeset
|
239 function [closure, penalty] = boundary_condition(obj, boundary, type, parameter) |
0 | 240 default_arg('type','neumann'); |
347
85c2fe06d551
Implemented characteristic form BC in Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
337
diff
changeset
|
241 default_arg('parameter', []); |
0 | 242 |
1047
6bc55a773e7c
Fix some mistakes from dc1bcbef2a86
Jonatan Werpers <jonatan@werpers.com>
parents:
1046
diff
changeset
|
243 e = obj.getBoundaryOperator('e', boundary); |
6bc55a773e7c
Fix some mistakes from dc1bcbef2a86
Jonatan Werpers <jonatan@werpers.com>
parents:
1046
diff
changeset
|
244 d = obj.getBoundaryOperator('d', boundary); |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
245 H_b = obj.getBoundaryQuadrature(boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
246 gamm = obj.getBoundaryBorrowing(boundary); |
0 | 247 switch type |
248 % Dirichlet boundary condition | |
249 case {'D','d','dirichlet'} | |
82
df642750e8f7
Added Dirichelt BC to Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
55
diff
changeset
|
250 tuning = 1.2; |
df642750e8f7
Added Dirichelt BC to Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
55
diff
changeset
|
251 % tuning = 20.2; |
df642750e8f7
Added Dirichelt BC to Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
55
diff
changeset
|
252 |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
253 b1 = gamm*obj.lambda./obj.a11.^2; |
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
254 b2 = gamm*obj.lambda./obj.a22.^2; |
0 | 255 |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
256 tau1 = tuning * spdiag(-1./b1 - 1./b2); |
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
257 tau2 = 1; |
0 | 258 |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
259 tau = (tau1*e + tau2*d)*H_b; |
0 | 260 |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
261 closure = obj.a*obj.Hi*tau*e'; |
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
262 penalty = -obj.a*obj.Hi*tau; |
0 | 263 |
264 | |
265 % Neumann boundary condition | |
266 case {'N','n','neumann'} | |
558
54c775c3348a
Clean up use of the sign in boundary and interface routines
Jonatan Werpers <jonatan@werpers.com>
parents:
557
diff
changeset
|
267 tau1 = -1; |
0 | 268 tau2 = 0; |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
269 tau = (tau1*e + tau2*d)*H_b; |
0 | 270 |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
271 closure = obj.a*obj.Hi*tau*d'; |
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
272 penalty = -obj.a*obj.Hi*tau; |
0 | 273 |
274 | |
275 % Unknown, boundary condition | |
276 otherwise | |
277 error('No such boundary condition: type = %s',type); | |
278 end | |
279 end | |
280 | |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
281 % type Struct that specifies the interface coupling. |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
282 % Fields: |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
283 % -- tuning: penalty strength, defaults to 1.2 |
935
1bf200417957
Fix doc for LaplaceCurvilinear.interface
Jonatan Werpers <jonatan@werpers.com>
parents:
928
diff
changeset
|
284 % -- interpolation: type of interpolation, default 'none' |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
285 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
927
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
286 |
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
287 defaultType.tuning = 1.2; |
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
288 defaultType.interpolation = 'none'; |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
289 default_struct('type', defaultType); |
927
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
290 |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
291 switch type.interpolation |
927
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
292 case {'none', ''} |
940
31186559236d
Add forgotten type argument in call to interfaceStandard in Schrodinger2d and LaplCurv.
Martin Almquist <malmquist@stanford.edu>
parents:
938
diff
changeset
|
293 [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type); |
1342
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
294 case {'op','OP','glue'} |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
295 [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type); |
927
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
296 otherwise |
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
297 error('Unknown type of interpolation: %s ', type.interpolation); |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
298 end |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
299 end |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
300 |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
301 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
302 tuning = type.tuning; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
303 |
906
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
304 % u denotes the solution in the own domain |
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
305 % v denotes the solution in the neighbour domain |
1047
6bc55a773e7c
Fix some mistakes from dc1bcbef2a86
Jonatan Werpers <jonatan@werpers.com>
parents:
1046
diff
changeset
|
306 e_u = obj.getBoundaryOperator('e', boundary); |
6bc55a773e7c
Fix some mistakes from dc1bcbef2a86
Jonatan Werpers <jonatan@werpers.com>
parents:
1046
diff
changeset
|
307 d_u = obj.getBoundaryOperator('d', boundary); |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
308 H_b_u = obj.getBoundaryQuadrature(boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
309 I_u = obj.getBoundaryIndices(boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
310 gamm_u = obj.getBoundaryBorrowing(boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
311 |
1047
6bc55a773e7c
Fix some mistakes from dc1bcbef2a86
Jonatan Werpers <jonatan@werpers.com>
parents:
1046
diff
changeset
|
312 e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary); |
6bc55a773e7c
Fix some mistakes from dc1bcbef2a86
Jonatan Werpers <jonatan@werpers.com>
parents:
1046
diff
changeset
|
313 d_v = neighbour_scheme.getBoundaryOperator('d', neighbour_boundary); |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
314 H_b_v = neighbour_scheme.getBoundaryQuadrature(neighbour_boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
315 I_v = neighbour_scheme.getBoundaryIndices(neighbour_boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
316 gamm_v = neighbour_scheme.getBoundaryBorrowing(neighbour_boundary); |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
317 |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
318 u = obj; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
319 v = neighbour_scheme; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
320 |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
321 b1_u = gamm_u*u.lambda(I_u)./u.a11(I_u).^2; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
322 b2_u = gamm_u*u.lambda(I_u)./u.a22(I_u).^2; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
323 b1_v = gamm_v*v.lambda(I_v)./v.a11(I_v).^2; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
324 b2_v = gamm_v*v.lambda(I_v)./v.a22(I_v).^2; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
325 |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
326 tau1 = -1./(4*b1_u) -1./(4*b1_v) -1./(4*b2_u) -1./(4*b2_v); |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
327 tau1 = tuning * spdiag(tau1); |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
328 tau2 = 1/2; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
329 |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
330 sig1 = -1/2; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
331 sig2 = 0; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
332 |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
333 tau = (e_u*tau1 + tau2*d_u)*H_b_u; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
334 sig = (sig1*e_u + sig2*d_u)*H_b_u; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
335 |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
336 closure = obj.a*obj.Hi*( tau*e_u' + sig*d_u'); |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
337 penalty = obj.a*obj.Hi*(-tau*e_v' + sig*d_v'); |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
338 end |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
339 |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
340 function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
341 |
921
19c05eefc8c6
Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents:
910
diff
changeset
|
342 % TODO: Make this work for curvilinear grids |
19c05eefc8c6
Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents:
910
diff
changeset
|
343 warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.'); |
19c05eefc8c6
Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents:
910
diff
changeset
|
344 |
927
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
345 % User can request special interpolation operators by specifying type.interpOpSet |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
346 default_field(type, 'interpOpSet', @sbp.InterpOpsOP); |
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
347 interpOpSet = type.interpOpSet; |
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
348 tuning = type.tuning; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
349 |
927
4291731570bb
Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents:
925
diff
changeset
|
350 |
906
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
351 % u denotes the solution in the own domain |
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
352 % v denotes the solution in the neighbour domain |
1045
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
353 e_u = obj.getBoundaryOperator('e', boundary); |
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
354 d_u = obj.getBoundaryOperator('d', boundary); |
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
355 H_b_u = obj.getBoundaryQuadrature(boundary); |
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
356 I_u = obj.getBoundaryIndices(boundary); |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
357 gamm_u = obj.getBoundaryBorrowing(boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
358 |
1045
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
359 e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary); |
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
360 d_v = neighbour_scheme.getBoundaryOperator('d', neighbour_boundary); |
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
361 H_b_v = neighbour_scheme.getBoundaryQuadrature(neighbour_boundary); |
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
362 I_v = neighbour_scheme.getBoundaryIndices(neighbour_boundary); |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
363 gamm_v = neighbour_scheme.getBoundaryBorrowing(neighbour_boundary); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
364 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
365 |
938
97291e1bd57c
Make LaplCurv send only number of grid points to InterpOpsXX. Remove coordinates from get_boundary_ops method.
Martin Almquist <malmquist@stanford.edu>
parents:
936
diff
changeset
|
366 % Find the number of grid points along the interface |
97291e1bd57c
Make LaplCurv send only number of grid points to InterpOpsXX. Remove coordinates from get_boundary_ops method.
Martin Almquist <malmquist@stanford.edu>
parents:
936
diff
changeset
|
367 m_u = size(e_u, 2); |
97291e1bd57c
Make LaplCurv send only number of grid points to InterpOpsXX. Remove coordinates from get_boundary_ops method.
Martin Almquist <malmquist@stanford.edu>
parents:
936
diff
changeset
|
368 m_v = size(e_v, 2); |
922
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
369 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
370 Hi = obj.Hi; |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
371 |
5
5f6b0b6a012b
First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
372 u = obj; |
5f6b0b6a012b
First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
373 v = neighbour_scheme; |
5f6b0b6a012b
First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
374 |
1342
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
375 a_u = u.a; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
376 a_v = v.a; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
377 |
85
643bc513b8b8
Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents:
83
diff
changeset
|
378 b1_u = gamm_u*u.lambda(I_u)./u.a11(I_u).^2; |
643bc513b8b8
Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents:
83
diff
changeset
|
379 b2_u = gamm_u*u.lambda(I_u)./u.a22(I_u).^2; |
643bc513b8b8
Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents:
83
diff
changeset
|
380 b1_v = gamm_v*v.lambda(I_v)./v.a11(I_v).^2; |
643bc513b8b8
Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents:
83
diff
changeset
|
381 b2_v = gamm_v*v.lambda(I_v)./v.a22(I_v).^2; |
5
5f6b0b6a012b
First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
382 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
383 tau_u = -1./(4*b1_u) -1./(4*b2_u); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
384 tau_v = -1./(4*b1_v) -1./(4*b2_v); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
385 |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
386 tau_u = tuning * spdiag(tau_u); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
387 tau_v = tuning * spdiag(tau_v); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
388 beta_u = tau_v; |
0 | 389 |
922
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
390 % Build interpolation operators |
1342
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
391 switch type.interpolation |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
392 case {'op','OP','MC','mc'} |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
393 intOps = interpOpSet(m_u, m_v, obj.order, neighbour_scheme.order); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
394 Iu2v = intOps.Iu2v; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
395 Iv2u = intOps.Iv2u; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
396 case 'glue' |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
397 optype = type.optype; % TODO: Should be stored by the scheme? |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
398 xu = obj.getBoundaryGrid(boundary); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
399 xv = neighbour_scheme.getBoundaryGrid(neighbour_boundary); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
400 hu = obj.getBoundaryGridSpacing(boundary); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
401 hv = neighbour_scheme.getBoundaryGridSpacing(neighbour_boundary); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
402 glueOps = interpOpSet(xu, xv, hu, hv, obj.order, neighbour_scheme.order, optype, optype); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
403 Iu2v = glueOps.Iu2v; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
404 Iv2u = glueOps.Iv2u; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
405 otherwise |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
406 error(); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
407 end |
922
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
408 |
1342
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
409 closure = a_u*Hi*e_u*tau_u*H_b_u*e_u' + ... |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
410 a_v*Hi*e_u*H_b_u*Iv2u.bad*beta_u*Iu2v.good*e_u' + ... |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
411 a_u*1/2*Hi*d_u*H_b_u*e_u' + ... |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
412 -a_u*1/2*Hi*e_u*H_b_u*d_u'; |
0 | 413 |
1342
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
414 penalty = -a_u*Hi*e_u*tau_u*H_b_u*Iv2u.good*e_v' + ... |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
415 -a_v*Hi*e_u*H_b_u*Iv2u.bad*beta_u*e_v' + ... |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
416 -a_u*1/2*Hi*d_u*H_b_u*Iv2u.good*e_v' + ... |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
417 -a_v*1/2*Hi*e_u*H_b_u*Iv2u.bad*d_v'; |
0 | 418 |
419 end | |
420 | |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
421 % Returns the boundary operator op for the boundary specified by the string boundary. |
1045
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
422 % op -- string |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
423 % boundary -- string |
1045
dc1bcbef2a86
Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1042
diff
changeset
|
424 function o = getBoundaryOperator(obj, op, boundary) |
1046
19ed046aec52
Clean up getBoundaryOps for a few schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1045
diff
changeset
|
425 assertIsMember(op, {'e', 'd'}) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
426 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
427 |
1046
19ed046aec52
Clean up getBoundaryOps for a few schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
1045
diff
changeset
|
428 o = obj.([op, '_', boundary]); |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
429 end |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
430 |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
431 % Returns square boundary quadrature matrix, of dimension |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
432 % corresponding to the number of boundary points |
85
643bc513b8b8
Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents:
83
diff
changeset
|
433 % |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
434 % boundary -- string |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
435 function H_b = getBoundaryQuadrature(obj, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
436 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
85
643bc513b8b8
Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents:
83
diff
changeset
|
437 |
1051
84200bbae101
Bugfix: add missing brackets in getBoundaryQuadrature in LaplCurv and Utux2d
Martin Almquist <malmquist@stanford.edu>
parents:
1047
diff
changeset
|
438 H_b = obj.(['H_', boundary]); |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
439 end |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
440 |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
441 % Returns the indices of the boundary points in the grid matrix |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
442 % boundary -- string |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
443 function I = getBoundaryIndices(obj, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
444 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
445 |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
446 ind = grid.funcToMatrix(obj.grid, 1:prod(obj.m)); |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
447 switch boundary |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
448 case 'w' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
449 I = ind(1,:); |
0 | 450 case 'e' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
451 I = ind(end,:); |
0 | 452 case 's' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
453 I = ind(:,1)'; |
0 | 454 case 'n' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
455 I = ind(:,end)'; |
0 | 456 end |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
457 end |
0 | 458 |
982
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
459 % Returns borrowing constant gamma |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
460 % boundary -- string |
a0b3161e44f3
Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
461 function gamm = getBoundaryBorrowing(obj, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
462 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
463 |
0 | 464 switch boundary |
465 case {'w','e'} | |
466 gamm = obj.gamm_u; | |
467 case {'s','n'} | |
468 gamm = obj.gamm_v; | |
469 end | |
922
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
470 end |
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
471 |
1342
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
472 function xb = getBoundaryGrid(obj, boundary) |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
473 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
474 if isa(obj.grid,'grid.Cartesian') |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
475 lg = obj.grid; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
476 elseif isa(obj.grid,'grid.Curvilinear') |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
477 lg = obj.grid.logicalGrid(); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
478 else |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
479 error('Grid type not supported'); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
480 end |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
481 switch boundary |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
482 case {'w','e'} |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
483 xb = lg.x{2}; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
484 case {'s','n'} |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
485 xb = lg.x{1}; |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
486 end |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
487 end |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
488 |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
489 function hb = getBoundaryGridSpacing(obj, boundary) |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
490 h = obj.grid.scaling(); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
491 switch boundary |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
492 case {'w','e'} |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
493 hb = h(2); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
494 case {'s','n'} |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
495 hb = h(1); |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
496 end |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
497 end |
d1dad4fbfe22
Add support for glue interpolation operators, and separate wave speeds across interfaces
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1051
diff
changeset
|
498 |
0 | 499 function N = size(obj) |
500 N = prod(obj.m); | |
501 end | |
502 end | |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
503 end |