Mercurial > repos > public > sbplib
comparison +multiblock/DiffOp.m @ 903:703183ed8c8b feature/utux2D
Include interface type in multiblock.DiffOp, passed to all scheme.interface methods.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Thu, 22 Nov 2018 22:01:58 -0800 |
parents | c360bbecf260 |
children | c0652621bd69 |
comparison
equal
deleted
inserted
replaced
752:0be9b4d6737b | 903:703183ed8c8b |
---|---|
8 | 8 |
9 blockmatrixDiv | 9 blockmatrixDiv |
10 end | 10 end |
11 | 11 |
12 methods | 12 methods |
13 function obj = DiffOp(doHand, grid, order, doParam) | 13 function obj = DiffOp(doHand, grid, order, doParam, interfaceType) |
14 % doHand -- may either be a function handle or a cell array of | 14 % doHand -- may either be a function handle or a cell array of |
15 % function handles for each grid. The function handle(s) | 15 % function handles for each grid. The function handle(s) |
16 % should be on the form do = doHand(grid, order, ...) | 16 % should be on the form do = doHand(grid, order, ...) |
17 % Additional parameters for each doHand may be provided in | 17 % Additional parameters for each doHand may be provided in |
18 % the doParam input. | 18 % the doParam input. |
22 % for each block. If it is a cell array with length equal | 22 % for each block. If it is a cell array with length equal |
23 % to the number of blocks then each element is sent to the | 23 % to the number of blocks then each element is sent to the |
24 % corresponding function handle as extra parameters: | 24 % corresponding function handle as extra parameters: |
25 % doHand(..., doParam{i}{:}) Otherwise doParam is sent as | 25 % doHand(..., doParam{i}{:}) Otherwise doParam is sent as |
26 % extra parameters to all doHand: doHand(..., doParam{:}) | 26 % extra parameters to all doHand: doHand(..., doParam{:}) |
27 % | |
28 % interfaceType -- nBlocks x nBlocks cell array of types that specify | |
29 % that particular block-coupling is handled. (Could | |
30 % be non-conforming interface, etc.) | |
31 % Default: empty cell array. | |
27 default_arg('doParam', []) | 32 default_arg('doParam', []) |
28 | 33 |
29 [getHand, getParam] = parseInput(doHand, grid, doParam); | 34 [getHand, getParam] = parseInput(doHand, grid, doParam); |
30 | 35 |
31 nBlocks = grid.nBlocks(); | 36 nBlocks = grid.nBlocks(); |
37 default_arg('interfaceType', cell(nBlocks, nBlocks)); | |
32 | 38 |
33 obj.order = order; | 39 obj.order = order; |
34 | 40 |
35 % Create the diffOps for each block | 41 % Create the diffOps for each block |
36 obj.diffOps = cell(1, nBlocks); | 42 obj.diffOps = cell(1, nBlocks); |
64 intf = grid.connections{i,j}; | 70 intf = grid.connections{i,j}; |
65 if isempty(intf) | 71 if isempty(intf) |
66 continue | 72 continue |
67 end | 73 end |
68 | 74 |
69 | 75 [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}, interfaceType{i,j}); |
70 [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}); | |
71 D{i,i} = D{i,i} + ii; | 76 D{i,i} = D{i,i} + ii; |
72 D{i,j} = D{i,j} + ij; | 77 D{i,j} = D{i,j} + ij; |
73 | 78 |
74 [jj, ji] = obj.diffOps{j}.interface(intf{2}, obj.diffOps{i}, intf{1}); | 79 [jj, ji] = obj.diffOps{j}.interface(intf{2}, obj.diffOps{i}, intf{1}, interfaceType{j,i}); |
75 D{j,j} = D{j,j} + jj; | 80 D{j,j} = D{j,j} + jj; |
76 D{j,i} = D{j,i} + ji; | 81 D{j,i} = D{j,i} + ji; |
77 end | 82 end |
78 end | 83 end |
79 obj.D = blockmatrix.toMatrix(D); | 84 obj.D = blockmatrix.toMatrix(D); |