Mercurial > repos > public > sbplib
comparison +multiblock/stitchSchemes.m @ 76:5c569cbef49e
Added more input parameter handling and fixed some bugs.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 23 Nov 2015 17:49:34 +0100 |
parents | 48b6fb693025 |
children | 8eb4e39df8a5 |
comparison
equal
deleted
inserted
replaced
75:ef5c9870f386 | 76:5c569cbef49e |
---|---|
7 % conn - connection matrix | 7 % conn - connection matrix |
8 % bound - boundary condition vector, array of structs with fields w,e,s,n | 8 % bound - boundary condition vector, array of structs with fields w,e,s,n |
9 % each field with a parameter array that is sent to schm.boundary_condition | 9 % each field with a parameter array that is sent to schm.boundary_condition |
10 % | 10 % |
11 % Output parameters are cell arrays and cell matrices. | 11 % Output parameters are cell arrays and cell matrices. |
12 % | |
13 % Ex: [schms, D, H] = stitchSchemes(schmHand, order, schmParam, blocks, ms, conn, bound) | |
12 function [schms, D, H] = stitchSchemes(schmHand, order, schmParam, blocks, ms, conn, bound) | 14 function [schms, D, H] = stitchSchemes(schmHand, order, schmParam, blocks, ms, conn, bound) |
15 default_arg('schmParam',[]); | |
13 | 16 |
14 n_blocks = numel(blocks); | 17 n_blocks = numel(blocks); |
15 | 18 |
16 % Creating Schemes | 19 % Creating Schemes |
17 for i = 1:n_blocks | 20 for i = 1:n_blocks |
18 if ~iscell(schmParam{i}) | 21 if isempty(schmParam); |
22 schms{i} = schmHand(ms{i},blocks{i},order,[]); | |
23 elseif ~iscell(schmParam) | |
19 param = schmParam(i); | 24 param = schmParam(i); |
25 schms{i} = schmHand(ms{i},blocks{i},order,param); | |
20 else | 26 else |
21 param = schmParam{i}; | 27 param = schmParam{i}; |
28 if iscell(param) | |
29 schms{i} = schmHand(ms{i},blocks{i},order,param{:}); | |
30 else | |
31 schms{i} = schmHand(ms{i},blocks{i},order,param); | |
32 end | |
22 end | 33 end |
23 | 34 |
24 % class(schmParam) | 35 % class(schmParam) |
25 % class(ms) | 36 % class(ms) |
26 % class(blocks) | 37 % class(blocks) |
27 % class(schmParam{i}) | 38 % class(schmParam{i}) |
28 % class(ms) | 39 % class(ms) |
29 | 40 |
30 schms{i} = schmHand(ms{i},blocks{i},order,param{:}); | 41 |
31 end | 42 end |
32 | 43 |
33 | 44 |
34 % Total norm | 45 % Total norm |
35 H = cell(n_blocks,n_blocks); | 46 H = cell(n_blocks,n_blocks); |
36 for i = 1:n_blocks | 47 for i = 1:n_blocks |
37 H{i,i} = schms{i}.H; | 48 H{i,i} = schms{i}.H; |
38 end | 49 end |
39 | |
40 | |
41 | |
42 | |
43 | 50 |
44 %% Total system matrix | 51 %% Total system matrix |
45 | 52 |
46 % Differentiation terms | 53 % Differentiation terms |
47 D = cell(n_blocks,n_blocks); | 54 D = cell(n_blocks,n_blocks); |
73 intf = conn{i,j}; | 80 intf = conn{i,j}; |
74 if isempty(intf) | 81 if isempty(intf) |
75 continue | 82 continue |
76 end | 83 end |
77 | 84 |
78 [uu,uv,vv,vu] = noname.Scheme.interface_coupling(schms{i},intf{1},schms{j},intf{2}); | 85 [uu,uv,vv,vu] = schms{i}.interface_coupling(schms{i},intf{1},schms{j},intf{2}); |
79 D{i,i} = D{i,i} + uu; | 86 D{i,i} = D{i,i} + uu; |
80 D{i,j} = uv; | 87 D{i,j} = uv; |
81 D{j,j} = D{j,j} + vv; | 88 D{j,j} = D{j,j} + vv; |
82 D{j,i} = vu; | 89 D{j,i} = vu; |
83 end | 90 end |