Mercurial > repos > public > sbplib
annotate +scheme/Hypsyst3d.m @ 1251:6424745e1b58 feature/volcano
Merge in latest changes from default
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 20 Nov 2019 14:26:57 -0800 |
parents | 10881b234f77 |
children |
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 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
|
5 |
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
|
6 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
|
7 |
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
|
8 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
|
9 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
|
10 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
|
11 |
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
|
12 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
|
13 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
|
14 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
|
15 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
|
16 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
|
17 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
|
18 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
19 |
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
|
20 methods |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
21 % 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
|
22 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
|
23 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
|
24 default_arg('E', []) |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
25 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
|
26 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
|
27 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
28 obj.A = A; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
29 obj.B = B; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
30 obj.C = C; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
31 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
|
32 obj.params = params; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
33 assert(obj.grid.d == 3, 'Dimensions not correct') |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
34 % Construct 1D operators for each coordinate dir |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
35 for i = 1:obj.grid.d |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
36 ops{i} = opSet(obj.grid.m(i),obj.grid.lim{i},order); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
37 I{i} = speye(obj.grid.m(i)); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
38 end |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
39 x = obj.grid.x; %Grid points in each coordinate dir |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
40 X = num2cell(obj.grid.points(),1); %Kroneckered grid values in each coordinate dir |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
41 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
42 obj.Aevaluated = obj.evaluateCoefficientMatrix(A, X{:}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
43 obj.Bevaluated = obj.evaluateCoefficientMatrix(B, X{:}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
44 obj.Cevaluated = obj.evaluateCoefficientMatrix(C, X{:}); |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
45 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
|
46 |
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
|
47 obj.nEquations = length(A(obj.params,0,0,0)); |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
48 I_n = speye(obj.nEquations); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
49 I_N = kr(I_n,I{:}); |
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 |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
51 obj.Hxi = kr(I_n, ops{1}.HI, I{2}, I{3}); |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
52 obj.Hx = ops{1}.H; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
53 obj.Hyi = kr(I_n, I{1}, ops{2}.HI, I{3}); |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
54 obj.Hy = ops{2}.H; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
55 obj.Hzi = kr(I_n, I{1},I{2}, ops{3}.HI); |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
56 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
|
57 |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
58 obj.e_w = kr(I_n, ops{1}.e_l, I{2}, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
59 obj.e_e = kr(I_n, ops{1}.e_r, I{2}, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
60 obj.e_s = kr(I_n, I{1}, ops{2}.e_l, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
61 obj.e_n = kr(I_n, I{1}, ops{2}.e_r, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
62 obj.e_b = kr(I_n, I{1}, I{2}, ops{3}.e_l); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
63 obj.e_t = kr(I_n, I{1}, I{2}, 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
|
64 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
65 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
|
66 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
67 switch toString(opSet) |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
68 case 'sbp.D1Upwind' |
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
69 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
|
70 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
|
71 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
|
72 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
73 Ap = (obj.Aevaluated+alphaA*I_N)/2; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
74 Am = (obj.Aevaluated-alphaA*I_N)/2; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
75 Dpx = kr(I_n, ops{1}.Dp, I{2}, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
76 Dmx = kr(I_n, ops{1}.Dm, I{2}, I{3}); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
77 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
|
78 temp = Ap*Dmx; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
79 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
|
80 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
|
81 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
82 Bp = (obj.Bevaluated+alphaB*I_N)/2; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
83 Bm = (obj.Bevaluated-alphaB*I_N)/2; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
84 Dpy = kr(I_n, I{1}, ops{2}.Dp, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
85 Dmy = kr(I_n, I{1}, ops{2}.Dm, I{3}); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
86 temp = Bm*Dpy; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
87 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
|
88 temp = Bp*Dmy; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
89 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
|
90 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
|
91 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
92 |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
93 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
|
94 Cm = (obj.Cevaluated-alphaC*I_N)/2; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
95 Dpz = kr(I_n, I{1}, I{2}, ops{3}.Dp); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
96 Dmz = kr(I_n, I{1}, I{2}, 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
|
97 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
98 temp = Cm*Dpz; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
99 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
|
100 temp = Cp*Dmz; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
101 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
|
102 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
|
103 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
|
104 |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
105 case {'sbp.D2Standard', 'sbp.D2Variable', 'sbp.D4Standard', 'sbp.D4Variable'} |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
106 D1_x = kr(I_n, ops{1}.D1, I{2}, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
107 D1_y = kr(I_n, I{1}, ops{2}.D1, I{3}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
108 D1_z = kr(I_n, I{1}, I{2}, 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
|
109 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
|
110 otherwise |
1231
e1f9bedd64a9
Add opSet to Hypsyst3d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1228
diff
changeset
|
111 error('Operator not supported'); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
112 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
|
113 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
|
114 |
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
|
115 % 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
|
116 % 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
|
117 % 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
|
118 % 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
|
119 % 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 case{'c','char'} |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
125 [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
|
126 case{'general'} |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
127 [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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 |
946
706d1c2b4199
Raname opts to type in a bunch of interface methods
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 |
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
|
137 % 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
|
138 % 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
|
139 % 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
|
140 % 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
|
141 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
|
142 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
|
143 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
|
144 |
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
|
145 % 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
|
146 % 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
|
147 % 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
|
148 % |
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
|
149 % 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
|
150 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
|
151 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
|
152 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
|
153 |
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
|
154 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
|
155 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
|
156 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
|
157 |
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
|
158 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
|
159 params = obj.params; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
160 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
|
161 if isa(mat,'function_handle') |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
162 [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
|
163 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
|
164 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
|
165 else |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
166 matVec = mat; |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
167 [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
|
168 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
|
169 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
|
170 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
|
171 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 end |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
178 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
|
179 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
|
180 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
181 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
|
182 params = obj.params; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
183 bp = num2cell(obj.grid.getBoundary(boundary),1); %Kroneckered boundary points |
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
|
184 switch boundary |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
185 case {'w'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
186 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
|
187 mat = obj.A; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
188 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
189 BM.Hi = obj.Hxi; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
190 BM.side = length(bp{2}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
191 case {'e'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
192 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
|
193 mat = obj.A; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
194 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
195 BM.Hi = obj.Hxi; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
196 BM.side = length(bp{2}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
197 case {'s'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
198 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
|
199 mat = obj.B; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
200 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
201 BM.Hi = obj.Hyi; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
202 BM.side = length(bp{1}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
203 case {'n'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
204 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
|
205 mat = obj.B; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
206 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
207 BM.Hi = obj.Hyi; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
208 BM.side = length(bp{1}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
209 case{'d'} |
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_b; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
211 mat = obj.C; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
212 BM.boundpos = 'l'; |
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.Hzi; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
214 BM.side = length(bp{1}); |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
215 case{'u'} |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
216 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
|
217 mat = obj.C; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
218 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
219 BM.Hi = obj.Hzi; |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
220 BM.side = length(bp{1}); |
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
|
221 end |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
222 [BM.V,BM.Vi,BM.D,signVec] = obj.diagonalizeMatrix(mat,bp{:}); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
223 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
|
224 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
|
225 |
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
|
226 % 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
|
227 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 Hi = BM.Hi; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
235 D = BM.D; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
236 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
|
237 |
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
|
238 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
|
239 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
|
240 tau = sparse(obj.nEquations*side,pos); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
241 Vi_plus = Vi(1:pos,:); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
254 % 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 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
|
260 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
|
261 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
|
262 Hi = BM.Hi; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
263 D = BM.D; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
264 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
|
265 |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
266 bp = num2cell(obj.grid.getBoundary(boundary),1); %Kroneckered boundary points |
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
267 L = obj.evaluateCoefficientMatrix(L,bp{:}); % 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
|
268 |
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
|
269 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
|
270 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
|
271 tau = sparse(obj.nEquations*side,pos); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
272 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
|
273 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
|
274 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
|
275 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
|
276 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
277 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
|
278 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
|
279 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 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
|
285 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
|
286 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
287 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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
295 % 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
|
296 % 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
|
297 % [d+ ] |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
298 % D = [ d0 ] |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
299 % [ 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
|
300 % signVec is a vector specifying the number of positive, zero and negative eigenvalues of D |
1248
10881b234f77
Clean up hypsyst3d; use functionality from grid module and remove obsolete properties. Store operators for different coord dirs in cell arrays.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1231
diff
changeset
|
301 function [V, Vi, D, signVec] = diagonalizeMatrix(obj, mat, x, y, z) |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
302 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
|
303 syms xs ys zs |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
304 [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
|
305 Vi=inv(V); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
306 xs = x; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
307 ys = y; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
308 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
|
309 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
310 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 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
|
315 |
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
|
316 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
|
317 for jj=1:obj.nEquations |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
324 D = sparse(Dret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
325 V = sparse(Vret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
326 Vi = sparse(Viret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
327 V = obj.evaluateCoefficientMatrix(V,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
328 Vi= obj.evaluateCoefficientMatrix(Vi,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
329 D = obj.evaluateCoefficientMatrix(D,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
330 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
|
331 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
332 poseig = (DD>0); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
333 zeroeig = (DD==0); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
334 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
|
335 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
336 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
|
337 V = [V(:,poseig) V(:,zeroeig) V(:,negeig)]; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
338 Vi= [Vi(poseig,:); Vi(zeroeig,:); Vi(negeig,:)]; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
339 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
|
340 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
|
341 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
|
342 end |