comparison +sbp/InterpOpsMC.m @ 1033:037f203b9bf5 feature/burgers1d

Merge with branch feature/advectioRV to utilize the +rv package
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 17 Jan 2019 10:44:12 +0100
parents 27ce3f653aa7
children
comparison
equal deleted inserted replaced
854:18162a0a5bb5 1033:037f203b9bf5
1 % Interpolation operators by Mattsson and Carpenter (MC), see
2 % Mattsson and Carpenter,
3 % "Stable and Accurate Interpolatino Operators for High-Order Multiblock Finite DIfference Methods",
4 % https://epubs.siam.org/doi/pdf/10.1137/090750068
5 %
6 % Let ^* denote the adjoint. These operators satsify
7 %
8 % Iuv2 = Iv2u^*
9 %
10 % Both Iu2v and Iv2u have p:th order accuracy, if the interior stencil is
11 % of order 2p.
12 %
13 % This approach leads to a reduction of the convergence rate by one order for
14 % PDEs with 2nd derivatives in space, as compared to conforming interfaces.
15 % To obtain full convergence rate, use the order-preserving (OP) operators in
16 % InterpOpsOP.m
17 classdef InterpOpsMC < sbp.InterpOps
18 properties
19
20 % Structs of interpolation operators, fields .good and .bad
21 % Here .good and .bad are the same, but this makes them fit in the
22 % OP (order-preserving) framework.
23 Iu2v
24 Iv2u
25 end
26
27 methods
28 % m_u, m_v -- number of grid points along the interface
29 % order_u, order_v -- order of accuracy in the different blocks
30 function obj = InterpOpsMC(m_u, m_v, order_u, order_v)
31
32 assert(order_u == order_v,...
33 'InterpOpsMC: Different orders of accuracy not available');
34
35 switch order_u
36 case 2
37 intOpSet = @sbp.implementations.intOpMC_orders_2to2_ratio2to1;
38 case 4
39 intOpSet = @sbp.implementations.intOpMC_orders_4to4_ratio2to1;
40 case 6
41 intOpSet = @sbp.implementations.intOpMC_orders_6to6_ratio2to1;
42 case 8
43 intOpSet = @sbp.implementations.intOpMC_orders_8to8_ratio2to1;
44 otherwise
45 error('InterpOpsMC: Order of accuracy %d not available.', order_u);
46 end
47
48 Iu2v = struct;
49 Iv2u = struct;
50
51 if (m_u-1)/(m_v-1) == 2
52 % Block u is fine, v is coarse
53 m_C = m_v;
54 [Iv2u.good, Iu2v.bad] = intOpSet(m_C);
55 Iv2u.bad = Iv2u.good;
56 Iu2v.good = Iu2v.bad;
57
58 elseif (m_v-1)/(m_u-1) == 2
59 % Block v is fine, u is coarse
60 m_C = m_u;
61 [Iu2v.good, Iv2u.bad] = intOpSet(m_C);
62 Iu2v.bad = Iu2v.good;
63 Iv2u.good = Iv2u.bad;
64 else
65 error('InterpOpsMC: Interpolation operators for grid ratio %f have not yet been constructed', (m_u-1)/(m_v-1));
66 end
67
68 obj.Iu2v = Iu2v;
69 obj.Iv2u = Iv2u;
70
71 end
72
73 function str = string(obj)
74 str = [class(obj)];
75 end
76
77 end
78 end