Mercurial > repos > public > sbplib
comparison +scheme/LaplaceCurvilinear.m @ 567:33b962620e24 feature/grids/laplace_refactor
Remove unneeded sign information from get_boundary_ops
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 01 Sep 2017 10:45:37 +0200 |
parents | 9c98a0526afc |
children | 07f8311374c6 |
comparison
equal
deleted
inserted
replaced
566:9c98a0526afc | 567:33b962620e24 |
---|---|
231 % neighbour_boundary is a string specifying which boundary to interface to. | 231 % neighbour_boundary is a string specifying which boundary to interface to. |
232 function [closure, penalty] = boundary_condition(obj, boundary, type, parameter) | 232 function [closure, penalty] = boundary_condition(obj, boundary, type, parameter) |
233 default_arg('type','neumann'); | 233 default_arg('type','neumann'); |
234 default_arg('parameter', []); | 234 default_arg('parameter', []); |
235 | 235 |
236 [e, d, s, gamm, H_b, ~] = obj.get_boundary_ops(boundary); | 236 [e, d, gamm, H_b, ~] = obj.get_boundary_ops(boundary); |
237 switch type | 237 switch type |
238 % Dirichlet boundary condition | 238 % Dirichlet boundary condition |
239 case {'D','d','dirichlet'} | 239 case {'D','d','dirichlet'} |
240 tuning = 1.2; | 240 tuning = 1.2; |
241 % tuning = 20.2; | 241 % tuning = 20.2; |
271 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) | 271 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) |
272 % u denotes the solution in the own domain | 272 % u denotes the solution in the own domain |
273 % v denotes the solution in the neighbour domain | 273 % v denotes the solution in the neighbour domain |
274 tuning = 1.2; | 274 tuning = 1.2; |
275 % tuning = 20.2; | 275 % tuning = 20.2; |
276 [e_u, d_u, s_u, gamm_u, H_b_u, I_u] = obj.get_boundary_ops(boundary); | 276 [e_u, d_u, gamm_u, H_b_u, I_u] = obj.get_boundary_ops(boundary); |
277 [e_v, d_v, s_v, gamm_v, H_b_v, I_v] = neighbour_scheme.get_boundary_ops(neighbour_boundary); | 277 [e_v, d_v, gamm_v, H_b_v, I_v] = neighbour_scheme.get_boundary_ops(neighbour_boundary); |
278 | 278 |
279 u = obj; | 279 u = obj; |
280 v = neighbour_scheme; | 280 v = neighbour_scheme; |
281 | 281 |
282 b1_u = gamm_u*u.lambda(I_u)./u.a11(I_u).^2; | 282 b1_u = gamm_u*u.lambda(I_u)./u.a11(I_u).^2; |
300 | 300 |
301 % Ruturns the boundary ops and sign for the boundary specified by the string boundary. | 301 % Ruturns the boundary ops and sign for the boundary specified by the string boundary. |
302 % The right boundary is considered the positive boundary | 302 % The right boundary is considered the positive boundary |
303 % | 303 % |
304 % I -- the indecies of the boundary points in the grid matrix | 304 % I -- the indecies of the boundary points in the grid matrix |
305 function [e, d, s, gamm, H_b, I] = get_boundary_ops(obj, boundary) | 305 function [e, d, gamm, H_b, I] = get_boundary_ops(obj, boundary) |
306 | 306 |
307 % gridMatrix = zeros(obj.m(2),obj.m(1)); | 307 % gridMatrix = zeros(obj.m(2),obj.m(1)); |
308 % gridMatrix(:) = 1:numel(gridMatrix); | 308 % gridMatrix(:) = 1:numel(gridMatrix); |
309 | 309 |
310 ind = grid.funcToMatrix(obj.grid, 1:prod(obj.m)); | 310 ind = grid.funcToMatrix(obj.grid, 1:prod(obj.m)); |
312 switch boundary | 312 switch boundary |
313 case 'w' | 313 case 'w' |
314 e = obj.e_w; | 314 e = obj.e_w; |
315 d = obj.d_w; | 315 d = obj.d_w; |
316 H_b = obj.H_w; | 316 H_b = obj.H_w; |
317 s = -1; | |
318 I = ind(1,:); | 317 I = ind(1,:); |
319 case 'e' | 318 case 'e' |
320 e = obj.e_e; | 319 e = obj.e_e; |
321 d = obj.d_e; | 320 d = obj.d_e; |
322 H_b = obj.H_e; | 321 H_b = obj.H_e; |
323 s = 1; | |
324 I = ind(end,:); | 322 I = ind(end,:); |
325 case 's' | 323 case 's' |
326 e = obj.e_s; | 324 e = obj.e_s; |
327 d = obj.d_s; | 325 d = obj.d_s; |
328 H_b = obj.H_s; | 326 H_b = obj.H_s; |
329 s = -1; | |
330 I = ind(:,1)'; | 327 I = ind(:,1)'; |
331 case 'n' | 328 case 'n' |
332 e = obj.e_n; | 329 e = obj.e_n; |
333 d = obj.d_n; | 330 d = obj.d_n; |
334 H_b = obj.H_n; | 331 H_b = obj.H_n; |
335 s = 1; | |
336 I = ind(:,end)'; | 332 I = ind(:,end)'; |
337 otherwise | 333 otherwise |
338 error('No such boundary: boundary = %s',boundary); | 334 error('No such boundary: boundary = %s',boundary); |
339 end | 335 end |
340 | 336 |