Mercurial > repos > public > sbplib
comparison +sbp/+implementations/d1_upwind_5.m @ 284:dae8c3a56f5e
Merged in operator_remake (pull request #2)
Operator remake
author | Jonatan Werpers <jonatan.werpers@it.uu.se> |
---|---|
date | Mon, 12 Sep 2016 12:53:02 +0200 |
parents | f7ac3cd6eeaa |
children |
comparison
equal
deleted
inserted
replaced
282:18c023aaf3f7 | 284:dae8c3a56f5e |
---|---|
1 function [H, HI, Dp, Dm, e_1, e_m] = d1_upwind_5(m,h) | |
2 | |
3 if(m<8) | |
4 error('Operator requires at least 8 grid points'); | |
5 end | |
6 | |
7 Hv=ones(m,1); | |
8 Hv(1:4)=[0.251e3/0.720e3; 0.299e3/0.240e3; 0.211e3/0.240e3; 0.739e3/0.720e3;]; | |
9 Hv(m-3:m)=rot90(Hv(1:4),2); | |
10 Hv = Hv*h; | |
11 H = spdiag(Hv,0); | |
12 HI = spdiag(1./Hv,0); | |
13 | |
14 q_diags = [-2 -1 0 1 2 3]; | |
15 q_stencil = [1/20 -1/2 -1/3 +1 -1/4 +1/30]; | |
16 Qp = stripeMatrix(q_stencil, q_diags,m); | |
17 | |
18 Q_U = [ | |
19 -0.1e1/0.120e3 0.941e3/0.1440e4 -0.47e2/0.360e3 -0.7e1/0.480e3; | |
20 -0.869e3/0.1440e4 -0.11e2/0.120e3 0.25e2/0.32e2 -0.43e2/0.360e3; | |
21 0.29e2/0.360e3 -0.17e2/0.32e2 -0.29e2/0.120e3 0.1309e4/0.1440e4; | |
22 0.1e1/0.32e2 -0.11e2/0.360e3 -0.661e3/0.1440e4 -0.13e2/0.40e2; | |
23 ]; | |
24 | |
25 Qp(1:4,1:4)=Q_U; | |
26 Qp(m-3:m,m-3:m)=rot90( Q_U(1:4,1:4) ,2 )'; %%% This is different from standard SBP | |
27 | |
28 Qm=-Qp'; | |
29 | |
30 e_1=sparse(m,1);e_1(1)=1; | |
31 e_m=sparse(m,1);e_m(m)=1; | |
32 | |
33 Dp=HI*(Qp-1/2*(e_1*e_1')+1/2*(e_m*e_m')) ; | |
34 | |
35 Dm=HI*(Qm-1/2*(e_1*e_1')+1/2*(e_m*e_m')) ; | |
36 end |