Mercurial > repos > public > sbplib
annotate +scheme/LaplaceCurvilinear.m @ 1086:90c23fd08f59 feature/laplace_curvilinear_test
Make LaplaceCurvilinearNew the default version and remove the others
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 29 Mar 2019 14:41:36 -0700 |
parents | 1341c6cea9c1 |
children | 867307f4d80f |
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 | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
5 dim % Number of spatial dimensions |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
6 |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
7 grid |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
8 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
9 order % Order of accuracy for the approximation |
0 | 10 |
552
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
11 a,b % Parameters of the operator |
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 |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
14 % Inner products and operators for physical coordinates |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
15 D % Laplace operator |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
16 H, Hi % Inner product |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
17 e_w, e_e, e_s, e_n |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
18 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
|
19 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
|
20 Dx, Dy % Physical derivatives |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
21 M % Gradient inner product |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
22 |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
23 % Metric coefficients |
0 | 24 J, Ji |
25 a11, a12, a22 | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
26 K |
552
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
27 x_u |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
28 x_v |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
29 y_u |
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
30 y_v |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
31 s_w, s_e, s_s, s_n % Boundary integral scale factors |
0 | 32 |
552
ffaf13533c27
Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents:
551
diff
changeset
|
33 % Inner product and operators for logical coordinates |
0 | 34 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
|
35 Hi_u, Hi_v |
0 | 36 Hu,Hv % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir. |
37 Hiu, Hiv | |
38 du_w, dv_w | |
39 du_e, dv_e | |
40 du_s, dv_s | |
41 du_n, dv_n | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
42 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
43 % Borrowing constants |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
44 theta_M_u, theta_M_v |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
45 theta_R_u, theta_R_v |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
46 theta_H_u, theta_H_v |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
47 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
48 % Temporary |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
49 lambda |
0 | 50 gamm_u, gamm_v |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
51 |
0 | 52 end |
53 | |
54 methods | |
452
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
55 % Implements a*div(b*grad(u)) as a SBP scheme |
539 | 56 % TODO: Implement proper H, it should be the real physical quadrature, the logic quadrature may be but in a separate variable (H_logic?) |
57 | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
58 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
|
59 default_arg('opSet',@sbp.D2Variable); |
452
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
60 default_arg('a', 1); |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
61 default_arg('b', @(x,y) 0*x + 1); |
0 | 62 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
63 % assert(isa(g, 'grid.Curvilinear')) |
743
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
64 if isa(a, 'function_handle') |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
65 a = grid.evalOn(g, a); |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
66 a = spdiag(a); |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
720
diff
changeset
|
67 end |
0 | 68 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
69 if isa(b, 'function_handle') |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
70 b = grid.evalOn(g, b); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
71 b = spdiag(b); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
72 end |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
73 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
74 % If b is scalar |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
75 if length(b) == 1 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
76 b = b*speye(g.N(), g.N()); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
77 end |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
78 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
79 dim = 2; |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
80 m = g.size(); |
0 | 81 m_u = m(1); |
82 m_v = m(2); | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
83 m_tot = g.N(); |
0 | 84 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
85 h = g.scaling(); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
86 h_u = h(1); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
87 h_v = h(2); |
0 | 88 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
89 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
90 % 1D operators |
303
f18142c1530b
Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents:
96
diff
changeset
|
91 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
|
92 ops_v = opSet(m_v, {0, 1}, order); |
0 | 93 |
94 I_u = speye(m_u); | |
95 I_v = speye(m_v); | |
96 | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
97 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
|
98 D2_u = ops_u.D2; |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
99 H_u = ops_u.H; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
100 Hi_u = ops_u.HI; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
101 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
|
102 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
|
103 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
|
104 d1_r_u = ops_u.d1_r; |
0 | 105 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
106 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
|
107 D2_v = ops_v.D2; |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
108 H_v = ops_v.H; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
109 Hi_v = ops_v.HI; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 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
|
114 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
115 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
116 % Logical operators |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
117 Du = kr(D1_u,I_v); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
118 Dv = kr(I_u,D1_v); |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
119 obj.Hu = kr(H_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
120 obj.Hv = kr(I_u,H_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
121 obj.Hiu = kr(Hi_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
122 obj.Hiv = kr(I_u,Hi_v); |
0 | 123 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
124 e_w = kr(e_l_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
125 e_e = kr(e_r_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
126 e_s = kr(I_u,e_l_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
127 e_n = kr(I_u,e_r_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
128 obj.du_w = kr(d1_l_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
129 obj.dv_w = (e_w'*Dv)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
130 obj.du_e = kr(d1_r_u,I_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
131 obj.dv_e = (e_e'*Dv)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
132 obj.du_s = (e_s'*Du)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
133 obj.dv_s = kr(I_u,d1_l_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
134 obj.du_n = (e_n'*Du)'; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
135 obj.dv_n = kr(I_u,d1_r_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
136 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
137 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
138 % Metric coefficients |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
139 coords = g.points(); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
140 x = coords(:,1); |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
141 y = coords(:,2); |
0 | 142 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
143 x_u = Du*x; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
144 x_v = Dv*x; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
145 y_u = Du*y; |
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
146 y_v = Dv*y; |
0 | 147 |
148 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
|
149 a11 = 1./J .* (x_v.^2 + y_v.^2); |
0 | 150 a12 = -1./J .* (x_u.*x_v + y_u.*y_v); |
151 a22 = 1./J .* (x_u.^2 + y_u.^2); | |
152 lambda = 1/2 * (a11 + a22 - sqrt((a11-a22).^2 + 4*a12.^2)); | |
153 | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
154 K = cell(dim, dim); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
155 K{1,1} = spdiag(y_v./J); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
156 K{1,2} = spdiag(-y_u./J); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
157 K{2,1} = spdiag(-x_v./J); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
158 K{2,2} = spdiag(x_u./J); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
159 obj.K = K; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
160 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
161 obj.x_u = x_u; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
162 obj.x_v = x_v; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
163 obj.y_u = y_u; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
164 obj.y_v = y_v; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
165 |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
166 % Assemble full operators |
551
c5a7a13c03dc
Switch to using spdiag instead of spdiags
Jonatan Werpers <jonatan@werpers.com>
parents:
539
diff
changeset
|
167 L_12 = spdiag(a12); |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
168 Duv = Du*b*L_12*Dv; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
169 Dvu = Dv*b*L_12*Du; |
0 | 170 |
171 Duu = sparse(m_tot); | |
172 Dvv = sparse(m_tot); | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
173 ind = grid.funcToMatrix(g, 1:m_tot); |
0 | 174 |
175 for i = 1:m_v | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
176 b_a11 = b*a11; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
177 D = D2_u(b_a11(ind(:,i))); |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
178 p = ind(:,i); |
0 | 179 Duu(p,p) = D; |
180 end | |
181 | |
182 for i = 1:m_u | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
183 b_a22 = b*a22; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
184 D = D2_v(b_a22(ind(i,:))); |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
185 p = ind(i,:); |
0 | 186 Dvv(p,p) = D; |
187 end | |
188 | |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
189 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
190 % Physical operators |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
191 obj.J = spdiag(J); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
192 obj.Ji = spdiag(1./J); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
193 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
194 obj.D = obj.Ji*a*(Duu + Duv + Dvu + Dvv); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
195 obj.H = obj.J*kr(H_u,H_v); |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
196 obj.Hi = obj.Ji*kr(Hi_u,Hi_v); |
0 | 197 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
198 obj.e_w = e_w; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
199 obj.e_e = e_e; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
200 obj.e_s = e_s; |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
201 obj.e_n = e_n; |
376 | 202 |
557
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
203 %% normal derivatives |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
204 I_w = ind(1,:); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
205 I_e = ind(end,:); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
206 I_s = ind(:,1); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
207 I_n = ind(:,end); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
208 |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
209 a11_w = spdiag(a11(I_w)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
210 a12_w = spdiag(a12(I_w)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
211 a11_e = spdiag(a11(I_e)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
212 a12_e = spdiag(a12(I_e)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
213 a22_s = spdiag(a22(I_s)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
214 a12_s = spdiag(a12(I_s)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
215 a22_n = spdiag(a22(I_n)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
216 a12_n = spdiag(a12(I_n)); |
2a856a589510
Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents:
554
diff
changeset
|
217 |
565 | 218 s_w = sqrt((e_w'*x_v).^2 + (e_w'*y_v).^2); |
219 s_e = sqrt((e_e'*x_v).^2 + (e_e'*y_v).^2); | |
220 s_s = sqrt((e_s'*x_u).^2 + (e_s'*y_u).^2); | |
221 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
|
222 |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 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
|
227 |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
228 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
|
229 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
|
230 |
562
11d8d6ccbcd7
Add boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
561
diff
changeset
|
231 %% Boundary inner products |
564
9bf49338f8e6
Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents:
563
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 obj.H_n = H_u*spdiag(s_n); |
553
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
236 |
63d5c07943dd
Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents:
552
diff
changeset
|
237 % Misc. |
0 | 238 obj.m = m; |
239 obj.h = [h_u h_v]; | |
240 obj.order = order; | |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
241 obj.grid = g; |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
242 obj.dim = dim; |
0 | 243 |
452
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
244 obj.a = a; |
56eb7c088bd4
Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents:
450
diff
changeset
|
245 obj.b = b; |
0 | 246 obj.a11 = a11; |
247 obj.a12 = a12; | |
248 obj.a22 = a22; | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
249 obj.s_w = spdiag(s_w); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
250 obj.s_e = spdiag(s_e); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
251 obj.s_s = spdiag(s_s); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
252 obj.s_n = spdiag(s_n); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
253 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
254 obj.theta_M_u = h_u*ops_u.borrowing.M.d1; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
255 obj.theta_M_v = h_v*ops_v.borrowing.M.d1; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
256 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
257 obj.theta_R_u = h_u*ops_u.borrowing.R.delta_D; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
258 obj.theta_R_v = h_v*ops_v.borrowing.R.delta_D; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
259 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
260 obj.theta_H_u = h_u*ops_u.borrowing.H11; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
261 obj.theta_H_v = h_v*ops_v.borrowing.H11; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
262 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
263 % Temporary |
27
97a638f91fb8
Added function spdiag(). Fixed a bunch of bugs in the Wave2dCurve scheme.
Jonatan Werpers <jonatan@werpers.com>
parents:
5
diff
changeset
|
264 obj.lambda = lambda; |
389
42c89b5eedc0
Add borrowing constants for D2 operators in D4Variable
Jonatan Werpers <jonatan@werpers.com>
parents:
384
diff
changeset
|
265 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
|
266 obj.gamm_v = h_v*ops_v.borrowing.M.d1; |
0 | 267 end |
268 | |
269 | |
270 % Closure functions return the opertors applied to the own doamin to close the boundary | |
271 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. | |
272 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. | |
273 % type is a string specifying the type of boundary condition if there are several. | |
274 % data is a function returning the data that should be applied at the boundary. | |
275 % neighbour_scheme is an instance of Scheme that should be interfaced to. | |
276 % 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
|
277 function [closure, penalty] = boundary_condition(obj, boundary, type, parameter) |
0 | 278 default_arg('type','neumann'); |
347
85c2fe06d551
Implemented characteristic form BC in Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
337
diff
changeset
|
279 default_arg('parameter', []); |
0 | 280 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
281 e = obj.getBoundaryOperator('e', boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
282 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
|
283 H_b = obj.getBoundaryQuadrature(boundary); |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
284 s_b = obj.getBoundaryScaling(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
285 [th_H, ~, th_R] = obj.getBoundaryBorrowing(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
286 m = obj.getBoundaryNumber(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
287 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
288 K = obj.K; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
289 J = obj.J; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
290 Hi = obj.Hi; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
291 a = obj.a; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
292 b_b = e'*obj.b*e; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
293 |
0 | 294 switch type |
295 % Dirichlet boundary condition | |
296 case {'D','d','dirichlet'} | |
1064
1341c6cea9c1
Set tuning to 1.0 in both old and new Dirichlet.
Martin Almquist <malmquist@stanford.edu>
parents:
997
diff
changeset
|
297 tuning = 1.0; |
82
df642750e8f7
Added Dirichelt BC to Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents:
55
diff
changeset
|
298 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
299 sigma = 0*b_b; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
300 for i = 1:obj.dim |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
301 sigma = sigma + e'*J*K{i,m}*K{i,m}*e; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
302 end |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
303 sigma = sigma/s_b; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
304 tau = tuning*(1/th_R + obj.dim/th_H)*sigma; |
0 | 305 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
306 closure = a*Hi*d*b_b*H_b*e' ... |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
307 -a*Hi*e*tau*b_b*H_b*e'; |
0 | 308 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
309 penalty = -a*Hi*d*b_b*H_b ... |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
310 +a*Hi*e*tau*b_b*H_b; |
0 | 311 |
312 | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
313 % Neumann boundary condition. Note that the penalty is for du/dn and not b*du/dn. |
0 | 314 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
|
315 tau1 = -1; |
0 | 316 tau2 = 0; |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
317 tau = (tau1*e + tau2*d)*H_b; |
0 | 318 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
319 closure = a*Hi*tau*b_b*d'; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
320 penalty = -a*Hi*tau*b_b; |
0 | 321 |
322 | |
323 % Unknown, boundary condition | |
324 otherwise | |
325 error('No such boundary condition: type = %s',type); | |
326 end | |
327 end | |
328 | |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
329 % type Struct that specifies the interface coupling. |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
330 % Fields: |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
331 % -- tuning: penalty strength, defaults to 1.2 |
935
1bf200417957
Fix doc for LaplaceCurvilinear.interface
Jonatan Werpers <jonatan@werpers.com>
parents:
928
diff
changeset
|
332 % -- interpolation: type of interpolation, default 'none' |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
333 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
|
334 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
335 % error('Not implemented') |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
336 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
337 defaultType.tuning = 1.0; |
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
|
338 defaultType.interpolation = 'none'; |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
339 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
|
340 |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
341 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
|
342 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
|
343 [closure, penalty] = interfaceStandard(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
|
344 case {'op','OP'} |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
345 [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
|
346 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
|
347 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
|
348 end |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
349 end |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
350 |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
351 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
|
352 tuning = type.tuning; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
353 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
354 dim = obj.dim; |
906
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
355 % u denotes the solution in the own domain |
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
356 % v denotes the solution in the neighbour domain |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
357 u = obj; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
358 v = neighbour_scheme; |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
359 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
360 % Boundary operators, u |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
361 e_u = u.getBoundaryOperator('e', boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
362 d_u = u.getBoundaryOperator('d', boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
363 gamm_u = u.getBoundaryBorrowing(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
364 s_b_u = u.getBoundaryScaling(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
365 [th_H_u, ~, th_R_u] = u.getBoundaryBorrowing(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
366 m_u = u.getBoundaryNumber(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
367 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
368 % Coefficients, u |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
369 K_u = u.K; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
370 J_u = u.J; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
371 b_b_u = e_u'*u.b*e_u; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
372 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
373 % Boundary operators, v |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
374 e_v = v.getBoundaryOperator('e', neighbour_boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
375 d_v = v.getBoundaryOperator('d', neighbour_boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
376 gamm_v = v.getBoundaryBorrowing(neighbour_boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
377 s_b_v = v.getBoundaryScaling(neighbour_boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
378 [th_H_v, ~, th_R_v] = v.getBoundaryBorrowing(neighbour_boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
379 m_v = v.getBoundaryNumber(neighbour_boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
380 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
381 % Coefficients, v |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
382 K_v = v.K; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
383 J_v = v.J; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
384 b_b_v = e_v'*v.b*e_v; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
385 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
386 %--- Penalty strength tau ------------- |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
387 sigma_u = 0*b_b_u; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
388 sigma_v = 0*b_b_v; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
389 for i = 1:obj.dim |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
390 sigma_u = sigma_u + e_u'*J_u*K_u{i,m_u}*K_u{i,m_u}*e_u; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
391 sigma_v = sigma_v + e_v'*J_v*K_v{i,m_v}*K_v{i,m_v}*e_v; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
392 end |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
393 sigma_u = sigma_u/s_b_u; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
394 sigma_v = sigma_v/s_b_v; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
395 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
396 tau_R_u = 1/th_R_u*sigma_u; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
397 tau_R_v = 1/th_R_v*sigma_v; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
398 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
399 tau_H_u = dim*1/th_H_u*sigma_u; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
400 tau_H_v = dim*1/th_H_v*sigma_v; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
401 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
402 tau = 1/4*tuning*(b_b_u*(tau_R_u + tau_H_u) + b_b_v*(tau_R_v + tau_H_v)); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
403 %-------------------------------------- |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
404 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
405 % Operators/coefficients that are only required from this side |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
406 Hi = u.Hi; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
407 H_b = u.getBoundaryQuadrature(boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
408 a = u.a; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
409 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
410 closure = 1/2*a*Hi*d_u*b_b_u*H_b*e_u' ... |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
411 -1/2*a*Hi*e_u*H_b*b_b_u*d_u' ... |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
412 -a*Hi*e_u*tau*H_b*e_u'; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
413 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
414 penalty = -1/2*a*Hi*d_u*b_b_u*H_b*e_v' ... |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
415 -1/2*a*Hi*e_u*H_b*b_b_v*d_v' ... |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
416 +a*Hi*e_u*tau*H_b*e_v'; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
417 end |
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
418 |
928
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
419 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
|
420 |
921
19c05eefc8c6
Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents:
910
diff
changeset
|
421 % 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
|
422 warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.'); |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
423 warning('LaplaceCurvilinear: Non-conforming interface uses Virtas penalty strength'); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
424 warning('LaplaceCurvilinear: Non-conforming interface assumes that b is constant'); |
921
19c05eefc8c6
Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents:
910
diff
changeset
|
425 |
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
|
426 % 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
|
427 default_field(type, 'interpOpSet', @sbp.InterpOpsOP); |
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
428 interpOpSet = type.interpOpSet; |
1c61d8fa9903
Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents:
927
diff
changeset
|
429 tuning = type.tuning; |
904
14b093a344eb
Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
430 |
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
|
431 |
906
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
432 % u denotes the solution in the own domain |
0499239496cf
Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents:
904
diff
changeset
|
433 % v denotes the solution in the neighbour domain |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
434 e_u = obj.getBoundaryOperator('e', boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
435 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
|
436 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
|
437 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
|
438 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
|
439 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
440 e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 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
|
445 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
446 |
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
|
447 % 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
|
448 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
|
449 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
|
450 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
451 Hi = obj.Hi; |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
452 a = obj.a; |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
453 |
5
5f6b0b6a012b
First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
454 u = obj; |
5f6b0b6a012b
First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
455 v = neighbour_scheme; |
5f6b0b6a012b
First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
456 |
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
|
457 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
|
458 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
|
459 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
|
460 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
|
461 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
462 tau_u = -1./(4*b1_u) -1./(4*b2_u); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
463 tau_v = -1./(4*b1_v) -1./(4*b2_v); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
464 |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
465 tau_u = tuning * spdiag(tau_u); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
466 tau_v = tuning * spdiag(tau_v); |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
467 beta_u = tau_v; |
0 | 468 |
922
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
469 % Build interpolation operators |
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
|
470 intOps = interpOpSet(m_u, m_v, obj.order, neighbour_scheme.order); |
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
|
471 Iu2v = intOps.Iu2v; |
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
|
472 Iv2u = intOps.Iv2u; |
922
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
473 |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
474 closure = a*Hi*e_u*tau_u*H_b_u*e_u' + ... |
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
|
475 a*Hi*e_u*H_b_u*Iv2u.bad*beta_u*Iu2v.good*e_u' + ... |
720
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
476 a*1/2*Hi*d_u*H_b_u*e_u' + ... |
07f8311374c6
Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents:
567
diff
changeset
|
477 -a*1/2*Hi*e_u*H_b_u*d_u'; |
0 | 478 |
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
|
479 penalty = -a*Hi*e_u*tau_u*H_b_u*Iv2u.good*e_v' + ... |
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
|
480 -a*Hi*e_u*H_b_u*Iv2u.bad*beta_u*e_v' + ... |
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
|
481 -a*1/2*Hi*d_u*H_b_u*Iv2u.good*e_v' + ... |
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
|
482 -a*1/2*Hi*e_u*H_b_u*Iv2u.bad*d_v'; |
0 | 483 |
484 end | |
485 | |
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
|
486 % Returns the boundary operator op for the boundary specified by the string boundary. |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
487 % 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
|
488 % boundary -- string |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
489 function o = getBoundaryOperator(obj, op, boundary) |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
490 assertIsMember(op, {'e', 'd'}) |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
491 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
|
492 |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
493 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
|
494 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
|
495 |
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
|
496 % 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
|
497 % 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
|
498 % |
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
|
499 % 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
|
500 function H_b = getBoundaryQuadrature(obj, boundary) |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
501 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
502 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
503 H_b = obj.(['H_', boundary]); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
504 end |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
505 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
506 % Returns square boundary quadrature scaling matrix, of dimension |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
507 % corresponding to the number of boundary points |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
508 % |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
509 % boundary -- string |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
510 function s_b = getBoundaryScaling(obj, boundary) |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
511 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
512 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
513 s_b = obj.(['s_', boundary]); |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
514 end |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
515 |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
516 % Returns the coordinate number corresponding to the boundary |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
517 % |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
518 % boundary -- string |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
519 function m = getBoundaryNumber(obj, boundary) |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
520 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
|
521 |
0 | 522 switch boundary |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
523 case {'w', 'e'} |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
524 m = 1; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
525 case {'s', 'n'} |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
526 m = 2; |
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
|
527 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
|
528 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
|
529 |
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
|
530 % 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
|
531 % 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
|
532 function I = getBoundaryIndices(obj, 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
|
533 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
|
534 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
|
535 case 'w' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
536 I = ind(1,:); |
0 | 537 case 'e' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
538 I = ind(end,:); |
0 | 539 case 's' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
540 I = ind(:,1)'; |
0 | 541 case 'n' |
337
e070ebd94d9d
Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents:
303
diff
changeset
|
542 I = ind(:,end)'; |
0 | 543 otherwise |
544 error('No such boundary: boundary = %s',boundary); | |
545 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
|
546 end |
0 | 547 |
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
|
548 % 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
|
549 % boundary -- string |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
550 function [theta_H, theta_M, theta_R] = getBoundaryBorrowing(obj, boundary) |
0 | 551 switch boundary |
552 case {'w','e'} | |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
553 theta_H = obj.theta_H_u; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
554 theta_M = obj.theta_M_u; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
555 theta_R = obj.theta_R_u; |
0 | 556 case {'s','n'} |
1086
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
557 theta_H = obj.theta_H_v; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
558 theta_M = obj.theta_M_v; |
90c23fd08f59
Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents:
1064
diff
changeset
|
559 theta_R = obj.theta_R_v; |
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
|
560 otherwise |
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
|
561 error('No such boundary: boundary = %s',boundary); |
0 | 562 end |
922
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
563 end |
1d91c2a8aada
Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents:
921
diff
changeset
|
564 |
0 | 565 function N = size(obj) |
566 N = prod(obj.m); | |
567 end | |
568 end | |
566
9c98a0526afc
Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents:
565
diff
changeset
|
569 end |