Mercurial > repos > public > sbplib
comparison +sbp/+implementations/intOpMC_orders_2to2_ratio2to1.m @ 886:8894e9c49e40 feature/timesteppers
Merge with default for latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 15 Nov 2018 16:36:21 -0800 |
parents | c923fe6197ff |
children |
comparison
equal
deleted
inserted
replaced
816:b5e5b195da1e | 886:8894e9c49e40 |
---|---|
1 function [IC2F,IF2C] = intOpMC_orders_2to2_ratio2to1(mc) | |
2 | |
3 mf = 2*(mc-1) + 1; | |
4 | |
5 stencil_F2C = [1.0./4.0,1.0./2.0,1.0./4.0]; | |
6 stencil_width = length(stencil_F2C); | |
7 stencil_halfwidth = (stencil_width-1)/2; | |
8 | |
9 BC_F2C = [1.0./2.0,1.0./2.0]; | |
10 | |
11 Hc = speye(mc,mc); | |
12 Hc(1,1) = 1/2; | |
13 Hc(end,end) = 1/2; | |
14 | |
15 Hf = 1/2*speye(mf,mf); | |
16 Hf(1,1) = 1/4; | |
17 Hf(end,end) = 1/4; | |
18 | |
19 IF2C = sparse(mc,mf); | |
20 [BCrows, BCcols] = size(BC_F2C); | |
21 IF2C(1:BCrows, 1:BCcols) = BC_F2C; | |
22 IF2C(mc-BCrows+1:mc, mf-BCcols+1:mf) = rot90(BC_F2C,2); | |
23 | |
24 for i = BCrows+1 : mc-BCrows | |
25 IF2C(i,(2*i-stencil_halfwidth-1) :(2*i+stencil_halfwidth-1))... | |
26 = stencil_F2C; | |
27 end | |
28 | |
29 IC2F = Hf\(IF2C'*Hc); | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 |