Mercurial > repos > public > sbplib
comparison +sbp/InterpOpsOP.m @ 979:7a5e770974ed feature/timesteppers
Merge with default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 07 Jan 2019 16:26:00 +0100 |
parents | 27ce3f653aa7 |
children |
comparison
equal
deleted
inserted
replaced
933:34b3d092a4d0 | 979:7a5e770974ed |
---|---|
1 % Order-preserving (OP) interpolation operators, see | |
2 % Almquist, Wang, Werpers, | |
3 % "Order-Preserving Interpolation for Summation-by-Parts Operators | |
4 % at Non-Conforming Interfaces", https://arxiv.org/abs/1806.01931 | |
5 % | |
6 % Let ^* denote the adjoint. These operators satsify | |
7 % | |
8 % Iuv2.good = Iv2u.bad^* | |
9 % Iv2u.good = Iu2v.bad^* | |
10 % | |
11 % The .bad operators have the same order of accuracy as the operators | |
12 % by Mattsson and Carpenter (MC) in InterpOpsMC, i.e. order p, | |
13 % if the interior stencil is order 2p. The .good operators are | |
14 % one order more accurate, i.e. order p+1. | |
15 % | |
16 % For PDEs of second order in space, the OP operators allow for the same | |
17 % convergence rate as with conforming interfaces, which is an improvement | |
18 % by one order compared what is possible with the MC operators. | |
19 classdef InterpOpsOP < sbp.InterpOps | |
20 properties | |
21 | |
22 % Structs of interpolation operators, fields .good and .bad | |
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 = InterpOpsOP(m_u, m_v, order_u, order_v) | |
31 | |
32 assert(order_u == order_v,... | |
33 'InterpOpsOP: Different orders of accuracy not available'); | |
34 | |
35 switch order_u | |
36 case 2 | |
37 intOpSet = @sbp.implementations.intOpOP_orders_2to2_ratio2to1; | |
38 case 4 | |
39 intOpSet = @sbp.implementations.intOpOP_orders_4to4_ratio2to1; | |
40 case 6 | |
41 intOpSet = @sbp.implementations.intOpOP_orders_6to6_ratio2to1; | |
42 case 8 | |
43 intOpSet = @sbp.implementations.intOpOP_orders_8to8_ratio2to1; | |
44 otherwise | |
45 error('InterpOpsOP: 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, 1, 'C2F'); | |
55 [Iv2u.bad, Iu2v.good] = intOpSet(m_C, 1, 'F2C'); | |
56 | |
57 elseif (m_v-1)/(m_u-1) == 2 | |
58 % Block v is fine, u is coarse | |
59 m_C = m_u; | |
60 [Iu2v.good, Iv2u.bad] = intOpSet(m_C, 1, 'C2F'); | |
61 [Iu2v.bad, Iv2u.good] = intOpSet(m_C, 1, 'F2C'); | |
62 else | |
63 error('InterpOpsOP: Interpolation operators for grid ratio %f have not yet been constructed', (m_u-1)/(m_v-1)); | |
64 end | |
65 | |
66 obj.Iu2v = Iu2v; | |
67 obj.Iv2u = Iv2u; | |
68 | |
69 end | |
70 | |
71 function str = string(obj) | |
72 str = [class(obj)]; | |
73 end | |
74 | |
75 end | |
76 end |