Mercurial > repos > public > sbplib
comparison +sbp/+implementations/d1_upwind_7.m @ 307:fefb2f9884f7 feature/beams
Merge with default.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 23 Sep 2016 10:40:12 +0200 |
parents | f7ac3cd6eeaa |
children |
comparison
equal
deleted
inserted
replaced
306:8368beb0d1b3 | 307:fefb2f9884f7 |
---|---|
1 function [H, HI, Dp, Dm, e_1, e_m] = d1_upwind_7(m,h) | |
2 | |
3 BP = 6; | |
4 if(m<2*BP) | |
5 error(['Operator requires at least ' num2str(2*BP) ' grid points']); | |
6 end | |
7 | |
8 Hv=ones(m,1); | |
9 Hv(1:6) = [0.19087e5/0.60480e5; 0.84199e5/0.60480e5; 0.18869e5/0.30240e5; 0.37621e5/0.30240e5; 0.55031e5/0.60480e5; 0.61343e5/0.60480e5; ]; | |
10 Hv(m-5:m)=rot90(Hv(1:6),2); | |
11 Hv = Hv*h; | |
12 H = spdiag(Hv,0); | |
13 HI = spdiag(1./Hv,0); | |
14 | |
15 q_diags = [-3 -2 -1 0 1 2 3 4]; | |
16 q_stencil = [-1/105 +1/10 -3/5 -1/4 +1 -3/10 +1/15 -1/140]; | |
17 Qp = stripeMatrix(q_stencil, q_diags,m); | |
18 | |
19 Q_U =[ | |
20 -0.265e3/0.300272e6 0.1587945773e10/0.2432203200e10 -0.1926361e7/0.25737600e8 -0.84398989e8/0.810734400e9 0.48781961e8/0.4864406400e10 0.3429119e7/0.202683600e9; | |
21 -0.1570125773e10/0.2432203200e10 -0.26517e5/0.1501360e7 0.240029831e9/0.486440640e9 0.202934303e9/0.972881280e9 0.118207e6/0.13512240e8 -0.231357719e9/0.4864406400e10; | |
22 0.1626361e7/0.25737600e8 -0.206937767e9/0.486440640e9 -0.61067e5/0.750680e6 0.49602727e8/0.81073440e8 -0.43783933e8/0.194576256e9 0.51815011e8/0.810734400e9; | |
23 0.91418989e8/0.810734400e9 -0.53314099e8/0.194576256e9 -0.33094279e8/0.81073440e8 -0.18269e5/0.107240e6 0.440626231e9/0.486440640e9 -0.365711063e9/0.1621468800e10; | |
24 -0.62551961e8/0.4864406400e10 0.799e3/0.35280e5 0.82588241e8/0.972881280e9 -0.279245719e9/0.486440640e9 -0.346583e6/0.1501360e7 0.2312302333e10/0.2432203200e10; | |
25 -0.3375119e7/0.202683600e9 0.202087559e9/0.4864406400e10 -0.11297731e8/0.810734400e9 0.61008503e8/0.1621468800e10 -0.1360092253e10/0.2432203200e10 -0.10677e5/0.42896e5; | |
26 ]; | |
27 | |
28 | |
29 Qp(1:6,1:6)=Q_U; | |
30 Qp(m-5:m,m-5:m)=rot90(Q_U,2)'; | |
31 | |
32 Qm=-Qp'; | |
33 | |
34 e_1=sparse(m,1);e_1(1)=1; | |
35 e_m=sparse(m,1);e_m(m)=1; | |
36 | |
37 Dp=HI*(Qp-1/2*(e_1*e_1')+1/2*(e_m*e_m')) ; | |
38 | |
39 Dm=HI*(Qm-1/2*(e_1*e_1')+1/2*(e_m*e_m')) ; | |
40 end |