annotate +sbp/+implementations/intOpMC_orders_4to4_ratio2to1.m @ 1198:2924b3a9b921 feature/d2_compatible

Add OpSet for fully compatible D2Variable, created from regular D2Variable by replacing d1 by first row of D1. Formal reduction by one order of accuracy at the boundary point.
author Martin Almquist <malmquist@stanford.edu>
date Fri, 16 Aug 2019 14:30:28 -0700
parents c923fe6197ff
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
608
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
1 % Marks New interpolation operators
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2 % 4th order to 2nd order accurate (diagonal norm)
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 % M=9 is the minimum amount of points on the coarse mesh
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
4
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
5 function [IC2F,IF2C] = intOpMC_orders_4to4_ratio2to1(M_C)
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
6
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
7 M_F=M_C*2-1;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
9 % Coarse to fine
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10 I1=zeros(M_F,M_C);
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
11 t1=[ 2047/2176 , 129/1088 , -129/2176 , 0 , 0 , 0 , 0 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
12 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13 429/944 , 279/472 , -43/944 , 0 , 0 , 0 , 0 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
14 111/2752 , 4913/5504 , 3/32 , -147/5504 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
15 0 , 0 , 0 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16 -103/784 , 549/784 , 387/784 , -1/16 , 0 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17 0 , 0 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
18 -335/3072 , 205/768 , 2365/3072 , 49/512 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 -3/128 , 0 , 0 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
20 -9/256 , 5/256 , 129/256 , 147/256 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
21 -1/16 , 0 , 0 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
22 5/192 , -59/1024 , 43/512 , 2695/3072 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
23 3/32 , -3/128 , 0 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
24 23/768 , -37/768 , -43/768 , 147/256 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
25 9/16 , -1/16 , 0 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
26 13/2048 , -11/1024 , -43/2048 , 49/512 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
27 55/64 , 3/32 , -3/128 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
28 -1/384 , 1/256 , 0 , -49/768 , 9/16 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
29 9/16 , -1/16 , 0 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
30 -1/1024 , 3/2048 , 0 , -49/2048 , 3/32 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
31 55/64 , 3/32 , -3/128];
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
32
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
33
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
34 t2=[-3/128 3/32 55/64 3/32 -3/128];
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
35 t3=[-1/16 9/16 9/16 -1/16];
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
36 I1(1:11,1:8)=t1;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
37 I1(M_F-10:M_F,M_C-7:M_C)=fliplr(flipud(t1));
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
38 I1(12,5:8)=t3;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
39 for i=13:2:M_F-12
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
40 j=(i-1)/2;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
41 I1(i,j-1:j+3)=t2;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
42 I1(i+1,j:j+3)=t3;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
43 end
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
44
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
45 % Fine to coarse
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
46 I2=zeros(M_C,M_F);
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
47
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
48 t1=[ 2047/4352 , 429/544 , 111/2176 , -103/544 ...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
49 , -335/2176 , -27/544 , 5/136 , 23/544 ,...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
50 39/4352 , -1/272 , -3/2176 ;...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
51 129/7552 , 279/944 , 4913/15104 , 549/1888 ...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
52 , 205/1888 , 15/1888 , -3/128 , -37/1888 ...
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
53 , -33/7552 , 3/1888 , 9/15104 ];
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
54 t2=[-3/256 -1/32 3/64 9/32 55/128 9/32 3/64 -1/32 -3/256];
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
55
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
56 I2(1:2,1:11)=t1;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
57
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
58 I2(M_C-1:M_C,M_F-10:M_F)=fliplr(flipud(t1));
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
59
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
60 for i=3:M_C-2
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
61 j=2*(i-3)+1;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
62 I2(i,j:j+8)=t2;
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
63 end
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
64
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
65 IC2F = sparse(I1);
c923fe6197ff Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
66 IF2C = sparse(I2);