annotate +scheme/LaplaceCurvilinearNewCorner.m @ 1067:9a858436f8fa feature/laplace_curvilinear_test

Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
author Martin Almquist <malmquist@stanford.edu>
date Tue, 22 Jan 2019 18:17:01 -0800
parents d64062bed5fb
children e0ecce90f8cf
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
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
48 % Temporary
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
49 lambda
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
50 gamm_u, gamm_v
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
51
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
52 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
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 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
55 % 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
56 % 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
57
c2bd7f15da48 Add scheme where only corner 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 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
59 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
60 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
61 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
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 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
64 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
65 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
66
c2bd7f15da48 Add scheme where only corner 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 % 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
68 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
69 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
70 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
71 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
72
c2bd7f15da48 Add scheme where only corner 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 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
74 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
75 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
76 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
77 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
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 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
80 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
81 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
82
c2bd7f15da48 Add scheme where only corner 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 % 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
85 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
86 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
87
c2bd7f15da48 Add scheme where only corner 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 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
89 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
90
c2bd7f15da48 Add scheme where only corner 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 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
92 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
93 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
94 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
95 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
96 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
97 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
98 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
99
c2bd7f15da48 Add scheme where only corner 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 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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108
c2bd7f15da48 Add scheme where only corner 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
c2bd7f15da48 Add scheme where only corner 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 % 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
111 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
112 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
113 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
114 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
115 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
116 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
117
c2bd7f15da48 Add scheme where only corner 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 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
119 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
120 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
121 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
122 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
123 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
124 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
125 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
126 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
127 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
128 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
129 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
130
c2bd7f15da48 Add scheme where only corner 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
c2bd7f15da48 Add scheme where only corner 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 % 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
133 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
134 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
135 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
136
c2bd7f15da48 Add scheme where only corner 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 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
138 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
139 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
140 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
141
c2bd7f15da48 Add scheme where only corner 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 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
143 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
144 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
145 a22 = 1./J .* (x_u.^2 + y_u.^2);
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
146 lambda = 1/2 * (a11 + a22 - sqrt((a11-a22).^2 + 4*a12.^2));
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
147
c2bd7f15da48 Add scheme where only corner 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 = 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
149 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
150 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
151 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
152 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
153 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
154
c2bd7f15da48 Add scheme where only corner 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 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
156 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
157 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
158 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
159
c2bd7f15da48 Add scheme where only corner 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 % 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
161 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
162 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
163 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
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 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
166 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
167 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
168
c2bd7f15da48 Add scheme where only corner 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 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
170 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
171 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
172 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
173 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
174
c2bd7f15da48 Add scheme where only corner 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 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
176 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
177 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
178 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
179 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
180
c2bd7f15da48 Add scheme where only corner 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 % 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
183 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
184 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
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.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
187 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
188 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
189
c2bd7f15da48 Add scheme where only corner 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 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
191 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
192 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
193 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
194
c2bd7f15da48 Add scheme where only corner 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 %% 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
196 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
197 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
198 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
199 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
200
c2bd7f15da48 Add scheme where only corner 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 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
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209
c2bd7f15da48 Add scheme where only corner 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 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
211 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
212 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
213 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
214
c2bd7f15da48 Add scheme where only corner 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 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
216 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
217 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
218 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
219
c2bd7f15da48 Add scheme where only corner 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.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
221 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
222
c2bd7f15da48 Add scheme where only corner 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 %% 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
224 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
225 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
226 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
227 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
228
c2bd7f15da48 Add scheme where only corner 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 % 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
230 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
231 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
232 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
233 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
234 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
235
c2bd7f15da48 Add scheme where only corner 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.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
237 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
238 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
239 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
240 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
241 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
242 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
243 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
244 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
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_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
247 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
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_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
250 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
251
c2bd7f15da48 Add scheme where only corner 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 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
253 obj.theta_H_v = h_v*ops_v.borrowing.H11;
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
254
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
255 % Temporary
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
256 obj.lambda = lambda;
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
257 obj.gamm_u = h_u*ops_u.borrowing.M.d1;
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
258 obj.gamm_v = h_v*ops_v.borrowing.M.d1;
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
259 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
260
c2bd7f15da48 Add scheme where only corner 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
c2bd7f15da48 Add scheme where only corner 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 % 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
263 % 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
264 % 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
265 % 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
266 % 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
267 % 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
268 % 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
269 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
270 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
271 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
272
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
273 e = obj.getBoundaryOperator('e', boundary);
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
274 d = obj.getBoundaryOperator('d', boundary);
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
275 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
276 s_b = obj.getBoundaryScaling(boundary);
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
277 [th_H, ~, th_R] = obj.getBoundaryBorrowing(boundary);
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
278 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
279
c2bd7f15da48 Add scheme where only corner 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 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
281 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
282 Hi = obj.Hi;
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
283 a = obj.a;
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
284
c2bd7f15da48 Add scheme where only corner 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 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
286 % 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
287 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
288 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
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 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
291 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
292 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
293 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
294 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
295 % 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
296
c2bd7f15da48 Add scheme where only corner 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 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
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 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
300 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
301 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
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 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
304
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
305 closure = a*Hi*d*H_b*e' ...
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
306 -a*Hi*e*tau*H_b*e';
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
307
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
308 penalty = -a*Hi*d*H_b ...
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
309 +a*Hi*e*tau*H_b;
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
310
c2bd7f15da48 Add scheme where only corner 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 % 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
313 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
314 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
315 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
316 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
317
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
318 closure = a*Hi*tau*d';
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
319 penalty = -a*Hi*tau;
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
320
c2bd7f15da48 Add scheme where only corner 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
c2bd7f15da48 Add scheme where only corner 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 % 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
323 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
324 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
325 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
326 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
327
c2bd7f15da48 Add scheme where only corner 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 % 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
329 % 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
330 % -- 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
331 % -- 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
332 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
333
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
334 % error('Not implemented')
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
335
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
336 defaultType.tuning = 1.0;
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
337 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
338 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
339
c2bd7f15da48 Add scheme where only corner 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 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
341 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
342 [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
343 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
344 [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
345 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
346 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
347 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
348 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
349
c2bd7f15da48 Add scheme where only corner 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 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
351 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
352
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
353 dim = obj.dim;
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
354 % 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
355 % 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
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
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
359 % Boundary operators, u
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
360 e_u = u.getBoundaryOperator('e', boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
361 d_u = u.getBoundaryOperator('d', boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
362 gamm_u = u.getBoundaryBorrowing(boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
363 s_b_u = u.getBoundaryScaling(boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
364 [th_H_u, ~, th_R_u] = u.getBoundaryBorrowing(boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
365 m_u = u.getBoundaryNumber(boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
366
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
367 % Coefficients, u
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
368 K_u = u.K;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
369 J_u = u.J;
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
370
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
371 % Boundary operators, v
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
372 e_v = v.getBoundaryOperator('e', neighbour_boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
373 d_v = v.getBoundaryOperator('d', neighbour_boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
374 gamm_v = v.getBoundaryBorrowing(neighbour_boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
375 s_b_v = v.getBoundaryScaling(neighbour_boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
376 [th_H_v, ~, th_R_v] = v.getBoundaryBorrowing(neighbour_boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
377 m_v = v.getBoundaryNumber(neighbour_boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
378
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
379 % Coefficients, v
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
380 K_v = v.K;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
381 J_v = v.J;
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
382
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
383 %--- Penalty strength tau -------------
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
384 sigma_u = 0;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
385 sigma_v = 0;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
386 for i = 1:obj.dim
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
387 sigma_u = sigma_u + e_u'*J_u*K_u{i,m_u}*K_u{i,m_u}*e_u;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
388 sigma_v = sigma_v + e_v'*J_v*K_v{i,m_v}*K_v{i,m_v}*e_v;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
389 end
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
390 sigma_u = sigma_u/s_b_u;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
391 sigma_v = sigma_v/s_b_v;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
392
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
393 tau_R_u = 1/th_R_u*sigma_u;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
394 tau_R_v = 1/th_R_v*sigma_v;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
395
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
396 tau_H_u = 1/th_H_u*sigma_u;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
397 tau_H_u(1,1) = dim*tau_H_u(1,1);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
398 tau_H_u(end,end) = dim*tau_H_u(end,end);
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
399
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
400 tau_H_v = 1/th_H_v*sigma_v;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
401 tau_H_v(1,1) = dim*tau_H_v(1,1);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
402 tau_H_v(end,end) = dim*tau_H_v(end,end);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
403
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
404 tau = 1/4*tuning*(tau_R_u + tau_H_u + tau_R_v + tau_H_v);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
405 %--------------------------------------
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
406
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
407 % Operators/coefficients that are only required from this side
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
408 Hi = u.Hi;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
409 H_b = u.getBoundaryQuadrature(boundary);
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
410 a = u.a;
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
411
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
412 closure = 1/2*a*Hi*d_u*H_b*e_u' ...
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
413 -1/2*a*Hi*e_u*H_b*d_u' ...
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
414 -a*Hi*e_u*tau*H_b*e_u';
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
415
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
416 penalty = -1/2*a*Hi*d_u*H_b*e_v' ...
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
417 -1/2*a*Hi*e_u*H_b*d_v' ...
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
418 +a*Hi*e_u*tau*H_b*e_v';
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
419 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
420
c2bd7f15da48 Add scheme where only corner 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 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
422
c2bd7f15da48 Add scheme where only corner 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 % 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
424 warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.');
1067
9a858436f8fa Implement new penalty strength for interface. Bugfix missing coeff a in Dirichlet penalty.
Martin Almquist <malmquist@stanford.edu>
parents: 1066
diff changeset
425 warning('LaplaceCurvilinear: Non-conforming interface uses Virtas penalty strength');
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
426
c2bd7f15da48 Add scheme where only corner 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 % 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
428 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
429 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
430 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
431
c2bd7f15da48 Add scheme where only corner 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
c2bd7f15da48 Add scheme where only corner 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 % 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
434 % v denotes the solution in the neighbour domain
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
435 e_u = obj.getBoundaryOperator('e', boundary);
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
436 d_u = obj.getBoundaryOperator('d', boundary);
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
437 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
438 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
439 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
440
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
441 e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary);
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
442 d_v = neighbour_scheme.getBoundaryOperator('d', neighbour_boundary);
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
443 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
444 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
445 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
446
c2bd7f15da48 Add scheme where only corner 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
c2bd7f15da48 Add scheme where only corner 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 % 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
449 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
450 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
451
c2bd7f15da48 Add scheme where only corner 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 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
453 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
454
c2bd7f15da48 Add scheme where only corner 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 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
456 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
457
c2bd7f15da48 Add scheme where only corner 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 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
459 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
460 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
461 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
462
c2bd7f15da48 Add scheme where only corner 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 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
464 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
465
c2bd7f15da48 Add scheme where only corner 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 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
467 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
468 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
469
c2bd7f15da48 Add scheme where only corner 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 % 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
471 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
472 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
473 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
474
c2bd7f15da48 Add scheme where only corner 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 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
476 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
477 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
478 -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
479
c2bd7f15da48 Add scheme where only corner 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 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
481 -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
482 -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
483 -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
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 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
486
c2bd7f15da48 Add scheme where only corner 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 % Returns the boundary operator op for the boundary specified by the string boundary.
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
488 % op -- string
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
489 % boundary -- string
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
490 function o = getBoundaryOperator(obj, op, boundary)
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
491 assertIsMember(op, {'e', 'd'})
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
492 assertIsMember(boundary, {'w', 'e', 's', 'n'})
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
493
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
494 o = obj.([op, '_', boundary]);
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
495 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
496
c2bd7f15da48 Add scheme where only corner 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 % 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
498 % 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
499 %
c2bd7f15da48 Add scheme where only corner 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 % 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
501 function H_b = getBoundaryQuadrature(obj, boundary)
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
502 assertIsMember(boundary, {'w', 'e', 's', 'n'})
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
503
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
504 H_b = obj.(['H_', boundary]);
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
505 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
506
c2bd7f15da48 Add scheme where only corner 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 % 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
508 % 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
509 %
c2bd7f15da48 Add scheme where only corner 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 % 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
511 function s_b = getBoundaryScaling(obj, boundary)
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
512 assertIsMember(boundary, {'w', 'e', 's', 'n'})
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
513
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
514 s_b = obj.(['s_', boundary]);
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
515 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
516
c2bd7f15da48 Add scheme where only corner 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 % 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
518 %
c2bd7f15da48 Add scheme where only corner 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 % 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
520 function m = getBoundaryNumber(obj, boundary)
1066
d64062bed5fb Clean up getBoundarOperator/Quadrature as was done on feature/getBoundaryOp. Temporarily re-add lambda so that old interface method works.
Martin Almquist <malmquist@stanford.edu>
parents: 1065
diff changeset
521 assertIsMember(boundary, {'w', 'e', 's', 'n'})
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
522
c2bd7f15da48 Add scheme where only corner 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 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
524 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
525 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
526 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
527 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
528 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
529 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
530
c2bd7f15da48 Add scheme where only corner 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 % 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
532 % 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
533 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
534 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
535 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
536 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
537 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
538 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
539 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
540 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
541 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
542 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
543 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
544 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
545 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
546 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
547 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
548
c2bd7f15da48 Add scheme where only corner 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 % 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
550 % 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
551 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
552 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
553 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
554 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
555 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
556 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
557 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
558 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
559 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
560 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
561 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
562 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
563 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
564 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
565
c2bd7f15da48 Add scheme where only corner 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 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
567 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
568 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
569 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
570 end