Mercurial > repos > public > sbplib
annotate +scheme/Hypsyst3d.m @ 1228:ef08adea56c4 feature/volcano
Utilize grid module in Hypsyst3d. Pass cartesian grid and replace some of the previous functionality in Hypsyst3d with properties/methods for cartesian grids.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 18 Nov 2019 10:31:58 -0800 |
parents | 0652b34f9f27 |
children | e1f9bedd64a9 |
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 I_x,I_y, I_z, I_N |
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 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
|
18 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
|
19 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
|
20 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
21 |
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
|
22 methods |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
23 % Solving Hyperbolic systems on the form u_t=-Au_x-Bu_y-Cu_z-Eu |
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 function obj = Hypsyst3d(cartesianGrid, order, A, B, C, E, params, operator) |
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
|
25 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
|
26 default_arg('E', []) |
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; |
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
|
28 xlim = obj.grid.lim{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
|
29 ylim = obj.grid.lim{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
|
30 zlim = obj.grid.lim{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
|
31 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
32 obj.A = A; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
33 obj.B = B; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
34 obj.C = C; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
35 obj.E = E; |
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
|
36 m_x = obj.grid.m(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
|
37 m_y = obj.grid.m(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
|
38 m_z = obj.grid.m(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
|
39 obj.params = params; |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
40 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
41 switch operator |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
42 case 'upwind' |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
43 ops_x = sbp.D1Upwind(m_x,xlim,order); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
44 ops_y = sbp.D1Upwind(m_y,ylim,order); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
45 ops_z = sbp.D1Upwind(m_z,zlim,order); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
46 otherwise |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
47 ops_x = sbp.D2Standard(m_x,xlim,order); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
48 ops_y = sbp.D2Standard(m_y,ylim,order); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
49 ops_z = sbp.D2Standard(m_z,zlim,order); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
50 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
|
51 |
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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 |
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
|
60 obj.Yx = kr(y, ones(m_z,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
|
61 obj.Zx = kr(ones(m_y,1), z); |
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
|
62 obj.Xy = kr(x, ones(m_z,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
|
63 obj.Zy = kr(ones(m_x,1), z); |
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
|
64 obj.Xz = kr(x, ones(m_y,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
|
65 obj.Yz = kr(ones(m_z,1), y); |
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 |
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
|
67 obj.Aevaluated = obj.evaluateCoefficientMatrix(A, X, Y, Z); |
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
|
68 obj.Bevaluated = obj.evaluateCoefficientMatrix(B, X, Y, Z); |
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
|
69 obj.Cevaluated = obj.evaluateCoefficientMatrix(C, X, Y, Z); |
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
|
70 obj.Eevaluated = obj.evaluateCoefficientMatrix(E, X, Y, 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
|
71 |
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
|
72 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
|
73 |
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
|
74 I_n = speye(obj.nEquations); |
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
|
75 I_x = speye(m_x); |
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
|
76 obj.I_x = I_x; |
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
|
77 I_y = speye(m_y); |
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
|
78 obj.I_y = I_y; |
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
|
79 I_z = speye(m_z); |
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
|
80 obj.I_z = I_z; |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
81 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
|
82 |
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
|
83 obj.Hxi = kr(I_n, ops_x.HI, I_y,I_z); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
84 obj.Hx = ops_x.H; |
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
|
85 obj.Hyi = kr(I_n, I_x, ops_y.HI,I_z); |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
86 obj.Hy = ops_y.H; |
350
5d5652fe826a
A commit before I try resolving the performance issues
Ylva Rydin <ylva.rydin@telia.com>
parents:
349
diff
changeset
|
87 obj.Hzi = kr(I_n, I_x,I_y, ops_z.HI); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
88 obj.Hz = ops_z.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
|
89 |
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
|
90 obj.e_w = kr(I_n, ops_x.e_l, I_y,I_z); |
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
|
91 obj.e_e = kr(I_n, ops_x.e_r, I_y,I_z); |
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
|
92 obj.e_s = kr(I_n, I_x, ops_y.e_l,I_z); |
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
|
93 obj.e_n = kr(I_n, I_x, ops_y.e_r,I_z); |
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
|
94 obj.e_b = kr(I_n, I_x, I_y, ops_z.e_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
|
95 obj.e_t = kr(I_n, I_x, I_y, ops_z.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
|
96 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
97 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
|
98 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
99 switch operator |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
100 case 'upwind' |
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
|
101 alphaA = max(abs(eig(A(params, x(end), y(end), z(end))))); |
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
|
102 alphaB = max(abs(eig(B(params, x(end), y(end), z(end))))); |
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
|
103 alphaC = max(abs(eig(C(params, x(end), y(end), z(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
|
104 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
105 Ap = (obj.Aevaluated+alphaA*I_N)/2; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
106 Am = (obj.Aevaluated-alphaA*I_N)/2; |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
107 Dpx = kr(I_n, ops_x.Dp, I_y,I_z); |
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
108 Dmx = kr(I_n, ops_x.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
|
109 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
|
110 temp = Ap*Dmx; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
111 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
|
112 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
|
113 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
114 Bp = (obj.Bevaluated+alphaB*I_N)/2; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
115 Bm = (obj.Bevaluated-alphaB*I_N)/2; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
116 Dpy = kr(I_n, I_x, ops_y.Dp,I_z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
117 Dmy = kr(I_n, I_x, ops_y.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
|
118 temp = Bm*Dpy; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
119 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
|
120 temp = Bp*Dmy; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
121 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
|
122 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
|
123 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
124 |
355
69b078cf8072
Upwind doed not work in the non curve-linear case.
Ylva Rydin <ylva.rydin@telia.com>
parents:
354
diff
changeset
|
125 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
|
126 Cm = (obj.Cevaluated-alphaC*I_N)/2; |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
127 Dpz = kr(I_n, I_x, I_y,ops_z.Dp); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
128 Dmz = kr(I_n, I_x, I_y,ops_z.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
|
129 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
130 temp = Cm*Dpz; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
131 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
|
132 temp = Cp*Dmz; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
137 case 'standard' |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
138 D1_x = kr(I_n, ops_x.D1, I_y,I_z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
139 D1_y = kr(I_n, I_x, ops_y.D1,I_z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
140 D1_z = kr(I_n, I_x, I_y,ops_z.D1); |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
141 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
|
142 otherwise |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
143 error('Opperator not supported'); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
144 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
|
145 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
|
146 |
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
|
147 % 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
|
148 % 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
|
149 % 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
|
150 % 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
|
151 % 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 case{'c','char'} |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
157 [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
|
158 case{'general'} |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
159 [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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 |
946
706d1c2b4199
Raname opts to type in a bunch of interface methods
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
165 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
|
166 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
|
167 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
|
168 |
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
|
169 % 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
|
170 % 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
|
171 % 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
|
172 % 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
|
173 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
|
174 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
|
175 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
|
176 |
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
|
177 % 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
|
178 % 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
|
179 % 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
|
180 % |
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
|
181 % 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
|
182 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
|
183 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
|
184 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
|
185 |
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
|
186 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
|
187 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
|
188 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
|
189 |
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
|
190 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
|
191 params = obj.params; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
192 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
|
193 if isa(mat,'function_handle') |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
194 [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
|
195 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
|
196 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
|
197 else |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
198 matVec = mat; |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
199 [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
|
200 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
|
201 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
|
202 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
|
203 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 end |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
210 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
|
211 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
|
212 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 |
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
|
220 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
|
221 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
|
222 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
|
223 mat = obj.A; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
224 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
225 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
|
226 [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
|
227 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
|
228 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
|
229 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
|
230 mat = obj.A; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
231 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
232 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
|
233 [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
|
234 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
|
235 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
|
236 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
|
237 mat = obj.B; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
238 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
239 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
|
240 [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
|
241 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
|
242 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
|
243 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
|
244 mat = obj.B; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
245 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
246 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
|
247 [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
|
248 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
|
249 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
|
250 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
|
251 mat = obj.C; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
252 BM.boundpos = 'l'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
253 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
|
254 [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
|
255 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
|
256 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
|
257 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
|
258 mat = obj.C; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
259 BM.boundpos = 'r'; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
260 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
|
261 [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
|
262 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
|
263 end |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
264 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
|
265 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
|
266 |
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
|
267 % 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
|
268 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 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
|
274 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
|
275 Hi = BM.Hi; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
276 D = BM.D; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
277 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
|
278 |
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
|
279 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
|
280 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
|
281 tau = sparse(obj.nEquations*side,pos); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
282 Vi_plus = Vi(1:pos,:); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
283 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 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
|
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 % 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
|
296 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
|
297 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
|
298 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
|
299 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
|
300 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
|
301 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
|
302 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
|
303 Hi = BM.Hi; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
304 D = BM.D; |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
305 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
|
306 |
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
|
307 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
|
308 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
|
309 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
|
310 |
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
|
311 switch boundary |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
312 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
|
313 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
|
314 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
|
315 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
|
316 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
|
317 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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 |
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
|
326 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
|
327 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
|
328 tau = sparse(obj.nEquations*side,pos); |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
329 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
|
330 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
|
331 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
|
332 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
|
333 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
334 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
|
335 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
|
336 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
|
337 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 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
|
343 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 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
|
348 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
|
349 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
|
350 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
|
351 |
369
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
352 % 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
|
353 % 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
|
354 % [d+ ] |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
355 % D = [ d0 ] |
9d1fc984f40d
Added some comments and cleaned up the code a little
Ylva Rydin <ylva.rydin@telia.com>
parents:
368
diff
changeset
|
356 % [ 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
|
357 % 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
|
358 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
|
359 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
|
360 syms xs ys zs |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
361 [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
|
362 Vi=inv(V); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
363 xs = x; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
364 ys = y; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
365 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
|
366 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
367 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
368 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
|
369 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
|
370 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
|
371 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
|
372 |
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
|
373 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
|
374 for jj=1:obj.nEquations |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
375 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
|
376 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
|
377 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
|
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 |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
372
diff
changeset
|
380 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
381 D = sparse(Dret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
382 V = sparse(Vret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
383 Vi = sparse(Viret); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
384 V = obj.evaluateCoefficientMatrix(V,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
385 Vi= obj.evaluateCoefficientMatrix(Vi,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
386 D = obj.evaluateCoefficientMatrix(D,x,y,z); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
387 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
|
388 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
389 poseig = (DD>0); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
390 zeroeig = (DD==0); |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
391 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
|
392 |
354
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
393 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
|
394 V = [V(:,poseig) V(:,zeroeig) V(:,negeig)]; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
395 Vi= [Vi(poseig,:); Vi(zeroeig,:); Vi(negeig,:)]; |
dbac99d2c318
Removed inv(Vi) to save time
Ylva Rydin <ylva.rydin@telia.com>
parents:
352
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 end |