comparison +scheme/Utux2d.m @ 1108:5ec23b9bf360 feature/laplace_curvilinear_test

Merge with default
author Martin Almquist <malmquist@stanford.edu>
date Wed, 10 Apr 2019 11:00:27 -0700
parents 84200bbae101
children 433c89bf19e0
comparison
equal deleted inserted replaced
1087:867307f4d80f 1108:5ec23b9bf360
10 % Can either be a constant vector or a cell array of function handles. 10 % Can either be a constant vector or a cell array of function handles.
11 11
12 H % Discrete norm 12 H % Discrete norm
13 H_x, H_y % Norms in the x and y directions 13 H_x, H_y % Norms in the x and y directions
14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms 14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms
15 H_w, H_e, H_s, H_n % Boundary quadratures
15 16
16 % Derivatives 17 % Derivatives
17 Dx, Dy 18 Dx, Dy
18 19
19 % Boundary operators 20 % Boundary operators
57 Hx = ops_x.H; 58 Hx = ops_x.H;
58 Hy = ops_y.H; 59 Hy = ops_y.H;
59 Hxi = ops_x.HI; 60 Hxi = ops_x.HI;
60 Hyi = ops_y.HI; 61 Hyi = ops_y.HI;
61 62
63 obj.H_w = Hy;
64 obj.H_e = Hy;
65 obj.H_s = Hx;
66 obj.H_n = Hx;
62 obj.H_x = Hx; 67 obj.H_x = Hx;
63 obj.H_y = Hy; 68 obj.H_y = Hy;
64 obj.H = kron(Hx,Hy); 69 obj.H = kron(Hx,Hy);
65 obj.Hi = kron(Hxi,Hyi); 70 obj.Hi = kron(Hxi,Hyi);
66 obj.Hx = kron(Hx,Iy); 71 obj.Hx = kron(Hx,Iy);
270 end 275 end
271 276
272 277
273 end 278 end
274 279
275 % Returns the boundary operator op for the boundary specified by the string boundary. 280 % Returns the boundary operator op for the boundary specified by the string boundary.
276 % op -- string or a cell array of strings 281 % op -- string
277 % boundary -- string 282 % boundary -- string
278 function varargout = getBoundaryOperator(obj, op, boundary) 283 function o = getBoundaryOperator(obj, op, boundary)
279 284 assertIsMember(op, {'e'})
280 if ~iscell(op) 285 assertIsMember(boundary, {'w', 'e', 's', 'n'})
281 op = {op}; 286
282 end 287 o = obj.([op, '_', boundary]);
283
284 for i = 1:numel(op)
285 switch op{i}
286 case 'e'
287 switch boundary
288 case 'w'
289 e = obj.e_w;
290 case 'e'
291 e = obj.e_e;
292 case 's'
293 e = obj.e_s;
294 case 'n'
295 e = obj.e_n;
296 otherwise
297 error('No such boundary: boundary = %s',boundary);
298 end
299 varargout{i} = e;
300 end
301 end
302
303 end 288 end
304 289
305 % Returns square boundary quadrature matrix, of dimension 290 % Returns square boundary quadrature matrix, of dimension
306 % corresponding to the number of boundary points 291 % corresponding to the number of boundary points
307 % 292 %
308 % boundary -- string 293 % boundary -- string
309 function H_b = getBoundaryQuadrature(obj, boundary) 294 function H_b = getBoundaryQuadrature(obj, boundary)
310 295 assertIsMember(boundary, {'w', 'e', 's', 'n'})
311 switch boundary 296
312 case 'w' 297 H_b = obj.(['H_', boundary]);
313 H_b = obj.H_y;
314 case 'e'
315 H_b = obj.H_y;
316 case 's'
317 H_b = obj.H_x;
318 case 'n'
319 H_b = obj.H_x;
320 otherwise
321 error('No such boundary: boundary = %s',boundary);
322 end
323 end 298 end
324 299
325 function N = size(obj) 300 function N = size(obj)
326 N = obj.m; 301 N = obj.m;
327 end 302 end
328 303
329 end 304 end
330
331 methods(Static)
332 % Calculates the matrices needed for the inteface coupling between boundary bound_u of scheme schm_u
333 % and bound_v of scheme schm_v.
334 % [uu, uv, vv, vu] = inteface_coupling(A,'r',B,'l')
335 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v)
336 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v);
337 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u);
338 end
339 end
340 end 305 end