annotate +scheme/LaplaceCurvilinearNewCorner.m @ 1065:c2bd7f15da48 feature/laplace_curvilinear_test

Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
author Martin Almquist <malmquist@stanford.edu>
date Thu, 17 Jan 2019 18:57:54 -0800
parents
children d64062bed5fb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1065
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
1 classdef LaplaceCurvilinearNewCorner < scheme.Scheme
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2 properties
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 m % Number of points in each direction, possibly a vector
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
4 h % Grid spacing
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
5 dim % Number of spatial dimensions
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
6
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
7 grid
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
9 order % Order of accuracy for the approximation
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
11 a,b % Parameters of the operator
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
12
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
14 % Inner products and operators for physical coordinates
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
15 D % Laplace operator
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16 H, Hi % Inner product
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17 e_w, e_e, e_s, e_n
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
18 d_w, d_e, d_s, d_n % Normal derivatives at the boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 H_w, H_e, H_s, H_n % Boundary inner products
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
20 Dx, Dy % Physical derivatives
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
21 M % Gradient inner product
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
22
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
23 % Metric coefficients
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
24 J, Ji
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
25 a11, a12, a22
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
26 K
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
27 x_u
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
28 x_v
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
29 y_u
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
30 y_v
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
31 s_w, s_e, s_s, s_n % Boundary integral scale factors
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
32
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
33 % Inner product and operators for logical coordinates
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
34 H_u, H_v % Norms in the x and y directions
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
35 Hi_u, Hi_v
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
36 Hu,Hv % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
37 Hiu, Hiv
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
38 du_w, dv_w
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
39 du_e, dv_e
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
40 du_s, dv_s
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
41 du_n, dv_n
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
42
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
43 % Borrowing constants
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
44 theta_M_u, theta_M_v
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
45 theta_R_u, theta_R_v
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
46 theta_H_u, theta_H_v
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
47
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
48 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
49
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
50 methods
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
51 % Implements a*div(b*grad(u)) as a SBP scheme
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
52 % TODO: Implement proper H, it should be the real physical quadrature, the logic quadrature may be but in a separate variable (H_logic?)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
53
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
54 function obj = LaplaceCurvilinearNewCorner(g, order, a, b, opSet)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
55 default_arg('opSet',@sbp.D2Variable);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
56 default_arg('a', 1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
57 default_arg('b', 1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
58
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
59 if b ~=1
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
60 error('Not implemented yet')
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
61 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
62
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
63 % assert(isa(g, 'grid.Curvilinear'))
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
64 if isa(a, 'function_handle')
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
65 a = grid.evalOn(g, a);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
66 a = spdiag(a);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
67 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
68
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
69 dim = 2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
70 m = g.size();
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
71 m_u = m(1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
72 m_v = m(2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
73 m_tot = g.N();
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
74
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
75 h = g.scaling();
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
76 h_u = h(1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
77 h_v = h(2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
78
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
79
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
80 % 1D operators
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
81 ops_u = opSet(m_u, {0, 1}, order);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
82 ops_v = opSet(m_v, {0, 1}, order);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
83
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
84 I_u = speye(m_u);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
85 I_v = speye(m_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
86
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
87 D1_u = ops_u.D1;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
88 D2_u = ops_u.D2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
89 H_u = ops_u.H;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
90 Hi_u = ops_u.HI;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
91 e_l_u = ops_u.e_l;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
92 e_r_u = ops_u.e_r;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
93 d1_l_u = ops_u.d1_l;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
94 d1_r_u = ops_u.d1_r;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
95
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
96 D1_v = ops_v.D1;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
97 D2_v = ops_v.D2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
98 H_v = ops_v.H;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
99 Hi_v = ops_v.HI;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
100 e_l_v = ops_v.e_l;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
101 e_r_v = ops_v.e_r;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
102 d1_l_v = ops_v.d1_l;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
103 d1_r_v = ops_v.d1_r;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
104
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
105
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
106 % Logical operators
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
107 Du = kr(D1_u,I_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
108 Dv = kr(I_u,D1_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
109 obj.Hu = kr(H_u,I_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
110 obj.Hv = kr(I_u,H_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
111 obj.Hiu = kr(Hi_u,I_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
112 obj.Hiv = kr(I_u,Hi_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
113
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
114 e_w = kr(e_l_u,I_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
115 e_e = kr(e_r_u,I_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
116 e_s = kr(I_u,e_l_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
117 e_n = kr(I_u,e_r_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
118 obj.du_w = kr(d1_l_u,I_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
119 obj.dv_w = (e_w'*Dv)';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
120 obj.du_e = kr(d1_r_u,I_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
121 obj.dv_e = (e_e'*Dv)';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
122 obj.du_s = (e_s'*Du)';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
123 obj.dv_s = kr(I_u,d1_l_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
124 obj.du_n = (e_n'*Du)';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
125 obj.dv_n = kr(I_u,d1_r_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
126
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
127
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
128 % Metric coefficients
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
129 coords = g.points();
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
130 x = coords(:,1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
131 y = coords(:,2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
132
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
133 x_u = Du*x;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
134 x_v = Dv*x;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
135 y_u = Du*y;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
136 y_v = Dv*y;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
137
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
138 J = x_u.*y_v - x_v.*y_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
139 a11 = 1./J .* (x_v.^2 + y_v.^2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
140 a12 = -1./J .* (x_u.*x_v + y_u.*y_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
141 a22 = 1./J .* (x_u.^2 + y_u.^2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
142 % lambda = 1/2 * (a11 + a22 - sqrt((a11-a22).^2 + 4*a12.^2));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
143
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
144 K = cell(dim, dim);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
145 K{1,1} = spdiag(y_v./J);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
146 K{1,2} = spdiag(-y_u./J);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
147 K{2,1} = spdiag(-x_v./J);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
148 K{2,2} = spdiag(x_u./J);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
149 obj.K = K;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
150
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
151 obj.x_u = x_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
152 obj.x_v = x_v;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
153 obj.y_u = y_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
154 obj.y_v = y_v;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
155
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
156 % Assemble full operators
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
157 L_12 = spdiag(a12);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
158 Duv = Du*L_12*Dv;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
159 Dvu = Dv*L_12*Du;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
160
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
161 Duu = sparse(m_tot);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
162 Dvv = sparse(m_tot);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
163 ind = grid.funcToMatrix(g, 1:m_tot);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
164
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
165 for i = 1:m_v
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
166 D = D2_u(a11(ind(:,i)));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
167 p = ind(:,i);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
168 Duu(p,p) = D;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
169 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
170
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
171 for i = 1:m_u
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
172 D = D2_v(a22(ind(i,:)));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
173 p = ind(i,:);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
174 Dvv(p,p) = D;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
175 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
176
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
177
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
178 % Physical operators
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
179 obj.J = spdiag(J);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
180 obj.Ji = spdiag(1./J);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
181
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
182 obj.D = obj.Ji*a*(Duu + Duv + Dvu + Dvv);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
183 obj.H = obj.J*kr(H_u,H_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
184 obj.Hi = obj.Ji*kr(Hi_u,Hi_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
185
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
186 obj.e_w = e_w;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
187 obj.e_e = e_e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
188 obj.e_s = e_s;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
189 obj.e_n = e_n;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
190
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
191 %% normal derivatives
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
192 I_w = ind(1,:);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
193 I_e = ind(end,:);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
194 I_s = ind(:,1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
195 I_n = ind(:,end);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
196
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
197 a11_w = spdiag(a11(I_w));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
198 a12_w = spdiag(a12(I_w));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
199 a11_e = spdiag(a11(I_e));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
200 a12_e = spdiag(a12(I_e));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
201 a22_s = spdiag(a22(I_s));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
202 a12_s = spdiag(a12(I_s));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
203 a22_n = spdiag(a22(I_n));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
204 a12_n = spdiag(a12(I_n));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
205
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
206 s_w = sqrt((e_w'*x_v).^2 + (e_w'*y_v).^2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
207 s_e = sqrt((e_e'*x_v).^2 + (e_e'*y_v).^2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
208 s_s = sqrt((e_s'*x_u).^2 + (e_s'*y_u).^2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
209 s_n = sqrt((e_n'*x_u).^2 + (e_n'*y_u).^2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
210
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
211 obj.d_w = -1*(spdiag(1./s_w)*(a11_w*obj.du_w' + a12_w*obj.dv_w'))';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
212 obj.d_e = (spdiag(1./s_e)*(a11_e*obj.du_e' + a12_e*obj.dv_e'))';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
213 obj.d_s = -1*(spdiag(1./s_s)*(a22_s*obj.dv_s' + a12_s*obj.du_s'))';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
214 obj.d_n = (spdiag(1./s_n)*(a22_n*obj.dv_n' + a12_n*obj.du_n'))';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
215
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
216 obj.Dx = spdiag( y_v./J)*Du + spdiag(-y_u./J)*Dv;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
217 obj.Dy = spdiag(-x_v./J)*Du + spdiag( x_u./J)*Dv;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
218
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
219 %% Boundary inner products
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
220 obj.H_w = H_v*spdiag(s_w);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
221 obj.H_e = H_v*spdiag(s_e);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
222 obj.H_s = H_u*spdiag(s_s);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
223 obj.H_n = H_u*spdiag(s_n);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
224
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
225 % Misc.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
226 obj.m = m;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
227 obj.h = [h_u h_v];
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
228 obj.order = order;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
229 obj.grid = g;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
230 obj.dim = dim;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
231
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
232 obj.a = a;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
233 obj.b = b;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
234 obj.a11 = a11;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
235 obj.a12 = a12;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
236 obj.a22 = a22;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
237 % obj.lambda = lambda;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
238 obj.s_w = spdiag(s_w);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
239 obj.s_e = spdiag(s_e);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
240 obj.s_s = spdiag(s_s);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
241 obj.s_n = spdiag(s_n);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
242
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
243 obj.theta_M_u = h_u*ops_u.borrowing.M.d1;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
244 obj.theta_M_v = h_v*ops_v.borrowing.M.d1;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
245
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
246 obj.theta_R_u = h_u*ops_u.borrowing.R.delta_D;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
247 obj.theta_R_v = h_v*ops_v.borrowing.R.delta_D;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
248
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
249 obj.theta_H_u = h_u*ops_u.borrowing.H11;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
250 obj.theta_H_v = h_v*ops_v.borrowing.H11;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
251 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
252
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
253
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
254 % Closure functions return the opertors applied to the own doamin to close the boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
255 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
256 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
257 % type is a string specifying the type of boundary condition if there are several.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
258 % data is a function returning the data that should be applied at the boundary.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
259 % neighbour_scheme is an instance of Scheme that should be interfaced to.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
260 % neighbour_boundary is a string specifying which boundary to interface to.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
261 function [closure, penalty] = boundary_condition(obj, boundary, type, parameter)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
262 default_arg('type','neumann');
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
263 default_arg('parameter', []);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
264
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
265 [e, d] = obj.getBoundaryOperator({'e', 'd'}, boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
266 H_b = obj.getBoundaryQuadrature(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
267 s_b = obj.getBoundaryScaling(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
268 [th_H, th_M, th_R] = obj.getBoundaryBorrowing(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
269 m = obj.getBoundaryNumber(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
270
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
271 K = obj.K;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
272 J = obj.J;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
273 Hi = obj.Hi;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
274 a_b = e'*obj.a*e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
275
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
276 switch type
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
277 % Dirichlet boundary condition
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
278 case {'D','d','dirichlet'}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
279 tuning = 1.0;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
280
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
281 sigma = 0;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
282 for i = 1:obj.dim
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
283 sigma = sigma + e'*J*K{i,m}*K{i,m}*e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
284 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
285 sigma = sigma/s_b;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
286 % tau = tuning*(1/th_R + obj.dim/th_H)*sigma;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
287
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
288 tau_R = 1/th_R*sigma;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
289
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
290 tau_H = 1/th_H*sigma;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
291 tau_H(1,1) = obj.dim*tau_H(1,1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
292 tau_H(end,end) = obj.dim*tau_H(end,end);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
293
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
294 tau = tuning*(tau_R + tau_H);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
295
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
296 closure = Hi*d*a_b*H_b*e' ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
297 -Hi*e*tau*H_b*e';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
298
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
299 penalty = -Hi*d*a_b*H_b ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
300 +Hi*e*tau*H_b;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
301
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
302
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
303 % Neumann boundary condition
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
304 case {'N','n','neumann'}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
305 tau1 = -1;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
306 tau2 = 0;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
307 tau = (tau1*e + tau2*d)*H_b;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
308
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
309 closure = obj.a*Hi*tau*d';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
310 penalty = -obj.a*Hi*tau;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
311
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
312
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
313 % Unknown, boundary condition
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
314 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
315 error('No such boundary condition: type = %s',type);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
316 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
317 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
318
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
319 % type Struct that specifies the interface coupling.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
320 % Fields:
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
321 % -- tuning: penalty strength, defaults to 1.2
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
322 % -- interpolation: type of interpolation, default 'none'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
323 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
324
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
325 error('Not implemented')
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
326
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
327 defaultType.tuning = 1.2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
328 defaultType.interpolation = 'none';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
329 default_struct('type', defaultType);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
330
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
331 switch type.interpolation
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
332 case {'none', ''}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
333 [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
334 case {'op','OP'}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
335 [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
336 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
337 error('Unknown type of interpolation: %s ', type.interpolation);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
338 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
339 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
340
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
341 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
342 tuning = type.tuning;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
343
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
344 % u denotes the solution in the own domain
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
345 % v denotes the solution in the neighbour domain
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
346 [e_u, d_u] = obj.getBoundaryOperator({'e', 'd'}, boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
347 H_b_u = obj.getBoundaryQuadrature(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
348 I_u = obj.getBoundaryIndices(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
349 gamm_u = obj.getBoundaryBorrowing(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
350
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
351 [e_v, d_v] = neighbour_scheme.getBoundaryOperator({'e', 'd'}, neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
352 H_b_v = neighbour_scheme.getBoundaryQuadrature(neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
353 I_v = neighbour_scheme.getBoundaryIndices(neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
354 gamm_v = neighbour_scheme.getBoundaryBorrowing(neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
355
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
356 u = obj;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
357 v = neighbour_scheme;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
358
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
359 b1_u = gamm_u*u.lambda(I_u)./u.a11(I_u).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
360 b2_u = gamm_u*u.lambda(I_u)./u.a22(I_u).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
361 b1_v = gamm_v*v.lambda(I_v)./v.a11(I_v).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
362 b2_v = gamm_v*v.lambda(I_v)./v.a22(I_v).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
363
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
364 tau1 = -1./(4*b1_u) -1./(4*b1_v) -1./(4*b2_u) -1./(4*b2_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
365 tau1 = tuning * spdiag(tau1);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
366 tau2 = 1/2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
367
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
368 sig1 = -1/2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
369 sig2 = 0;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
370
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
371 tau = (e_u*tau1 + tau2*d_u)*H_b_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
372 sig = (sig1*e_u + sig2*d_u)*H_b_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
373
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
374 closure = obj.a*obj.Hi*( tau*e_u' + sig*d_u');
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
375 penalty = obj.a*obj.Hi*(-tau*e_v' + sig*d_v');
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
376 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
377
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
378 function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
379
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
380 % TODO: Make this work for curvilinear grids
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
381 warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.');
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
382
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
383 % User can request special interpolation operators by specifying type.interpOpSet
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
384 default_field(type, 'interpOpSet', @sbp.InterpOpsOP);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
385 interpOpSet = type.interpOpSet;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
386 tuning = type.tuning;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
387
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
388
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
389 % u denotes the solution in the own domain
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
390 % v denotes the solution in the neighbour domain
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
391 [e_u, d_u] = obj.getBoundaryOperator({'e', 'd'}, boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
392 H_b_u = obj.getBoundaryQuadrature(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
393 I_u = obj.getBoundaryIndices(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
394 gamm_u = obj.getBoundaryBorrowing(boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
395
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
396 [e_v, d_v] = neighbour_scheme.getBoundaryOperator({'e', 'd'}, neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
397 H_b_v = neighbour_scheme.getBoundaryQuadrature(neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
398 I_v = neighbour_scheme.getBoundaryIndices(neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
399 gamm_v = neighbour_scheme.getBoundaryBorrowing(neighbour_boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
400
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
401
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
402 % Find the number of grid points along the interface
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
403 m_u = size(e_u, 2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
404 m_v = size(e_v, 2);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
405
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
406 Hi = obj.Hi;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
407 a = obj.a;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
408
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
409 u = obj;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
410 v = neighbour_scheme;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
411
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
412 b1_u = gamm_u*u.lambda(I_u)./u.a11(I_u).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
413 b2_u = gamm_u*u.lambda(I_u)./u.a22(I_u).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
414 b1_v = gamm_v*v.lambda(I_v)./v.a11(I_v).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
415 b2_v = gamm_v*v.lambda(I_v)./v.a22(I_v).^2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
416
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
417 tau_u = -1./(4*b1_u) -1./(4*b2_u);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
418 tau_v = -1./(4*b1_v) -1./(4*b2_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
419
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
420 tau_u = tuning * spdiag(tau_u);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
421 tau_v = tuning * spdiag(tau_v);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
422 beta_u = tau_v;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
423
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
424 % Build interpolation operators
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
425 intOps = interpOpSet(m_u, m_v, obj.order, neighbour_scheme.order);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
426 Iu2v = intOps.Iu2v;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
427 Iv2u = intOps.Iv2u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
428
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
429 closure = a*Hi*e_u*tau_u*H_b_u*e_u' + ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
430 a*Hi*e_u*H_b_u*Iv2u.bad*beta_u*Iu2v.good*e_u' + ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
431 a*1/2*Hi*d_u*H_b_u*e_u' + ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
432 -a*1/2*Hi*e_u*H_b_u*d_u';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
433
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
434 penalty = -a*Hi*e_u*tau_u*H_b_u*Iv2u.good*e_v' + ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
435 -a*Hi*e_u*H_b_u*Iv2u.bad*beta_u*e_v' + ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
436 -a*1/2*Hi*d_u*H_b_u*Iv2u.good*e_v' + ...
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
437 -a*1/2*Hi*e_u*H_b_u*Iv2u.bad*d_v';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
438
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
439 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
440
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
441 % Returns the boundary operator op for the boundary specified by the string boundary.
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
442 % op -- string or a cell array of strings
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
443 % boundary -- string
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
444 function varargout = getBoundaryOperator(obj, op, boundary)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
445
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
446 if ~iscell(op)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
447 op = {op};
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
448 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
449
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
450 for i = 1:numel(op)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
451 switch op{i}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
452 case 'e'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
453 switch boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
454 case 'w'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
455 e = obj.e_w;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
456 case 'e'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
457 e = obj.e_e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
458 case 's'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
459 e = obj.e_s;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
460 case 'n'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
461 e = obj.e_n;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
462 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
463 error('No such boundary: boundary = %s',boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
464 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
465 varargout{i} = e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
466
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
467 case 'd'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
468 switch boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
469 case 'w'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
470 d = obj.d_w;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
471 case 'e'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
472 d = obj.d_e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
473 case 's'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
474 d = obj.d_s;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
475 case 'n'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
476 d = obj.d_n;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
477 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
478 error('No such boundary: boundary = %s',boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
479 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
480 varargout{i} = d;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
481 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
482 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
483 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
484
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
485 % Returns square boundary quadrature matrix, of dimension
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
486 % corresponding to the number of boundary points
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
487 %
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
488 % boundary -- string
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
489 function H_b = getBoundaryQuadrature(obj, boundary)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
490
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
491 switch boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
492 case 'w'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
493 H_b = obj.H_w;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
494 case 'e'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
495 H_b = obj.H_e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
496 case 's'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
497 H_b = obj.H_s;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
498 case 'n'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
499 H_b = obj.H_n;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
500 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
501 error('No such boundary: boundary = %s',boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
502 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
503 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
504
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
505 % Returns square boundary quadrature scaling matrix, of dimension
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
506 % corresponding to the number of boundary points
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
507 %
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
508 % boundary -- string
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
509 function s_b = getBoundaryScaling(obj, boundary)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
510
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
511 switch boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
512 case 'w'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
513 s_b = obj.s_w;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
514 case 'e'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
515 s_b = obj.s_e;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
516 case 's'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
517 s_b = obj.s_s;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
518 case 'n'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
519 s_b = obj.s_n;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
520 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
521 error('No such boundary: boundary = %s',boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
522 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
523 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
524
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
525 % Returns the coordinate number corresponding to the boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
526 %
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
527 % boundary -- string
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
528 function m = getBoundaryNumber(obj, boundary)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
529
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
530 switch boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
531 case {'w', 'e'}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
532 m = 1;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
533 case {'s', 'n'}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
534 m = 2;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
535 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
536 error('No such boundary: boundary = %s',boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
537 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
538 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
539
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
540 % Returns the indices of the boundary points in the grid matrix
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
541 % boundary -- string
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
542 function I = getBoundaryIndices(obj, boundary)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
543 ind = grid.funcToMatrix(obj.grid, 1:prod(obj.m));
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
544 switch boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
545 case 'w'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
546 I = ind(1,:);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
547 case 'e'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
548 I = ind(end,:);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
549 case 's'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
550 I = ind(:,1)';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
551 case 'n'
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
552 I = ind(:,end)';
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
553 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
554 error('No such boundary: boundary = %s',boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
555 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
556 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
557
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
558 % Returns borrowing constant gamma
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
559 % boundary -- string
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
560 function [theta_H, theta_M, theta_R] = getBoundaryBorrowing(obj, boundary)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
561 switch boundary
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
562 case {'w','e'}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
563 theta_H = obj.theta_H_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
564 theta_M = obj.theta_M_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
565 theta_R = obj.theta_R_u;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
566 case {'s','n'}
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
567 theta_H = obj.theta_H_v;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
568 theta_M = obj.theta_M_v;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
569 theta_R = obj.theta_R_v;
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
570 otherwise
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
571 error('No such boundary: boundary = %s',boundary);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
572 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
573 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
574
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
575 function N = size(obj)
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
576 N = prod(obj.m);
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
577 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
578 end
c2bd7f15da48 Add scheme where only corner points are multiplied by dim. Does not seem to decrease spectral radius much, but is stable.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
579 end