Mercurial > repos > public > sbplib
annotate +scheme/Schrodinger2dCurve.m~ @ 491:26125cfefe11 feature/quantumTriangles
Schrodinger 2d runs without exploding with fixed coordinates
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Fri, 10 Feb 2017 14:29:53 +0100 |
parents | |
children |
rev | line source |
---|---|
491
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
1 classdef Schrodinger2dCurve < scheme.Scheme |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
2 properties |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
3 m % Number of points in each direction, possibly a vector |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
4 h % Grid spacing |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
5 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
6 grid |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
7 xm, ym |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
8 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
9 order % Order accuracy for the approximation |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
10 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
11 D % non-stabalized scheme operator |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
12 M % Derivative norm |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
13 H % Discrete norm |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
14 Hi |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
15 H_u, H_v % Norms in the x and y directions |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
16 Hu,Hv % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir. |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
17 Hi_u, Hi_v |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
18 Hiu, Hiv |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
19 D1_v, D1_u |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
20 D2_v, D2_u |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
21 Du, Dv |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
22 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
23 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
24 e_w, e_e, e_s, e_n |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
25 du_w, dv_w |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
26 du_e, dv_e |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
27 du_s, dv_s |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
28 du_n, dv_n |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
29 g_1, g_2 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
30 c |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
31 a11, a12, a22 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
32 m_tot, m_u, m_v |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
33 p,p_tau |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
34 Ji |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
35 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
36 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
37 methods |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
38 function obj = Schrodinger2dCurve(g ,order, opSet,p,p_tau) |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
39 default_arg('opSet',@sbp.D2Variable); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
40 default_arg('c', 1); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
41 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
42 obj.p=p; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
43 obj.p_tau=p_tau; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
44 obj.c=1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
45 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
46 m = g.size(); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
47 obj.m_u = m(1); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
48 obj.m_v = m(2); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
49 obj.m_tot = g.N(); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
50 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
51 h = g.scaling(); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
52 h_u = h(1); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
53 h_v = h(2); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
54 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
55 % Operators |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
56 ops_u = opSet(obj.m_u, {0, 1}, order); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
57 ops_v = opSet(obj.m_v, {0, 1}, order); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
58 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
59 I_u = speye(obj.m_u); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
60 I_v = speye(obj.m_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
61 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
62 obj.D1_u = ops_u.D1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
63 obj.D2_u = ops_u.D2; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
64 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
65 H_u = ops_u.H; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
66 Hi_u = ops_u.HI; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
67 e_l_u = ops_u.e_l; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
68 e_r_u = ops_u.e_r; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
69 d1_l_u = ops_u.d1_l; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
70 d1_r_u = ops_u.d1_r; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
71 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
72 obj.D1_v = ops_v.D1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
73 obj.D2_v = ops_v.D2; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
74 H_v = ops_v.H; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
75 Hi_v = ops_v.HI; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
76 e_l_v = ops_v.e_l; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
77 e_r_v = ops_v.e_r; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
78 d1_l_v = ops_v.d1_l; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
79 d1_r_v = ops_v.d1_r; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
80 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
81 obj.Du = kr(obj.D1_u,I_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
82 obj.Dv = kr(I_u,obj.D1_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
83 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
84 obj.H = kr(H_u,H_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
85 obj.Hi = kr(Hi_u,Hi_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
86 obj.Hu = kr(H_u,I_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
87 obj.Hv = kr(I_u,H_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
88 obj.Hiu = kr(Hi_u,I_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
89 obj.Hiv = kr(I_u,Hi_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
90 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
91 obj.e_w = kr(e_l_u,I_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
92 obj.e_e = kr(e_r_u,I_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
93 obj.e_s = kr(I_u,e_l_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
94 obj.e_n = kr(I_u,e_r_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
95 obj.du_w = kr(d1_l_u,I_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
96 obj.dv_w = (obj.e_w'*obj.Dv)'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
97 obj.du_e = kr(d1_r_u,I_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
98 obj.dv_e = (obj.e_e'*obj.Dv)'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
99 obj.du_s = (obj.e_s'*obj.Du)'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
100 obj.dv_s = kr(I_u,d1_l_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
101 obj.du_n = (obj.e_n'*obj.Du)'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
102 obj.dv_n = kr(I_u,d1_r_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
103 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
104 % obj.x_u = x_u; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
105 % obj.x_v = x_v; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
106 % obj.y_u = y_u; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
107 % obj.y_v = y_v; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
108 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
109 obj.m = m; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
110 obj.h = [h_u h_v]; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
111 obj.order = order; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
112 obj.grid = g; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
113 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
114 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
115 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
116 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
117 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
118 function [D ]= d_fun(obj,t) |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
119 % Metric derivatives |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
120 ti = parametrization.Ti.points(obj.p.p1(t),obj.p.p2(t),obj.p.p3(t),obj.p.p4(t)); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
121 ti_tau = parametrization.Ti.points(obj.p_tau.p1(t),obj.p_tau.p2(t),obj.p_tau.p3(t),obj.p_tau.p4(t)); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
122 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
123 lcoords=points(obj.grid); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
124 [obj.xm,obj.ym]= ti.map(lcoords(1:obj.m_v:end,1),lcoords(1:obj.m_u,2)); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
125 [x_tau,y_tau]= ti_tau.map(lcoords(1:obj.m_v:end,1),lcoords(1:obj.m_u,2)); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
126 x = reshape(obj.xm,obj.m_tot,1); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
127 y = reshape(obj.ym,obj.m_tot,1); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
128 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
129 x_tau = reshape(x_tau,obj.m_tot,1); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
130 y_tau = reshape(y_tau,obj.m_tot,1); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
131 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
132 x_u = obj.Du*x; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
133 x_v = obj.Dv*x; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
134 y_u = obj.Du*y; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
135 y_v = obj.Dv*y; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
136 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
137 J = x_u.*y_v - x_v.*y_u; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
138 a11 = 1./J.* (x_v.^2 + y_v.^2); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
139 a12 = -1./J .* (x_u.*x_v + y_u.*y_v); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
140 a22 = 1./J .* (x_u.^2 + y_u.^2); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
141 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
142 obj.a11=a11; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
143 obj.a12=a12; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
144 obj.a22=a22; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
145 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
146 % Assemble full operators |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
147 L_12 = spdiags(a12, 0, obj.m_tot, obj.m_tot); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
148 Duv = obj.Du*L_12*obj.Dv; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
149 Dvu = obj.Dv*L_12*obj.Du; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
150 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
151 Duu = sparse(obj.m_tot); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
152 Dvv = sparse(obj.m_tot); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
153 ind = grid.funcToMatrix(obj.grid, 1:obj.m_tot); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
154 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
155 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
156 for i = 1:obj.m_v |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
157 D = obj.D2_u(a11(ind(:,i))); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
158 p = ind(:,i); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
159 Duu(p,p) = D; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
160 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
161 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
162 for i = 1:obj.m_u |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
163 D = obj.D2_v(a22(ind(i,:))); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
164 p = ind(i,:); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
165 Dvv(p,p) = D; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
166 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
167 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
168 Ji = spdiags(1./J, 0, obj.m_tot, obj.m_tot); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
169 obj.Ji=Ji; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
170 obj.g_1 = x_tau.*y_v-y_tau.*x_v; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
171 obj.g_2 = -x_tau.*y_u + y_tau.*x_u; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
172 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
173 %Add the flux splitting |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
174 D = Ji*(obj.g_1.*obj.Du + obj.g_2.*obj.Dv + 1i*obj.c^2*(Duu + Duv + Dvu + Dvv)); %% g_1' och g_2'? |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
175 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
176 % obj.gamm_u = h_u*ops_u.borrowing.M.d1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
177 % obj.gamm_v = h_v*ops_v.borrowing.M.d1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
178 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
179 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
180 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
181 % Closure functions return the opertors applied to the own doamin to close the boundary |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
182 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
183 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
184 % type is a string specifying the type of boundary condition if there are several. |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
185 % data is a function returning the data that should be applied at the boundary. |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
186 % neighbour_scheme is an instance of Scheme that should be interfaced to. |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
187 % neighbour_boundary is a string specifying which boundary to interface to. |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
188 function [closure, penalty] = boundary_condition(obj, boundary) |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
189 [e, d_n, d_t, coeff_t, s, halfnorm_inv_n, halfnorm_inv_t, halfnorm_t,g] = obj.get_boundary_ops(boundary); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
190 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
191 a_t = spdiag(coeff_t); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
192 F = (s * d_n' + s * a_t*d_t')'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
193 tau1 = 1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
194 a = spdiag(g); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
195 tau2 = (-1*s*a - abs(a))/4; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
196 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
197 penalty_parameter_1 = 1i*halfnorm_inv_n*halfnorm_inv_t*e*e'*F*halfnorm_t; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
198 penalty_parameter_2 = halfnorm_inv_n*e*tau2; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
199 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
200 closure = obj.Ji*obj.c^2 * penalty_parameter_1*e' +obj.Ji* penalty_parameter_2*e'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
201 % penalty = -obj.Ji*obj.c^2 * penalty_parameter_2; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
202 penalty=0; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
203 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
204 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
205 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
206 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
207 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
208 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
209 function [e, d_n, d_t, coeff_t, s, halfnorm_inv_n, halfnorm_inv_t, halfnorm_t,g, I] = get_boundary_ops(obj, boundary) |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
210 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
211 % gridMatrix = zeros(obj.m(2),obj.m(1)); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
212 % gridMatrix(:) = 1:numel(gridMatrix); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
213 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
214 ind = grid.funcToMatrix(obj.grid, 1:prod(obj.m)); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
215 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
216 switch boundary |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
217 case 'w' |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
218 e = obj.e_w; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
219 d_n = obj.du_w; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
220 d_t = obj.dv_w; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
221 s = -1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
222 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
223 I = ind(1,:); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
224 coeff_t = obj.a12(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
225 g=obj.g_1(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
226 case 'e' |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
227 e = obj.e_e; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
228 d_n = obj.du_e; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
229 d_t = obj.dv_e; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
230 s = 1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
231 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
232 I = ind(end,:); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
233 coeff_t = obj.a12(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
234 g=obj.g_1(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
235 case 's' |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
236 e = obj.e_s; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
237 d_n = obj.dv_s; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
238 d_t = obj.du_s; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
239 s = -1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
240 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
241 I = ind(:,1)'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
242 coeff_t = obj.a12(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
243 g=obj.g_2(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
244 case 'n' |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
245 e = obj.e_n; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
246 d_n = obj.dv_n; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
247 d_t = obj.du_n; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
248 s = 1; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
249 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
250 I = ind(:,end)'; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
251 coeff_t = obj.a12(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
252 g=obj.g_2(I); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
253 otherwise |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
254 error('No such boundary: boundary = %s',boundary); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
255 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
256 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
257 switch boundary |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
258 case {'w','e'} |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
259 halfnorm_inv_n = obj.Hiu; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
260 halfnorm_inv_t = obj.Hiv; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
261 halfnorm_t = obj.Hv; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
262 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
263 case {'s','n'} |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
264 halfnorm_inv_n = obj.Hiv; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
265 halfnorm_inv_t = obj.Hiu; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
266 halfnorm_t = obj.Hu; |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
267 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
268 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
269 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
270 function N = size(obj) |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
271 N = prod(obj.m); |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
272 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
273 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
274 |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
275 end |
26125cfefe11
Schrodinger 2d runs without exploding with fixed coordinates
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
276 end |