Mercurial > repos > public > sbplib
annotate +scheme/LaplaceCurvilinearMin.m @ 1138:afd06a84b69c feature/laplace_curvilinear_test
Bugfixes in VirtaMin.interfaceStandard()
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Mon, 10 Jun 2019 14:39:14 +0200 |
parents | eee71789f13b |
children | 6bc93c091682 |
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 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
50 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
|
51 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
52 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
|
53 % 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
|
54 % 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
|
55 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
57 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
|
58 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
|
59 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
|
60 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
67 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
|
68 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
|
69 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
|
70 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
71 % 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
|
72 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
|
73 % 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
|
74 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
|
75 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
|
76 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
|
77 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
79 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
|
80 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
|
81 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
|
82 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
|
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 % 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
|
85 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
|
86 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
|
87 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
89 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
|
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 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
|
92 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
|
93 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 |
eee71789f13b
Add LaplaceCurvilinear schemes 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_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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 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
|
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 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
136 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
|
137 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
|
138 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
|
139 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
141 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
|
142 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
|
143 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
|
144 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
146 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
|
147 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
|
148 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
|
149 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
|
150 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
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 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
|
159 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
|
160 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
|
161 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
|
162 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
164 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
|
165 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
|
166 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
|
167 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
169 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
|
170 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
|
171 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
188 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
|
189 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
|
190 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
192 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
|
193 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
|
194 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
196 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
|
197 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
|
198 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
|
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 %% 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
216 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
|
217 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
|
218 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
|
219 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
221 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
|
222 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
|
223 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
|
224 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
226 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
|
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 %% 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
235 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
|
236 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
|
237 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
|
238 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
|
239 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
|
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 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 |
eee71789f13b
Add LaplaceCurvilinear schemes 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.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
|
252 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
|
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.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
|
255 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
|
256 |
eee71789f13b
Add LaplaceCurvilinear schemes 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.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
|
258 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
|
259 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
261 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
|
262 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
|
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 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
266 % 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
|
267 % 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
|
268 % 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
|
269 % 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
|
270 % 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
|
271 % 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
|
272 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
|
273 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
|
274 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
|
275 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
277 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
|
278 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
|
279 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
|
280 [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
|
281 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
|
282 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
284 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
|
285 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
|
286 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
|
287 b_b = e'*obj.b*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
|
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 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
|
290 % 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
|
291 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
|
292 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
|
293 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 sigma = 0*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
|
295 for i = 1: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
|
296 sigma = sigma + e'*J*K{i,m}*K{i,m}*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
|
297 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
|
298 sigma = sigma/s_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
|
299 tau = tuning*(1/th_R + obj.dim/th_H)*sigma; |
eee71789f13b
Add LaplaceCurvilinear schemes 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 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
301 closure = a*Hi*d*b_b*H_b*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
|
302 -a*Hi*e*tau*b_b*H_b*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
|
303 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 penalty = -a*Hi*d*b_b*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
|
305 +a*Hi*e*tau*b_b*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
|
306 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
308 % 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
|
309 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
|
310 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
|
311 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
|
312 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
|
313 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
314 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
|
315 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
|
316 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
317 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
318 % 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
324 % 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
|
325 % 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
|
326 % -- 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
|
327 % -- 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
|
328 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
|
329 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
330 % 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
|
331 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
332 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
|
333 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
|
334 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
|
335 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
336 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
|
337 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
|
338 [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
|
339 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
|
340 [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
|
341 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
|
342 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
|
343 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
|
344 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
|
345 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
347 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
|
348 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
350 % 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
|
351 % 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
|
352 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
|
353 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
|
354 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
356 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
|
357 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
|
358 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
|
359 [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
|
360 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
|
361 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
363 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
|
364 J_u = 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
|
365 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
|
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 % 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
|
368 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
|
369 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
|
370 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
|
371 [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
|
372 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
|
373 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 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
|
380 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
382 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
|
383 J_v = 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
|
384 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
|
385 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 %--- Penalty strength tau ------------- |
eee71789f13b
Add LaplaceCurvilinear schemes 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 sigma_u = 0*b_b_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
|
388 sigma_v = 0*b_b_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
|
389 for i = 1: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
|
390 sigma_u = sigma_u + e_u'*J_u*K_u{i,m_u}*K_u{i,m_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
|
391 sigma_v = sigma_v + e_v'*J_v*K_v{i,m_v}*K_v{i,m_v}*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
|
392 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
|
393 sigma_u = sigma_u/s_b_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
|
394 sigma_v = sigma_v/s_b_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
|
395 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 tau_R_u = 1/th_R_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
|
397 tau_R_v = 1/th_R_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
|
398 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
400 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
|
401 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 tau = 1/4*tuning*(b_b_u*(tau_R_u + tau_H_u) + b_b_v*(tau_R_v + tau_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
|
403 %-------------------------------------- |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
406 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
|
407 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
|
408 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
|
409 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
411 -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
|
412 -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
|
413 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
415 -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
|
416 +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
|
417 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
|
418 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
420 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
422 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
|
423 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
|
424 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
|
425 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
427 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
|
428 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
|
429 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
|
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 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
432 % 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
|
433 % 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 [~, 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
|
439 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
440 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
|
441 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
|
442 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
|
443 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
|
444 [~, 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
|
445 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
446 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
447 % 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
|
448 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
|
449 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
|
450 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
451 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
|
452 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
|
453 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
454 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
|
455 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
|
456 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
458 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
|
459 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
|
460 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
|
461 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
462 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
|
463 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
|
464 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
466 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
|
467 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
|
468 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
469 % 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
|
470 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
|
471 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
|
472 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
|
473 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 -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
|
478 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
479 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
|
480 -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
|
481 -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
|
482 -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
|
483 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
484 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
|
485 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
486 % 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
|
487 % 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
|
488 % 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
|
489 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
|
490 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
|
491 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
|
492 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
493 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
|
494 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
|
495 |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
496 % 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
|
497 % 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
|
498 % |
eee71789f13b
Add LaplaceCurvilinear schemes where the minimum check will be implemented. The Virta scheme will be used for comparison only.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
499 % 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
|
500 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
|
501 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
|
502 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
504 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
|
505 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
507 % 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
|
508 % |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
510 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
|
511 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
|
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 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
|
514 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
|
515 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
517 % |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
519 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
|
520 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
|
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 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
|
523 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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
531 % 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
|
532 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
|
533 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
|
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 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 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
|
546 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
|
547 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 % 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
|
549 % 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
|
550 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
|
551 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
|
552 |
eee71789f13b
Add LaplaceCurvilinear schemes 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 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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 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
|
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 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
|
566 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
|
567 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
|
568 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
|
569 end |