annotate +scheme/LaplaceCurvilinearMin.m @ 1210:5e7692ed7c7c feature/laplace_curvilinear_test

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