Mercurial > repos > public > sbplib
annotate +scheme/Hypsyst3d.m @ 1231:e1f9bedd64a9 feature/volcano
Add opSet to Hypsyst3d
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 18 Nov 2019 17:17:16 -0800 |
parents | ef08adea56c4 |
children | 10881b234f77 |
rev | line source |
---|---|
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
1 classdef Hypsyst3d < scheme.Scheme |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
2 properties |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
3 grid |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
4 Yx, Zx, Xy, Zy, Xz, Yz %Grid values for boundary surfaces |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
5 order % Order accuracy for the approximation |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
6 |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
7 nEquations |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
8 |
1226
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
9 D % non-stabilized scheme operator |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
10 A, B, C, E % Symbolic coefficient matrices |
350
5d5652fe826a
A commit before I try resolving the performance issues
Ylva Rydin <ylva.rydin@telia.com>
parents:
349
diff
changeset
|
11 Aevaluated,Bevaluated,Cevaluated, Eevaluated |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
12 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
13 H % Discrete norm |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
14 Hx, Hy, Hz % Norms in the x, y and z directions |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
15 Hxi,Hyi, Hzi % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir. |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
16 e_w, e_e, e_s, e_n, e_b, e_t |
1226
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
17 params % Parameters for the coefficient matrices |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
18 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
19 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
20 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
21 methods |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
22 % Solving Hyperbolic systems on the form u_t=-Au_x-Bu_y-Cu_z-Eu |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
23 function obj = Hypsyst3d(cartesianGrid, order, A, B, C, E, params, opSet) |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
24 assertType(cartesianGrid, 'grid.Cartesian'); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
25 default_arg('E', []) |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
26 default_arg('opSet', @sbp.D2Standard) |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
27 obj.grid = cartesianGrid; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
28 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
29 obj.A = A; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
30 obj.B = B; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
31 obj.C = C; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
32 obj.E = E; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
33 obj.params = params; |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
34 dim = obj.grid.d; |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
35 assert(dim == 3, 'Dimensions not correct') |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
36 points = obj.grid.points(); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
37 m = obj.grid.m; |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
38 for i = 1:dim |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
39 ops{i} = opSet(m(i),obj.grid.lim{i},order); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
40 x{i} = obj.grid.x{i}; |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
41 X{i} = points(:,i); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
42 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
43 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
44 obj.Yx = kr(x{2}, ones(m(3),1)); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
45 obj.Zx = kr(ones(m(2),1), x{3}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
46 obj.Xy = kr(x{1}, ones(m(3),1)); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
47 obj.Zy = kr(ones(m(1),1), x{3}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
48 obj.Xz = kr(x{1}, ones(m(2),1)); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
49 obj.Yz = kr(ones(m(3),1), x{2}); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
50 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
51 obj.Aevaluated = obj.evaluateCoefficientMatrix(A, X{:}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
52 obj.Bevaluated = obj.evaluateCoefficientMatrix(B, X{:}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
53 obj.Cevaluated = obj.evaluateCoefficientMatrix(C, X{:}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
54 obj.Eevaluated = obj.evaluateCoefficientMatrix(E, X{:}); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
55 |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
56 obj.nEquations = length(A(obj.params,0,0,0)); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
57 |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
58 I_n = speye(obj.nEquations); |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
59 I_x = speye(m(1)); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
60 I_y = speye(m(2)); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
61 I_z = speye(m(3)); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
62 I_N = kr(I_n,I_x,I_y,I_z); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
63 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
64 obj.Hxi = kr(I_n, ops{1}.HI, I_y,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
65 obj.Hx = ops{1}.H; |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
66 obj.Hyi = kr(I_n, I_x, ops{2}.HI,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
67 obj.Hy = ops{2}.H; |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
68 obj.Hzi = kr(I_n, I_x,I_y, ops{3}.HI); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
69 obj.Hz = ops{3}.H; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
70 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
71 obj.e_w = kr(I_n, ops{1}.e_l, I_y,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
72 obj.e_e = kr(I_n, ops{1}.e_r, I_y,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
73 obj.e_s = kr(I_n, I_x, ops{2}.e_l,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
74 obj.e_n = kr(I_n, I_x, ops{2}.e_r,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
75 obj.e_b = kr(I_n, I_x, I_y, ops{3}.e_l); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
76 obj.e_t = kr(I_n, I_x, I_y, ops{3}.e_r); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
77 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
78 obj.order = order; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
79 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
80 switch toString(opSet) |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
81 case 'sbp.D1Upwind' |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
82 alphaA = max(abs(eig(A(params, x{1}(end), x{2}(end), x{3}(end))))); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
83 alphaB = max(abs(eig(B(params, x{1}(end), x{2}(end), x{3}(end))))); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
84 alphaC = max(abs(eig(C(params, x{1}(end), x{2}(end), x{3}(end))))); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
85 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
86 Ap = (obj.Aevaluated+alphaA*I_N)/2; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
87 Am = (obj.Aevaluated-alphaA*I_N)/2; |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
88 Dpx = kr(I_n, ops{1}.Dp, I_y,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
89 Dmx = kr(I_n, ops{1}.Dm, I_y,I_z); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
90 obj.D = -Am*Dpx; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
91 temp = Ap*Dmx; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
92 obj.D = obj.D-temp; |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
93 clear Ap Am Dpx Dmx |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
94 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
95 Bp = (obj.Bevaluated+alphaB*I_N)/2; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
96 Bm = (obj.Bevaluated-alphaB*I_N)/2; |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
97 Dpy = kr(I_n, I_x, ops{2}.Dp,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
98 Dmy = kr(I_n, I_x, ops{2}.Dm,I_z); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
99 temp = Bm*Dpy; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
100 obj.D = obj.D-temp; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
101 temp = Bp*Dmy; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
102 obj.D = obj.D-temp; |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
103 clear Bp Bm Dpy Dmy |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
104 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
105 |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
106 Cp = (obj.Cevaluated+alphaC*I_N)/2; |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
107 Cm = (obj.Cevaluated-alphaC*I_N)/2; |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
108 Dpz = kr(I_n, I_x, I_y,ops{3}.Dp); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
109 Dmz = kr(I_n, I_x, I_y,ops{3}.Dm); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
110 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
111 temp = Cm*Dpz; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
112 obj.D = obj.D-temp; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
113 temp = Cp*Dmz; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
114 obj.D = obj.D-temp; |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
115 clear Cp Cm Dpz Dmz |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
116 obj.D = obj.D-obj.Eevaluated; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
117 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
118 case {'sbp.D2Standard', 'sbp.D2Variable', 'sbp.D4Standard', 'sbp.D4Variable'} |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
119 D1_x = kr(I_n, ops{1}.D1, I_y,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
120 D1_y = kr(I_n, I_x, ops{2}.D1,I_z); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
121 D1_z = kr(I_n, I_x, I_y,ops{3}.D1); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
122 obj.D = -obj.Aevaluated*D1_x-obj.Bevaluated*D1_y-obj.Cevaluated*D1_z-obj.Eevaluated; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
123 otherwise |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
124 error('Operator not supported'); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
125 end |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
126 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
127 |
1226
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
128 % Closure functions return the operators applied to the own domain to close the boundary |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
129 % Penalty functions return the operators to force the solution. In the case of an interface it returns the operator applied to the other doamin. |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
130 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
131 % type is a string specifying the type of boundary condition if there are several. |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
132 % data is a function returning the data that should be applied at the boundary. |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
133 function [closure, penalty] = boundary_condition(obj,boundary,type,L) |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
134 default_arg('type','char'); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
135 BM = boundary_matrices(obj,boundary); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
136 switch type |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
137 case{'c','char'} |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
138 [closure,penalty] = boundary_condition_char(obj,BM); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
139 case{'general'} |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
140 [closure,penalty] = boundary_condition_general(obj,BM,boundary,L); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
141 otherwise |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
142 error('No such boundary condition') |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
143 end |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
144 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
145 |
946
706d1c2b4199
Raname opts to type in a bunch of interface methods
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
146 function [closure, penalty] = interface(obj, boundary, neighbour_scheme, neighbour_boundary, type) |
706d1c2b4199
Raname opts to type in a bunch of interface methods
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
147 error('Not implemented'); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
148 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
149 |
1226
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
150 % TODO: Implement! This function should potentially replace boundary_matrices. |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
151 % Returns the boundary operator op for the boundary specified by the string boundary. |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
152 % op -- string or a cell array of strings |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
153 % boundary -- string |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
154 function varargout = getBoundaryOperator(obj, op, boundary) |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
155 error('Not implemented'); |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
156 end |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
157 |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
158 % TODO: Implement! |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
159 % Returns square boundary quadrature matrix, of dimension |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
160 % corresponding to the number of boundary points |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
161 % |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
162 % boundary -- string |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
163 function H = getBoundaryQuadrature(obj, boundary) |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
164 error('Not implemented'); |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
165 end |
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
166 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
167 function N = size(obj) |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
168 N = obj.grid.m; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
169 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
170 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
171 function [ret] = evaluateCoefficientMatrix(obj, mat, X, Y, Z) |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
172 params = obj.params; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
173 side = max(length(X),length(Y)); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
174 if isa(mat,'function_handle') |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
175 [rows,cols] = size(mat(params,0,0,0)); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
176 matVec = mat(params,X',Y',Z'); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
177 matVec = sparse(matVec); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
178 else |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
179 matVec = mat; |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
180 [rows,cols] = size(matVec); |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
181 side = max(length(X),length(Y)); |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
182 cols = cols/side; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
183 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
184 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
185 ret = cell(rows,cols); |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
186 for ii = 1:rows |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
187 for jj = 1:cols |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
188 ret{ii,jj} = diag(matVec(ii,(jj-1)*side+1:jj*side)); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
189 end |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
190 end |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
191 ret = cell2mat(ret); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
192 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
193 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
194 function [BM] = boundary_matrices(obj,boundary) |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
195 params = obj.params; |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
196 points = obj.grid.points(); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
197 X = points(:, 1); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
198 Y = points(:, 2); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
199 Z = points(:, 3); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
200 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
201 switch boundary |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
202 case {'w','W','west'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
203 BM.e_ = obj.e_w; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
204 mat = obj.A; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
205 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
206 BM.Hi = obj.Hxi; |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
207 [BM.V,BM.Vi,BM.D,signVec] = obj.matrixDiag(mat,X(1),obj.Yx,obj.Zx); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
208 BM.side = length(obj.Yx); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
209 case {'e','E','east'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
210 BM.e_ = obj.e_e; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
211 mat = obj.A; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
212 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
213 BM.Hi = obj.Hxi; |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
214 [BM.V,BM.Vi,BM.D,signVec] = obj.matrixDiag(mat,X(end),obj.Yx,obj.Zx); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
215 BM.side = length(obj.Yx); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
216 case {'s','S','south'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
217 BM.e_ = obj.e_s; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
218 mat = obj.B; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
219 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
220 BM.Hi = obj.Hyi; |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
221 [BM.V,BM.Vi,BM.D,signVec] = obj.matrixDiag(mat,obj.Xy,Y(1),obj.Zy); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
222 BM.side = length(obj.Xy); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
223 case {'n','N','north'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
224 BM.e_ = obj.e_n; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
225 mat = obj.B; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
226 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
227 BM.Hi = obj.Hyi; |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
228 [BM.V,BM.Vi,BM.D,signVec] = obj.matrixDiag(mat,obj.Xy,Y(end),obj.Zy); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
229 BM.side = length(obj.Xy); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
230 case{'b','B','Bottom'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
231 BM.e_ = obj.e_b; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
232 mat = obj.C; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
233 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
234 BM.Hi = obj.Hzi; |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
235 [BM.V,BM.Vi,BM.D,signVec] = obj.matrixDiag(mat,obj.Xz,obj.Yz,Z(1)); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
236 BM.side = length(obj.Xz); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
237 case{'t','T','Top'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
238 BM.e_ = obj.e_t; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
239 mat = obj.C; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
240 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
241 BM.Hi = obj.Hzi; |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
242 [BM.V,BM.Vi,BM.D,signVec] = obj.matrixDiag(mat,obj.Xz,obj.Yz,Z(end)); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
243 BM.side = length(obj.Xz); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
244 end |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
245 BM.pos = signVec(1); BM.zeroval=signVec(2); BM.neg=signVec(3); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
246 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
247 |
1226
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
248 % Characteristic boundary conditions |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
249 function [closure, penalty]=boundary_condition_char(obj,BM) |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
250 side = BM.side; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
251 pos = BM.pos; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
252 neg = BM.neg; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
253 zeroval=BM.zeroval; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
254 V = BM.V; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
255 Vi = BM.Vi; |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
256 Hi = BM.Hi; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
257 D = BM.D; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
258 e_ = BM.e_; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
259 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
260 switch BM.boundpos |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
261 case {'l'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
262 tau = sparse(obj.nEquations*side,pos); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
263 Vi_plus = Vi(1:pos,:); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
264 tau(1:pos,:) = -abs(D(1:pos,1:pos)); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
265 closure = Hi*e_*V*tau*Vi_plus*e_'; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
266 penalty = -Hi*e_*V*tau*Vi_plus; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
267 case {'r'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
268 tau = sparse(obj.nEquations*side,neg); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
269 tau((pos+zeroval)+1:obj.nEquations*side,:) = -abs(D((pos+zeroval)+1:obj.nEquations*side,(pos+zeroval)+1:obj.nEquations*side)); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
270 Vi_minus = Vi((pos+zeroval)+1:obj.nEquations*side,:); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
271 closure = Hi*e_*V*tau*Vi_minus*e_'; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
272 penalty = -Hi*e_*V*tau*Vi_minus; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
273 end |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
274 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
275 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
276 % General boundary condition in the form Lu=g(x) |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
277 function [closure,penalty] = boundary_condition_general(obj,BM,boundary,L) |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
278 side = BM.side; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
279 pos = BM.pos; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
280 neg = BM.neg; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
281 zeroval=BM.zeroval; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
282 V = BM.V; |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
283 Vi = BM.Vi; |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
284 Hi = BM.Hi; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
285 D = BM.D; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
286 e_ = BM.e_; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
287 |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
288 x = obj.grid.x{1}; |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
289 y = obj.grid.x{2}; |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
290 z = obj.grid.x{3}; |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
291 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
292 switch boundary |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
293 case {'w','W','west'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
294 L = obj.evaluateCoefficientMatrix(L,x(1),obj.Yx,obj.Zx); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
295 case {'e','E','east'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
296 L = obj.evaluateCoefficientMatrix(L,x(end),obj.Yx,obj.Zx); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
297 case {'s','S','south'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
298 L = obj.evaluateCoefficientMatrix(L,obj.Xy,y(1),obj.Zy); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
299 case {'n','N','north'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
300 L = obj.evaluateCoefficientMatrix(L,obj.Xy,y(end),obj.Zy);% General boundary condition in the form Lu=g(x) |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
301 case {'b','B','bottom'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
302 L = obj.evaluateCoefficientMatrix(L,obj.Xz,obj.Yz, z(1)); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
303 case {'t','T','top'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
304 L = obj.evaluateCoefficientMatrix(L,obj.Xz,obj.Yz, z(end)); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
305 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
306 |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
307 switch BM.boundpos |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
308 case {'l'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
309 tau = sparse(obj.nEquations*side,pos); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
310 Vi_plus = Vi(1:pos,:); |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
311 Vi_minus = Vi(pos+zeroval+1:obj.nEquations*side,:); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
312 V_plus = V(:,1:pos); |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
313 V_minus = V(:,(pos+zeroval)+1:obj.nEquations*side); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
314 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
315 tau(1:pos,:) = -abs(D(1:pos,1:pos)); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
316 R = -inv(L*V_plus)*(L*V_minus); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
317 closure = Hi*e_*V*tau*(Vi_plus-R*Vi_minus)*e_'; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
318 penalty = -Hi*e_*V*tau*inv(L*V_plus)*L; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
319 case {'r'} |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
320 tau = sparse(obj.nEquations*side,neg); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
321 tau((pos+zeroval)+1:obj.nEquations*side,:) = -abs(D((pos+zeroval)+1:obj.nEquations*side,(pos+zeroval)+1:obj.nEquations*side)); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
322 Vi_plus = Vi(1:pos,:); |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
323 Vi_minus = Vi((pos+zeroval)+1:obj.nEquations*side,:); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
324 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
325 V_plus = V(:,1:pos); |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
326 V_minus = V(:,(pos+zeroval)+1:obj.nEquations*side); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
327 R = -inv(L*V_minus)*(L*V_plus); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
328 closure = Hi*e_*V*tau*(Vi_minus-R*Vi_plus)*e_'; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
329 penalty = -Hi*e_*V*tau*inv(L*V_minus)*L; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
330 end |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
331 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
332 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
333 % Function that diagonalizes a symbolic matrix A as A=V*D*Vi |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
334 % D is a diagonal matrix with the eigenvalues on A on the diagonal sorted by their sign |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
335 % [d+ ] |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
336 % D = [ d0 ] |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
337 % [ d-] |
1226
0652b34f9f27
Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
946
diff
changeset
|
338 % signVec is a vector specifying the number of positive, zero and negative eigenvalues of D |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
339 function [V,Vi, D,signVec]=matrixDiag(obj,mat,x,y,z) |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
340 params = obj.params; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
341 syms xs ys zs |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
342 [V, D] = eig(mat(params,xs,ys,zs)); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
343 Vi=inv(V); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
344 xs = x; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
345 ys = y; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
346 zs = z; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
347 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
348 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
349 side = max(length(x),length(y)); |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
350 Dret = zeros(obj.nEquations,side*obj.nEquations); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
351 Vret = zeros(obj.nEquations,side*obj.nEquations); |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
352 Viret= zeros(obj.nEquations,side*obj.nEquations); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
353 |
1228
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
354 for ii=1:obj.nEquations |
ef08adea56c4
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1226
diff
changeset
|
355 for jj=1:obj.nEquations |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
356 Dret(jj,(ii-1)*side+1:side*ii) = eval(D(jj,ii)); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
357 Vret(jj,(ii-1)*side+1:side*ii) = eval(V(jj,ii)); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
358 Viret(jj,(ii-1)*side+1:side*ii) = eval(Vi(jj,ii)); |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
359 end |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
360 end |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
361 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
362 D = sparse(Dret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
363 V = sparse(Vret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
364 Vi = sparse(Viret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
365 V = obj.evaluateCoefficientMatrix(V,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
366 Vi= obj.evaluateCoefficientMatrix(Vi,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
367 D = obj.evaluateCoefficientMatrix(D,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
368 DD = diag(D); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
369 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
370 poseig = (DD>0); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
371 zeroeig = (DD==0); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
372 negeig = (DD<0); |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
373 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
374 D = diag([DD(poseig); DD(zeroeig); DD(negeig)]); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
375 V = [V(:,poseig) V(:,zeroeig) V(:,negeig)]; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
376 Vi= [Vi(poseig,:); Vi(zeroeig,:); Vi(negeig,:)]; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
377 signVec = [sum(poseig),sum(zeroeig),sum(negeig)]; |
349
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
378 end |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
379 end |
cd6a29ab3746
A 3D is added and an attempt to imlement 3D transfinit interpolation has been initialized
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff
changeset
|
380 end |