Mercurial > repos > public > sbplib
annotate +scheme/Wave2d.m @ 1198:2924b3a9b921 feature/d2_compatible
Add OpSet for fully compatible D2Variable, created from regular D2Variable by replacing d1 by first row of D1. Formal reduction by one order of accuracy at the boundary point.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 16 Aug 2019 14:30:28 -0700 |
parents | 5afc774fb7c4 |
children |
rev | line source |
---|---|
55
a8ed986fcf57
Minor renaming and clean up in 2d wave schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
1 classdef Wave2d < scheme.Scheme |
0 | 2 properties |
3 m % Number of points in each direction, possibly a vector | |
4 h % Grid spacing | |
5 x,y % Grid | |
6 X,Y % Values of x and y for each grid point | |
7 order % Order accuracy for the approximation | |
8 | |
9 D % non-stabalized scheme operator | |
10 M % Derivative norm | |
11 alpha | |
12 | |
13 H % Discrete norm | |
14 Hi | |
15 H_x, H_y % Norms in the x and y directions | |
16 Hx,Hy % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir. | |
17 Hi_x, Hi_y | |
18 Hix, Hiy | |
19 e_w, e_e, e_s, e_n | |
20 d1_w, d1_e, d1_s, d1_n | |
21 gamm_x, gamm_y | |
22 end | |
23 | |
24 methods | |
55
a8ed986fcf57
Minor renaming and clean up in 2d wave schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
25 function obj = Wave2d(m,lim,order,alpha) |
a8ed986fcf57
Minor renaming and clean up in 2d wave schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
26 default_arg('alpha',1); |
a8ed986fcf57
Minor renaming and clean up in 2d wave schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
27 |
a8ed986fcf57
Minor renaming and clean up in 2d wave schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
28 xlim = lim{1}; |
a8ed986fcf57
Minor renaming and clean up in 2d wave schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
29 ylim = lim{2}; |
0 | 30 |
31 if length(m) == 1 | |
32 m = [m m]; | |
33 end | |
34 | |
35 m_x = m(1); | |
36 m_y = m(2); | |
37 | |
38 [x, h_x] = util.get_grid(xlim{:},m_x); | |
39 [y, h_y] = util.get_grid(ylim{:},m_y); | |
40 | |
41 ops_x = sbp.Ordinary(m_x,h_x,order); | |
42 ops_y = sbp.Ordinary(m_y,h_y,order); | |
43 | |
44 I_x = speye(m_x); | |
45 I_y = speye(m_y); | |
46 | |
47 D2_x = sparse(ops_x.derivatives.D2); | |
48 H_x = sparse(ops_x.norms.H); | |
49 Hi_x = sparse(ops_x.norms.HI); | |
50 M_x = sparse(ops_x.norms.M); | |
51 e_l_x = sparse(ops_x.boundary.e_1); | |
52 e_r_x = sparse(ops_x.boundary.e_m); | |
53 d1_l_x = sparse(ops_x.boundary.S_1); | |
54 d1_r_x = sparse(ops_x.boundary.S_m); | |
55 | |
56 D2_y = sparse(ops_y.derivatives.D2); | |
57 H_y = sparse(ops_y.norms.H); | |
58 Hi_y = sparse(ops_y.norms.HI); | |
59 M_y = sparse(ops_y.norms.M); | |
60 e_l_y = sparse(ops_y.boundary.e_1); | |
61 e_r_y = sparse(ops_y.boundary.e_m); | |
62 d1_l_y = sparse(ops_y.boundary.S_1); | |
63 d1_r_y = sparse(ops_y.boundary.S_m); | |
64 | |
65 D2 = kr(D2_x, I_y) + kr(I_x, D2_y); | |
66 obj.H = kr(H_x,H_y); | |
67 obj.Hx = kr(H_x,I_y); | |
68 obj.Hy = kr(I_x,H_y); | |
69 obj.Hix = kr(Hi_x,I_y); | |
70 obj.Hiy = kr(I_x,Hi_y); | |
71 obj.Hi = kr(Hi_x,Hi_y); | |
72 obj.M = kr(M_x,H_y)+kr(H_x,M_y); | |
73 obj.e_w = kr(e_l_x,I_y); | |
74 obj.e_e = kr(e_r_x,I_y); | |
75 obj.e_s = kr(I_x,e_l_y); | |
76 obj.e_n = kr(I_x,e_r_y); | |
77 obj.d1_w = kr(d1_l_x,I_y); | |
78 obj.d1_e = kr(d1_r_x,I_y); | |
79 obj.d1_s = kr(I_x,d1_l_y); | |
80 obj.d1_n = kr(I_x,d1_r_y); | |
81 | |
82 obj.m = m; | |
83 obj.h = [h_x h_y]; | |
84 obj.order = order; | |
85 | |
86 obj.alpha = alpha; | |
87 obj.D = alpha*D2; | |
88 obj.x = x; | |
89 obj.y = y; | |
90 obj.X = kr(x,ones(m_y,1)); | |
91 obj.Y = kr(ones(m_x,1),y); | |
92 | |
93 obj.gamm_x = h_x*ops_x.borrowing.M.S; | |
94 obj.gamm_y = h_y*ops_y.borrowing.M.S; | |
95 end | |
96 | |
97 | |
98 % Closure functions return the opertors applied to the own doamin to close the boundary | |
99 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. | |
100 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. | |
101 % type is a string specifying the type of boundary condition if there are several. | |
102 % data is a function returning the data that should be applied at the boundary. | |
103 % neighbour_scheme is an instance of Scheme that should be interfaced to. | |
104 % neighbour_boundary is a string specifying which boundary to interface to. | |
105 function [closure, penalty] = boundary_condition(obj,boundary,type,data) | |
106 default_arg('type','neumann'); | |
107 default_arg('data',0); | |
108 | |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
109 [e, d] = obj.getBoundaryOperator({'e', 'd'}, boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
110 gamm = obj.getBoundaryBorrowing(boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
111 s = obj.getBoundarySign(boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
112 halfnorm_inv = obj.getHalfnormInv(boundary); |
0 | 113 |
114 switch type | |
115 % Dirichlet boundary condition | |
116 case {'D','d','dirichlet'} | |
117 alpha = obj.alpha; | |
118 | |
119 % tau1 < -alpha^2/gamma | |
120 tuning = 1.1; | |
121 tau1 = -tuning*alpha/gamm; | |
122 tau2 = s*alpha; | |
123 | |
124 p = tau1*e + tau2*d; | |
125 | |
126 closure = halfnorm_inv*p*e'; | |
127 | |
128 pp = halfnorm_inv*p; | |
129 switch class(data) | |
130 case 'double' | |
131 penalty = pp*data; | |
132 case 'function_handle' | |
133 penalty = @(t)pp*data(t); | |
134 otherwise | |
135 error('Wierd data argument!') | |
136 end | |
137 | |
138 | |
139 % Neumann boundary condition | |
140 case {'N','n','neumann'} | |
141 alpha = obj.alpha; | |
142 tau1 = -s*alpha; | |
143 tau2 = 0; | |
144 tau = tau1*e + tau2*d; | |
145 | |
146 closure = halfnorm_inv*tau*d'; | |
147 | |
148 pp = halfnorm_inv*tau; | |
149 switch class(data) | |
150 case 'double' | |
151 penalty = pp*data; | |
152 case 'function_handle' | |
153 penalty = @(t)pp*data(t); | |
154 otherwise | |
155 error('Wierd data argument!') | |
156 end | |
157 | |
158 % Unknown, boundary condition | |
159 otherwise | |
160 error('No such boundary condition: type = %s',type); | |
161 end | |
162 end | |
163 | |
946
706d1c2b4199
Raname opts to type in a bunch of interface methods
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
164 function [closure, penalty] = interface(obj, boundary, neighbour_scheme, neighbour_boundary, type) |
0 | 165 % u denotes the solution in the own domain |
166 % v denotes the solution in the neighbour domain | |
167 [e_u,d_u,s_u,gamm_u, halfnorm_inv] = obj.get_boundary_ops(boundary); | |
168 [e_v,d_v,s_v,gamm_v] = neighbour_scheme.get_boundary_ops(neighbour_boundary); | |
169 | |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
170 [e_u, d_u] = obj.getBoundaryOperator({'e', 'd'}, boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
171 gamm_u = obj.getBoundaryBorrowing(boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
172 s_u = obj.getBoundarySign(boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
173 halfnorm_inv = obj.getHalfnormInv(boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
174 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
175 [e_v, d_v] = neighbour_scheme.getBoundaryOperator({'e', 'd'}, neighbour_boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
176 gamm_v = neighbour_scheme.getBoundaryBorrowing(neighbour_boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
177 s_v = neighbour_scheme.getBoundarySign(neighbour_boundary); |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
178 |
0 | 179 tuning = 1.1; |
180 | |
181 alpha_u = obj.alpha; | |
182 alpha_v = neighbour_scheme.alpha; | |
183 | |
184 % tau1 < -(alpha_u/gamm_u + alpha_v/gamm_v) | |
185 | |
186 tau1 = -(alpha_u/gamm_u + alpha_v/gamm_v) * tuning; | |
187 tau2 = s_u*1/2*alpha_u; | |
188 sig1 = s_u*(-1/2); | |
189 sig2 = 0; | |
190 | |
191 tau = tau1*e_u + tau2*d_u; | |
192 sig = sig1*e_u + sig2*d_u; | |
193 | |
194 closure = halfnorm_inv*( tau*e_u' + sig*alpha_u*d_u'); | |
195 penalty = halfnorm_inv*(-tau*e_v' - sig*alpha_v*d_v'); | |
196 end | |
197 | |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
198 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
199 % Returns the boundary operator op for the boundary specified by the string boundary. |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
200 % op -- string or a cell array of strings |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
201 % boundary -- string |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
202 function varargout = getBoundaryOperator(obj, op, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
203 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
204 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
205 if ~iscell(op) |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
206 op = {op}; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
207 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
208 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
209 for i = 1:numel(op) |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
210 switch op{i} |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
211 case 'e' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
212 switch boundary |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
213 case 'w' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
214 e = obj.e_w; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
215 case 'e' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
216 e = obj.e_e; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
217 case 's' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
218 e = obj.e_s; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
219 case 'n' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
220 e = obj.e_n; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
221 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
222 varargout{i} = e; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
223 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
224 case 'd' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
225 switch boundary |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
226 case 'w' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
227 d = obj.d1_w; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
228 case 'e' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
229 d = obj.d1_e; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
230 case 's' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
231 d = obj.d1_s; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
232 case 'n' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
233 d = obj.d1_n; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
234 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
235 varargout{i} = d; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
236 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
237 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
238 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
239 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
240 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
241 % Returns square boundary quadrature matrix, of dimension |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
242 % corresponding to the number of boundary points |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
243 % |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
244 % boundary -- string |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
245 function H_b = getBoundaryQuadrature(obj, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
246 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
247 |
0 | 248 switch boundary |
249 case 'w' | |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
250 H_b = obj.H_y; |
0 | 251 case 'e' |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
252 H_b = obj.H_y; |
0 | 253 case 's' |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
254 H_b = obj.H_x; |
0 | 255 case 'n' |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
256 H_b = obj.H_x; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
257 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
258 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
259 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
260 % Returns borrowing constant gamma |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
261 % boundary -- string |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
262 function gamm = getBoundaryBorrowing(obj, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
263 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
264 |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
265 switch boundary |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
266 case {'w','e'} |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
267 gamm = obj.gamm_x; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
268 case {'s','n'} |
0 | 269 gamm = obj.gamm_y; |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
270 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
271 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
272 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
273 % Returns the boundary sign. The right boundary is considered the positive boundary |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
274 % boundary -- string |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
275 function s = getBoundarySign(obj, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
276 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
277 |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
278 switch boundary |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
279 case {'e','n'} |
0 | 280 s = 1; |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
281 case {'w','s'} |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
282 s = -1; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
283 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
284 end |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
285 |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
286 % Returns the halfnorm_inv used in SATs. TODO: better notation |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
287 function Hinv = getHalfnormInv(obj, boundary) |
1042
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
288 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8d73fcdb07a5
Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents:
997
diff
changeset
|
289 |
997
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
290 switch boundary |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
291 case 'w' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
292 Hinv = obj.Hix; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
293 case 'e' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
294 Hinv = obj.Hix; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
295 case 's' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
296 Hinv = obj.Hiy; |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
297 case 'n' |
78db023a7fe3
Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
298 Hinv = obj.Hiy; |
0 | 299 end |
300 end | |
301 | |
302 function N = size(obj) | |
303 N = prod(obj.m); | |
304 end | |
305 | |
306 end | |
1043
c12b84fe9b00
Remove static method `interface_coupling` that shouldn't have existed in the first place
Jonatan Werpers <jonatan@werpers.com>
parents:
946
diff
changeset
|
307 end |