annotate +scheme/LaplaceCurvilinear.m @ 1115:0e5dc5dfa559 feature/laplace_curvilinear_test

Temporary ugly fix for reversing direction of boundary in interface coupling
author Martin Almquist <malmquist@stanford.edu>
date Mon, 29 Apr 2019 12:55:51 -0700
parents 9ddd2e89d018
children 0aed89043ad6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
450
8d455e49364f Copy Wave2dCurve to new scheme LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents: 449
diff changeset
1 classdef LaplaceCurvilinear < scheme.Scheme
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
2 properties
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
3 m % Number of points in each direction, possibly a vector
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
4 h % Grid spacing
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
5 dim % Number of spatial dimensions
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
6
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
7 grid
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
8
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
9 order % Order of accuracy for the approximation
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
10
552
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
11 a,b % Parameters of the operator
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
12
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
13
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
14 % Inner products and operators for physical coordinates
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
15 D % Laplace operator
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
16 H, Hi % Inner product
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
17 e_w, e_e, e_s, e_n
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
18 d_w, d_e, d_s, d_n % Normal derivatives at the boundary
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
19 H_w, H_e, H_s, H_n % Boundary inner products
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
20 Dx, Dy % Physical derivatives
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
21 M % Gradient inner product
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
22
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
23 % Metric coefficients
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
24 J, Ji
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
25 a11, a12, a22
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
26 K
552
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
27 x_u
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
28 x_v
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
29 y_u
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
30 y_v
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
31 s_w, s_e, s_s, s_n % Boundary integral scale factors
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
32
552
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
33 % Inner product and operators for logical coordinates
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
34 H_u, H_v % Norms in the x and y directions
552
ffaf13533c27 Reorganize properties of the class
Jonatan Werpers <jonatan@werpers.com>
parents: 551
diff changeset
35 Hi_u, Hi_v
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
36 Hu,Hv % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
37 Hiu, Hiv
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
38 du_w, dv_w
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
39 du_e, dv_e
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
40 du_s, dv_s
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
41 du_n, dv_n
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
42
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
43 % Borrowing constants
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
44 theta_M_u, theta_M_v
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
45 theta_R_u, theta_R_v
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
46 theta_H_u, theta_H_v
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
47
1087
867307f4d80f Improve comments in LaplCurve.
Martin Almquist <malmquist@stanford.edu>
parents: 1086
diff changeset
48 % Temporary, only used for nonconforming interfaces but should be removed.
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
49 lambda
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
50 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
51
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
52 methods
452
56eb7c088bd4 Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents: 450
diff changeset
53 % Implements a*div(b*grad(u)) as a SBP scheme
539
08b6281ba2a9 Add some todos
Jonatan Werpers <jonatan@werpers.com>
parents: 452
diff changeset
54 % TODO: Implement proper H, it should be the real physical quadrature, the logic quadrature may be but in a separate variable (H_logic?)
08b6281ba2a9 Add some todos
Jonatan Werpers <jonatan@werpers.com>
parents: 452
diff changeset
55
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
56 function obj = LaplaceCurvilinear(g, order, a, b, opSet)
303
f18142c1530b Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents: 96
diff changeset
57 default_arg('opSet',@sbp.D2Variable);
452
56eb7c088bd4 Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents: 450
diff changeset
58 default_arg('a', 1);
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
59 default_arg('b', @(x,y) 0*x + 1);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
60
720
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
61 % assert(isa(g, 'grid.Curvilinear'))
743
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 720
diff changeset
62 if isa(a, 'function_handle')
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 720
diff changeset
63 a = grid.evalOn(g, a);
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 720
diff changeset
64 a = spdiag(a);
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 720
diff changeset
65 end
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
66
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
67 if isa(b, 'function_handle')
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
68 b = grid.evalOn(g, b);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
69 b = spdiag(b);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
70 end
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
71
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
72 % If b is scalar
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
73 if length(b) == 1
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
74 b = b*speye(g.N(), g.N());
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
75 end
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
76
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
77 dim = 2;
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
78 m = g.size();
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
79 m_u = m(1);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
80 m_v = m(2);
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
81 m_tot = g.N();
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
82
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
83 h = g.scaling();
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
84 h_u = h(1);
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
85 h_v = h(2);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
86
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
87
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
88 % 1D operators
303
f18142c1530b Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents: 96
diff changeset
89 ops_u = opSet(m_u, {0, 1}, order);
f18142c1530b Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents: 96
diff changeset
90 ops_v = opSet(m_v, {0, 1}, order);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
91
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
92 I_u = speye(m_u);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
93 I_v = speye(m_v);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
94
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
95 D1_u = ops_u.D1;
303
f18142c1530b Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents: 96
diff changeset
96 D2_u = ops_u.D2;
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
97 H_u = ops_u.H;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
98 Hi_u = ops_u.HI;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
99 e_l_u = ops_u.e_l;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
100 e_r_u = ops_u.e_r;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
101 d1_l_u = ops_u.d1_l;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
102 d1_r_u = ops_u.d1_r;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
103
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
104 D1_v = ops_v.D1;
303
f18142c1530b Fixed Wave2dCurve for new operators. Some cleanup in d2_variable_4.
Jonatan Werpers <jonatan@werpers.com>
parents: 96
diff changeset
105 D2_v = ops_v.D2;
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
106 H_v = ops_v.H;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
107 Hi_v = ops_v.HI;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
108 e_l_v = ops_v.e_l;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
109 e_r_v = ops_v.e_r;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
110 d1_l_v = ops_v.d1_l;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
111 d1_r_v = ops_v.d1_r;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
112
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
113
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
114 % Logical operators
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
115 Du = kr(D1_u,I_v);
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
116 Dv = kr(I_u,D1_v);
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
117 obj.Hu = kr(H_u,I_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
118 obj.Hv = kr(I_u,H_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
119 obj.Hiu = kr(Hi_u,I_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
120 obj.Hiv = kr(I_u,Hi_v);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
121
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
122 e_w = kr(e_l_u,I_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
123 e_e = kr(e_r_u,I_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
124 e_s = kr(I_u,e_l_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
125 e_n = kr(I_u,e_r_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
126 obj.du_w = kr(d1_l_u,I_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
127 obj.dv_w = (e_w'*Dv)';
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
128 obj.du_e = kr(d1_r_u,I_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
129 obj.dv_e = (e_e'*Dv)';
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
130 obj.du_s = (e_s'*Du)';
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
131 obj.dv_s = kr(I_u,d1_l_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
132 obj.du_n = (e_n'*Du)';
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
133 obj.dv_n = kr(I_u,d1_r_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
134
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
135
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
136 % Metric coefficients
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
137 coords = g.points();
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
138 x = coords(:,1);
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
139 y = coords(:,2);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
140
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
141 x_u = Du*x;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
142 x_v = Dv*x;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
143 y_u = Du*y;
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
144 y_v = Dv*y;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
145
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
146 J = x_u.*y_v - x_v.*y_u;
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
147 a11 = 1./J .* (x_v.^2 + y_v.^2);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
148 a12 = -1./J .* (x_u.*x_v + y_u.*y_v);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
149 a22 = 1./J .* (x_u.^2 + y_u.^2);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
150 lambda = 1/2 * (a11 + a22 - sqrt((a11-a22).^2 + 4*a12.^2));
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
151
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
152 K = cell(dim, dim);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
153 K{1,1} = spdiag(y_v./J);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
154 K{1,2} = spdiag(-y_u./J);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
155 K{2,1} = spdiag(-x_v./J);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
156 K{2,2} = spdiag(x_u./J);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
157 obj.K = K;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
158
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
159 obj.x_u = x_u;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
160 obj.x_v = x_v;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
161 obj.y_u = y_u;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
162 obj.y_v = y_v;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
163
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
164 % Assemble full operators
551
c5a7a13c03dc Switch to using spdiag instead of spdiags
Jonatan Werpers <jonatan@werpers.com>
parents: 539
diff changeset
165 L_12 = spdiag(a12);
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
166 Duv = Du*b*L_12*Dv;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
167 Dvu = Dv*b*L_12*Du;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
168
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
169 Duu = sparse(m_tot);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
170 Dvv = sparse(m_tot);
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
171 ind = grid.funcToMatrix(g, 1:m_tot);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
172
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
173 for i = 1:m_v
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
174 b_a11 = b*a11;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
175 D = D2_u(b_a11(ind(:,i)));
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
176 p = ind(:,i);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
177 Duu(p,p) = D;
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
178 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
179
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
180 for i = 1:m_u
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
181 b_a22 = b*a22;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
182 D = D2_v(b_a22(ind(i,:)));
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
183 p = ind(i,:);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
184 Dvv(p,p) = D;
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
185 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
186
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
187
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
188 % Physical operators
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
189 obj.J = spdiag(J);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
190 obj.Ji = spdiag(1./J);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
191
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
192 obj.D = obj.Ji*a*(Duu + Duv + Dvu + Dvv);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
193 obj.H = obj.J*kr(H_u,H_v);
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
194 obj.Hi = obj.Ji*kr(Hi_u,Hi_v);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
195
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
196 obj.e_w = e_w;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
197 obj.e_e = e_e;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
198 obj.e_s = e_s;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
199 obj.e_n = e_n;
376
b0e95c81943e removed the white space
Ylva Rydin <ylva.rydin@telia.com>
parents: 371
diff changeset
200
557
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
201 %% normal derivatives
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
202 I_w = ind(1,:);
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
203 I_e = ind(end,:);
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
204 I_s = ind(:,1);
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
205 I_n = ind(:,end);
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
206
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
207 a11_w = spdiag(a11(I_w));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
208 a12_w = spdiag(a12(I_w));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
209 a11_e = spdiag(a11(I_e));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
210 a12_e = spdiag(a12(I_e));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
211 a22_s = spdiag(a22(I_s));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
212 a12_s = spdiag(a12(I_s));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
213 a22_n = spdiag(a22(I_n));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
214 a12_n = spdiag(a12(I_n));
2a856a589510 Add creation of physical boundary normal derivatives
Jonatan Werpers <jonatan@werpers.com>
parents: 554
diff changeset
215
565
f4b0d0e84305 Add missing square
Jonatan Werpers <jonatan@werpers.com>
parents: 564
diff changeset
216 s_w = sqrt((e_w'*x_v).^2 + (e_w'*y_v).^2);
f4b0d0e84305 Add missing square
Jonatan Werpers <jonatan@werpers.com>
parents: 564
diff changeset
217 s_e = sqrt((e_e'*x_v).^2 + (e_e'*y_v).^2);
f4b0d0e84305 Add missing square
Jonatan Werpers <jonatan@werpers.com>
parents: 564
diff changeset
218 s_s = sqrt((e_s'*x_u).^2 + (e_s'*y_u).^2);
f4b0d0e84305 Add missing square
Jonatan Werpers <jonatan@werpers.com>
parents: 564
diff changeset
219 s_n = sqrt((e_n'*x_u).^2 + (e_n'*y_u).^2);
562
11d8d6ccbcd7 Add boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents: 561
diff changeset
220
566
9c98a0526afc Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents: 565
diff changeset
221 obj.d_w = -1*(spdiag(1./s_w)*(a11_w*obj.du_w' + a12_w*obj.dv_w'))';
9c98a0526afc Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents: 565
diff changeset
222 obj.d_e = (spdiag(1./s_e)*(a11_e*obj.du_e' + a12_e*obj.dv_e'))';
9c98a0526afc Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents: 565
diff changeset
223 obj.d_s = -1*(spdiag(1./s_s)*(a22_s*obj.dv_s' + a12_s*obj.du_s'))';
9c98a0526afc Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents: 565
diff changeset
224 obj.d_n = (spdiag(1./s_n)*(a22_n*obj.dv_n' + a12_n*obj.du_n'))';
554
6e71d4f8b155 Better names for the metric coefficients
Jonatan Werpers <jonatan@werpers.com>
parents: 553
diff changeset
225
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
226 obj.Dx = spdiag( y_v./J)*Du + spdiag(-y_u./J)*Dv;
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
227 obj.Dy = spdiag(-x_v./J)*Du + spdiag( x_u./J)*Dv;
384
32df00102268 Fix bug in Characteristic BC for Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents: 360
diff changeset
228
562
11d8d6ccbcd7 Add boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents: 561
diff changeset
229 %% Boundary inner products
564
9bf49338f8e6 Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents: 563
diff changeset
230 obj.H_w = H_v*spdiag(s_w);
9bf49338f8e6 Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents: 563
diff changeset
231 obj.H_e = H_v*spdiag(s_e);
9bf49338f8e6 Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents: 563
diff changeset
232 obj.H_s = H_u*spdiag(s_s);
9bf49338f8e6 Fix bug in creation of boundary inner products
Jonatan Werpers <jonatan@werpers.com>
parents: 563
diff changeset
233 obj.H_n = H_u*spdiag(s_n);
553
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
234
63d5c07943dd Reorder and restructure constructor
Jonatan Werpers <jonatan@werpers.com>
parents: 552
diff changeset
235 % Misc.
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
236 obj.m = m;
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
237 obj.h = [h_u h_v];
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
238 obj.order = order;
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
239 obj.grid = g;
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
240 obj.dim = dim;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
241
452
56eb7c088bd4 Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents: 450
diff changeset
242 obj.a = a;
56eb7c088bd4 Allow any coefficient in LaplaceCurvilinear
Jonatan Werpers <jonatan@werpers.com>
parents: 450
diff changeset
243 obj.b = b;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
244 obj.a11 = a11;
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
245 obj.a12 = a12;
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
246 obj.a22 = a22;
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
247 obj.s_w = spdiag(s_w);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
248 obj.s_e = spdiag(s_e);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
249 obj.s_s = spdiag(s_s);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
250 obj.s_n = spdiag(s_n);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
251
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
252 obj.theta_M_u = h_u*ops_u.borrowing.M.d1;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
253 obj.theta_M_v = h_v*ops_v.borrowing.M.d1;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
254
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
255 obj.theta_R_u = h_u*ops_u.borrowing.R.delta_D;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
256 obj.theta_R_v = h_v*ops_v.borrowing.R.delta_D;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
257
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
258 obj.theta_H_u = h_u*ops_u.borrowing.H11;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
259 obj.theta_H_v = h_v*ops_v.borrowing.H11;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
260
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
261 % Temporary
27
97a638f91fb8 Added function spdiag(). Fixed a bunch of bugs in the Wave2dCurve scheme.
Jonatan Werpers <jonatan@werpers.com>
parents: 5
diff changeset
262 obj.lambda = lambda;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
263 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
264
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
265
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
266 % Closure functions return the opertors applied to the own doamin to close the boundary
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
267 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
268 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
269 % type is a string specifying the type of boundary condition if there are several.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
270 % data is a function returning the data that should be applied at the boundary.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
271 % neighbour_scheme is an instance of Scheme that should be interfaced to.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
272 % neighbour_boundary is a string specifying which boundary to interface to.
347
85c2fe06d551 Implemented characteristic form BC in Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents: 337
diff changeset
273 function [closure, penalty] = boundary_condition(obj, boundary, type, parameter)
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
274 default_arg('type','neumann');
347
85c2fe06d551 Implemented characteristic form BC in Wave2dCurve.
Jonatan Werpers <jonatan@werpers.com>
parents: 337
diff changeset
275 default_arg('parameter', []);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
276
1108
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
277 e = obj.getBoundaryOperator('e', boundary);
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
278 d = obj.getBoundaryOperator('d', boundary);
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
279 H_b = obj.getBoundaryQuadrature(boundary);
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
280 s_b = obj.getBoundaryScaling(boundary);
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
281 [th_H, ~, th_R] = obj.getBoundaryBorrowing(boundary);
1108
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
282 m = obj.getBoundaryNumber(boundary);
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
283
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
284 K = obj.K;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
285 J = obj.J;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
286 Hi = obj.Hi;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
287 a = obj.a;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
288 b_b = e'*obj.b*e;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
289
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
290 switch type
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
291 % Dirichlet boundary condition
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
292 case {'D','d','dirichlet'}
1064
1341c6cea9c1 Set tuning to 1.0 in both old and new Dirichlet.
Martin Almquist <malmquist@stanford.edu>
parents: 997
diff changeset
293 tuning = 1.0;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
294
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
295 sigma = 0*b_b;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
296 for i = 1:obj.dim
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
297 sigma = sigma + e'*J*K{i,m}*K{i,m}*e;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
298 end
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
299 sigma = sigma/s_b;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
300 tau = tuning*(1/th_R + obj.dim/th_H)*sigma;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
301
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
302 closure = a*Hi*d*b_b*H_b*e' ...
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
303 -a*Hi*e*tau*b_b*H_b*e';
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
304
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
305 penalty = -a*Hi*d*b_b*H_b ...
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
306 +a*Hi*e*tau*b_b*H_b;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
307
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
308
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
309 % Neumann boundary condition. Note that the penalty is for du/dn and not b*du/dn.
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
310 case {'N','n','neumann'}
558
54c775c3348a Clean up use of the sign in boundary and interface routines
Jonatan Werpers <jonatan@werpers.com>
parents: 557
diff changeset
311 tau1 = -1;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
312 tau2 = 0;
566
9c98a0526afc Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents: 565
diff changeset
313 tau = (tau1*e + tau2*d)*H_b;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
314
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
315 closure = a*Hi*tau*b_b*d';
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
316 penalty = -a*Hi*tau*b_b;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
317
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
318
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
319 % Unknown, boundary condition
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
320 otherwise
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
321 error('No such boundary condition: type = %s',type);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
322 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
323 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
324
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
325 % type Struct that specifies the interface coupling.
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
326 % Fields:
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
327 % -- tuning: penalty strength, defaults to 1.2
935
1bf200417957 Fix doc for LaplaceCurvilinear.interface
Jonatan Werpers <jonatan@werpers.com>
parents: 928
diff changeset
328 % -- interpolation: type of interpolation, default 'none'
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
329 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type)
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
330
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
331 % error('Not implemented')
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
332
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
333 defaultType.tuning = 1.0;
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
334 defaultType.interpolation = 'none';
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
335 default_struct('type', defaultType);
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
336
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
337 switch type.interpolation
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
338 case {'none', ''}
940
31186559236d Add forgotten type argument in call to interfaceStandard in Schrodinger2d and LaplCurv.
Martin Almquist <malmquist@stanford.edu>
parents: 938
diff changeset
339 [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type);
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
340 case {'op','OP'}
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
341 [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type);
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
342 otherwise
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
343 error('Unknown type of interpolation: %s ', type.interpolation);
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
344 end
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
345 end
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
346
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
347 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type)
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
348 tuning = type.tuning;
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
349
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
350 dim = obj.dim;
906
0499239496cf Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 904
diff changeset
351 % u denotes the solution in the own domain
0499239496cf Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 904
diff changeset
352 % v denotes the solution in the neighbour domain
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
353 u = obj;
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
354 v = neighbour_scheme;
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
355
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
356 % Boundary operators, u
1108
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
357 e_u = u.getBoundaryOperator('e', boundary);
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
358 d_u = u.getBoundaryOperator('d', boundary);
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
359 s_b_u = u.getBoundaryScaling(boundary);
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
360 [th_H_u, ~, th_R_u] = u.getBoundaryBorrowing(boundary);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
361 m_u = u.getBoundaryNumber(boundary);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
362
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
363 % Coefficients, u
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
364 K_u = u.K;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
365 J_u = u.J;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
366 b_b_u = e_u'*u.b*e_u;
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
367
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
368 % Boundary operators, v
1108
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
369 e_v = v.getBoundaryOperator('e', neighbour_boundary);
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
370 d_v = v.getBoundaryOperator('d', neighbour_boundary);
5ec23b9bf360 Merge with default
Martin Almquist <malmquist@stanford.edu>
parents: 1087 1051
diff changeset
371 s_b_v = v.getBoundaryScaling(neighbour_boundary);
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
372 [th_H_v, ~, th_R_v] = v.getBoundaryBorrowing(neighbour_boundary);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
373 m_v = v.getBoundaryNumber(neighbour_boundary);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
374
1115
0e5dc5dfa559 Temporary ugly fix for reversing direction of boundary in interface coupling
Martin Almquist <malmquist@stanford.edu>
parents: 1110
diff changeset
375 % BUGFIX?!?!?
0e5dc5dfa559 Temporary ugly fix for reversing direction of boundary in interface coupling
Martin Almquist <malmquist@stanford.edu>
parents: 1110
diff changeset
376 if (strcmp(boundary,'s') && strcmp(neighbour_boundary,'e')) || (strcmp(boundary,'e') && strcmp(neighbour_boundary,'s'))
0e5dc5dfa559 Temporary ugly fix for reversing direction of boundary in interface coupling
Martin Almquist <malmquist@stanford.edu>
parents: 1110
diff changeset
377 e_v = fliplr(e_v);
0e5dc5dfa559 Temporary ugly fix for reversing direction of boundary in interface coupling
Martin Almquist <malmquist@stanford.edu>
parents: 1110
diff changeset
378 d_v = fliplr(d_v);
0e5dc5dfa559 Temporary ugly fix for reversing direction of boundary in interface coupling
Martin Almquist <malmquist@stanford.edu>
parents: 1110
diff changeset
379 s_b_v = rot90(s_b_v,2);
0e5dc5dfa559 Temporary ugly fix for reversing direction of boundary in interface coupling
Martin Almquist <malmquist@stanford.edu>
parents: 1110
diff changeset
380 end
0e5dc5dfa559 Temporary ugly fix for reversing direction of boundary in interface coupling
Martin Almquist <malmquist@stanford.edu>
parents: 1110
diff changeset
381
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
382 % Coefficients, v
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
383 K_v = v.K;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
384 J_v = v.J;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
385 b_b_v = e_v'*v.b*e_v;
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
386
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
387 %--- Penalty strength tau -------------
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
388 sigma_u = 0*b_b_u;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
389 sigma_v = 0*b_b_v;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
390 for i = 1:obj.dim
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
391 sigma_u = sigma_u + e_u'*J_u*K_u{i,m_u}*K_u{i,m_u}*e_u;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
392 sigma_v = sigma_v + e_v'*J_v*K_v{i,m_v}*K_v{i,m_v}*e_v;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
393 end
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
394 sigma_u = sigma_u/s_b_u;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
395 sigma_v = sigma_v/s_b_v;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
396
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
397 tau_R_u = 1/th_R_u*sigma_u;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
398 tau_R_v = 1/th_R_v*sigma_v;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
399
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
400 tau_H_u = dim*1/th_H_u*sigma_u;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
401 tau_H_v = dim*1/th_H_v*sigma_v;
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
402
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
403 tau = 1/4*tuning*(b_b_u*(tau_R_u + tau_H_u) + b_b_v*(tau_R_v + tau_H_v));
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
404 %--------------------------------------
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
405
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
406 % Operators/coefficients that are only required from this side
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
407 Hi = u.Hi;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
408 H_b = u.getBoundaryQuadrature(boundary);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
409 a = u.a;
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
410
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
411 closure = 1/2*a*Hi*d_u*b_b_u*H_b*e_u' ...
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
412 -1/2*a*Hi*e_u*H_b*b_b_u*d_u' ...
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
413 -a*Hi*e_u*tau*H_b*e_u';
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
414
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
415 penalty = -1/2*a*Hi*d_u*b_b_u*H_b*e_v' ...
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
416 -1/2*a*Hi*e_u*H_b*b_b_v*d_v' ...
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
417 +a*Hi*e_u*tau*H_b*e_v';
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
418 end
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
419
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
420 function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type)
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
421
921
19c05eefc8c6 Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
422 % TODO: Make this work for curvilinear grids
19c05eefc8c6 Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
423 warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.');
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
424 warning('LaplaceCurvilinear: Non-conforming interface uses Virtas penalty strength');
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
425 warning('LaplaceCurvilinear: Non-conforming interface assumes that b is constant');
921
19c05eefc8c6 Add warning that interfaceNonConforming in LaplaceCurve only works for Cartesian grids.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
426
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
427 % User can request special interpolation operators by specifying type.interpOpSet
928
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
428 default_field(type, 'interpOpSet', @sbp.InterpOpsOP);
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
429 interpOpSet = type.interpOpSet;
1c61d8fa9903 Replace opts by type everywhere
Martin Almquist <malmquist@stanford.edu>
parents: 927
diff changeset
430 tuning = type.tuning;
904
14b093a344eb Outline new interface method in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
431
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
432
906
0499239496cf Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 904
diff changeset
433 % u denotes the solution in the own domain
0499239496cf Remove property interpolation_type in LaplaceCurvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 904
diff changeset
434 % v denotes the solution in the neighbour domain
1110
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
435 e_u = obj.getBoundaryOperator('e', boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
436 d_u = obj.getBoundaryOperator('d', boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
437 H_b_u = obj.getBoundaryQuadrature(boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
438 I_u = obj.getBoundaryIndices(boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
439 [~, gamm_u] = obj.getBoundaryBorrowing(boundary);
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
440
1110
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
441 e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
442 d_v = neighbour_scheme.getBoundaryOperator('d', neighbour_boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
443 H_b_v = neighbour_scheme.getBoundaryQuadrature(neighbour_boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
444 I_v = neighbour_scheme.getBoundaryIndices(neighbour_boundary);
9ddd2e89d018 Bugfix in interfaceNonconforming(). Remove unused properties gamm_u, gamm_v.
Martin Almquist <malmquist@stanford.edu>
parents: 1109
diff changeset
445 [~, gamm_v] = neighbour_scheme.getBoundaryBorrowing(neighbour_boundary);
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
446
720
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
447
938
97291e1bd57c Make LaplCurv send only number of grid points to InterpOpsXX. Remove coordinates from get_boundary_ops method.
Martin Almquist <malmquist@stanford.edu>
parents: 936
diff changeset
448 % Find the number of grid points along the interface
97291e1bd57c Make LaplCurv send only number of grid points to InterpOpsXX. Remove coordinates from get_boundary_ops method.
Martin Almquist <malmquist@stanford.edu>
parents: 936
diff changeset
449 m_u = size(e_u, 2);
97291e1bd57c Make LaplCurv send only number of grid points to InterpOpsXX. Remove coordinates from get_boundary_ops method.
Martin Almquist <malmquist@stanford.edu>
parents: 936
diff changeset
450 m_v = size(e_v, 2);
922
1d91c2a8aada Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents: 921
diff changeset
451
720
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
452 Hi = obj.Hi;
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
453 a = obj.a;
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
454
5
5f6b0b6a012b First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents: 0
diff changeset
455 u = obj;
5f6b0b6a012b First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents: 0
diff changeset
456 v = neighbour_scheme;
5f6b0b6a012b First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents: 0
diff changeset
457
85
643bc513b8b8 Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents: 83
diff changeset
458 b1_u = gamm_u*u.lambda(I_u)./u.a11(I_u).^2;
643bc513b8b8 Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents: 83
diff changeset
459 b2_u = gamm_u*u.lambda(I_u)./u.a22(I_u).^2;
643bc513b8b8 Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents: 83
diff changeset
460 b1_v = gamm_v*v.lambda(I_v)./v.a11(I_v).^2;
643bc513b8b8 Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents: 83
diff changeset
461 b2_v = gamm_v*v.lambda(I_v)./v.a22(I_v).^2;
5
5f6b0b6a012b First try at interface implementation in WaveCurve2s
Jonatan Werpers <jonatan@werpers.com>
parents: 0
diff changeset
462
720
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
463 tau_u = -1./(4*b1_u) -1./(4*b2_u);
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
464 tau_v = -1./(4*b1_v) -1./(4*b2_v);
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
465
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
466 tau_u = tuning * spdiag(tau_u);
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
467 tau_v = tuning * spdiag(tau_v);
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
468 beta_u = tau_v;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
469
922
1d91c2a8aada Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents: 921
diff changeset
470 % Build interpolation operators
938
97291e1bd57c Make LaplCurv send only number of grid points to InterpOpsXX. Remove coordinates from get_boundary_ops method.
Martin Almquist <malmquist@stanford.edu>
parents: 936
diff changeset
471 intOps = interpOpSet(m_u, m_v, obj.order, neighbour_scheme.order);
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
472 Iu2v = intOps.Iu2v;
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
473 Iv2u = intOps.Iv2u;
922
1d91c2a8aada Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents: 921
diff changeset
474
720
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
475 closure = a*Hi*e_u*tau_u*H_b_u*e_u' + ...
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
476 a*Hi*e_u*H_b_u*Iv2u.bad*beta_u*Iu2v.good*e_u' + ...
720
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
477 a*1/2*Hi*d_u*H_b_u*e_u' + ...
07f8311374c6 Add interpolation to LaplaceCurveilinear.
Martin Almquist <malmquist@stanford.edu>
parents: 567
diff changeset
478 -a*1/2*Hi*e_u*H_b_u*d_u';
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
479
927
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
480 penalty = -a*Hi*e_u*tau_u*H_b_u*Iv2u.good*e_v' + ...
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
481 -a*Hi*e_u*H_b_u*Iv2u.bad*beta_u*e_v' + ...
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
482 -a*1/2*Hi*d_u*H_b_u*Iv2u.good*e_v' + ...
4291731570bb Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
Martin Almquist <malmquist@stanford.edu>
parents: 925
diff changeset
483 -a*1/2*Hi*e_u*H_b_u*Iv2u.bad*d_v';
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
484
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
485 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
486
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
487 % Returns the boundary operator op for the boundary specified by the string boundary.
1045
dc1bcbef2a86 Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents: 1042
diff changeset
488 % op -- string
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
489 % boundary -- string
1045
dc1bcbef2a86 Remove ability to get several boundary ops at the same time from a few of the schemes
Jonatan Werpers <jonatan@werpers.com>
parents: 1042
diff changeset
490 function o = getBoundaryOperator(obj, op, boundary)
1046
19ed046aec52 Clean up getBoundaryOps for a few schemes
Jonatan Werpers <jonatan@werpers.com>
parents: 1045
diff changeset
491 assertIsMember(op, {'e', 'd'})
1042
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
492 assertIsMember(boundary, {'w', 'e', 's', 'n'})
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
493
1046
19ed046aec52 Clean up getBoundaryOps for a few schemes
Jonatan Werpers <jonatan@werpers.com>
parents: 1045
diff changeset
494 o = obj.([op, '_', boundary]);
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
495 end
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
496
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
497 % Returns square boundary quadrature matrix, of dimension
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
498 % corresponding to the number of boundary points
85
643bc513b8b8 Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents: 83
diff changeset
499 %
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
500 % boundary -- string
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
501 function H_b = getBoundaryQuadrature(obj, boundary)
1042
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
502 assertIsMember(boundary, {'w', 'e', 's', 'n'})
85
643bc513b8b8 Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents: 83
diff changeset
503
1051
84200bbae101 Bugfix: add missing brackets in getBoundaryQuadrature in LaplCurv and Utux2d
Martin Almquist <malmquist@stanford.edu>
parents: 1047
diff changeset
504 H_b = obj.(['H_', boundary]);
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
505 end
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
506
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
507 % Returns square boundary quadrature scaling matrix, of dimension
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
508 % corresponding to the number of boundary points
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
509 %
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
510 % boundary -- string
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
511 function s_b = getBoundaryScaling(obj, boundary)
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
512 assertIsMember(boundary, {'w', 'e', 's', 'n'})
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
513
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
514 s_b = obj.(['s_', boundary]);
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
515 end
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
516
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
517 % Returns the coordinate number corresponding to the boundary
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
518 %
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
519 % boundary -- string
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
520 function m = getBoundaryNumber(obj, boundary)
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
521 assertIsMember(boundary, {'w', 'e', 's', 'n'})
85
643bc513b8b8 Wave2DCurve: Fixed error in tau. Also made random guess at fixing theory from paper.
Jonatan Werpers <jonatan@werpers.com>
parents: 83
diff changeset
522
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
523 switch boundary
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
524 case {'w', 'e'}
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
525 m = 1;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
526 case {'s', 'n'}
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
527 m = 2;
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
528 end
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
529 end
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
530
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
531 % Returns the indices of the boundary points in the grid matrix
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
532 % boundary -- string
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
533 function I = getBoundaryIndices(obj, boundary)
1042
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
534 assertIsMember(boundary, {'w', 'e', 's', 'n'})
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
535
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
536 ind = grid.funcToMatrix(obj.grid, 1:prod(obj.m));
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
537 switch boundary
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
538 case 'w'
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
539 I = ind(1,:);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
540 case 'e'
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
541 I = ind(end,:);
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
542 case 's'
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
543 I = ind(:,1)';
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
544 case 'n'
337
e070ebd94d9d Updated Wave2dCurve to use the new grid classes.
Jonatan Werpers <jonatan@werpers.com>
parents: 303
diff changeset
545 I = ind(:,end)';
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
546 end
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
547 end
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
548
982
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
549 % Returns borrowing constant gamma
a0b3161e44f3 Add the following methods in LaplaceCurvilinear: getBoundaryOperator, getBoundaryQuadrature, getBoundaryBorrowing. Remove get_boundary_ops. Make interface and boundary_condition methods use the new methods.
Martin Almquist <malmquist@stanford.edu>
parents: 946
diff changeset
550 % boundary -- string
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
551 function [theta_H, theta_M, theta_R] = getBoundaryBorrowing(obj, boundary)
1042
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
552 assertIsMember(boundary, {'w', 'e', 's', 'n'})
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
553
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
554 switch boundary
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
555 case {'w','e'}
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
556 theta_H = obj.theta_H_u;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
557 theta_M = obj.theta_M_u;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
558 theta_R = obj.theta_R_u;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
559 case {'s','n'}
1086
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
560 theta_H = obj.theta_H_v;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
561 theta_M = obj.theta_M_v;
90c23fd08f59 Make LaplaceCurvilinearNew the default version and remove the others
Martin Almquist <malmquist@stanford.edu>
parents: 1064
diff changeset
562 theta_R = obj.theta_R_v;
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
563 end
922
1d91c2a8aada Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents: 921
diff changeset
564 end
1d91c2a8aada Refactor LaplCurv.interfaceNonConf. Add method for interpolation operator generation in LaplCurv
Martin Almquist <malmquist@stanford.edu>
parents: 921
diff changeset
565
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
566 function N = size(obj)
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
567 N = prod(obj.m);
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
568 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
569 end
566
9c98a0526afc Switch implementation of boundary and interface to SBP notation
Jonatan Werpers <jonatan@werpers.com>
parents: 565
diff changeset
570 end