annotate +multiblock/nonConformingInterfaceOptions.m @ 913:95cd70f4b07d feature/utux2D

Bugfix in nonConformingInterfaceOptions
author Martin Almquist <malmquist@stanford.edu>
date Sun, 25 Nov 2018 21:08:55 -0800
parents ecfccf236af0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
908
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
1 % g: multiblock grid
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2 % order: cell array of the orders of accuracy used in the different blocks,
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 % or a scalar for the same order everywhere.
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
4 % interpOpSet: string, e.g 'MC' or 'AWW' The same interpOpSet is used everywhere.
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
5 %
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
6 % Returns an InterfaceOptions object that can be used as the 'interfaceOptions' argument to multiblock.DiffOp
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
7 function options = nonConformingInterfaceOptions(g, orders, interpOpSet)
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8 default_arg(interpOpSet, 'AWW');
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
9 nBlocks = g.nBlocks;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10 conn = g.connections;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
11
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
12 % If order is a scalar, the same order is used in all blocks
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13 if ~iscell(orders)
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
14 o = orders;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
15 orders = cell(1,nBlocks);
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16 for i = 1:nBlocks
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17 orders{i} = o;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
18 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
20
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
21 interpOpts = cell(nBlocks, nBlocks);
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
22 for i = 1:nBlocks
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
23 for j = 1:nBlocks
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
24 intf = conn{i,j};
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
25 if isempty(intf)
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
26 continue
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
27 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
28
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
29 mi = length( g.getBoundary({i, intf{1}}) ) - 1;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
30 mj = length( g.getBoundary({j, intf{2}}) ) - 1;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
31
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
32 if mi == mj
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
33 % Matching grids, no interpolation required (presumably)
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
34 continue;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
35 elseif mi/mj == 2
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
36 % Block i is finer
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
37
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
38 switch interpOpSet
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
39 case 'MC'
913
95cd70f4b07d Bugfix in nonConformingInterfaceOptions
Martin Almquist <malmquist@stanford.edu>
parents: 908
diff changeset
40 interpOpSet = sbp.InterpMC(mj+1, mi+1, orders{j}, orders{i});
908
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
41 I_i2j_good = interpOpSet.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
42 I_i2j_bad = interpOpSet.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
43 I_j2i_good = interpOpSet.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
44 I_j2i_bad = interpOpSet.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
45
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
46 case 'AWW'
913
95cd70f4b07d Bugfix in nonConformingInterfaceOptions
Martin Almquist <malmquist@stanford.edu>
parents: 908
diff changeset
47 interpOpSetF2C = sbp.InterpAWW(mj+1, mi+1, orders{j}, orders{i}, 'F2C');
95cd70f4b07d Bugfix in nonConformingInterfaceOptions
Martin Almquist <malmquist@stanford.edu>
parents: 908
diff changeset
48 interpOpSetC2F = sbp.InterpAWW(mj+1, mi+1, orders{j}, orders{i}, 'C2F');
908
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
49 I_i2j_good = interpOpSetF2C.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
50 I_i2j_bad = interpOpSetC2F.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
51 I_j2i_good = interpOpSetC2F.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
52 I_j2i_bad = interpOpSetF2C.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
53 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
54
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
55 elseif mj/mi == 2
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
56 % Block j is finer
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
57
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
58 switch interpOpSet
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
59 case 'MC'
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
60 interpOpSet = sbp.InterpMC(mi+1, mj+1, orders{i}, orders{j});
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
61 I_i2j_good = interpOpSet.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
62 I_i2j_bad = interpOpSet.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
63 I_j2i_good = interpOpSet.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
64 I_j2i_bad = interpOpSet.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
65
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
66 case 'AWW'
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
67 interpOpSetF2C = sbp.InterpAWW(mi+1, mj+1, orders{i}, orders{j}, 'F2C');
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
68 interpOpSetC2F = sbp.InterpAWW(mi+1, mj+1, orders{i}, orders{j}, 'C2F');
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
69 I_i2j_good = interpOpSetC2F.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
70 I_i2j_bad = interpOpSetF2C.IC2F;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
71 I_j2i_good = interpOpSetF2C.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
72 I_j2i_bad = interpOpSetC2F.IF2C;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
73 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
74 else
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
75 error(sprintf('Interpolation operators for grid ratio %f have not yet been constructed', mi/mj));
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
76 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
77
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
78 interpOpts{i,j} = cell(2,1);
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
79 interpOpts{i,j}{1}.I_local2neighbor.good = I_i2j_good;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
80 interpOpts{i,j}{1}.I_local2neighbor.bad = I_i2j_bad;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
81 interpOpts{i,j}{1}.I_neighbor2local.good = I_j2i_good;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
82 interpOpts{i,j}{1}.I_neighbor2local.bad = I_j2i_bad;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
83
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
84 interpOpts{i,j}{2}.I_local2neighbor.good = I_j2i_good;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
85 interpOpts{i,j}{2}.I_local2neighbor.bad = I_j2i_bad;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
86 interpOpts{i,j}{2}.I_neighbor2local.good = I_i2j_good;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
87 interpOpts{i,j}{2}.I_neighbor2local.bad = I_i2j_bad;
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
88
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
89 options = multiblock.InterfaceOptions(g, interpOpts);
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
90
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
91 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
92 end
ecfccf236af0 Add helper function nonConformingInterfaceOptions that creates an InterfaceOptions object that specifies which interpolation operators are used where.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
93