comparison +scheme/Hypsyst3d.m @ 1226:0652b34f9f27 feature/volcano

Add missing properties and methods to Hypsyst3D and Hypsyst3Dcurve. Note: These functions are NOT implemented properly and mearly work as place holders.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 12 Nov 2019 09:00:48 -0800
parents 706d1c2b4199
children ef08adea56c4
comparison
equal deleted inserted replaced
1116:33c378e508d2 1226:0652b34f9f27
1 classdef Hypsyst3d < scheme.Scheme 1 classdef Hypsyst3d < scheme.Scheme
2 properties 2 properties
3 m % Number of points in each direction, possibly a vector 3 m % Number of points in each direction, possibly a vector
4 n % Size of system 4 n % Size of system
5 h % Grid spacing 5 h % Grid spacing
6 grid %TODO: Abstract class requires a grid. Pass Cartesian grid to function instead
6 x, y, z % Grid 7 x, y, z % Grid
7 X, Y, Z% Values of x and y for each grid point 8 X, Y, Z% Values of x and y for each grid point
8 Yx, Zx, Xy, Zy, Xz, Yz %Grid values for boundary surfaces 9 Yx, Zx, Xy, Zy, Xz, Yz %Grid values for boundary surfaces
9 order % Order accuracy for the approximation 10 order % Order accuracy for the approximation
10 11
11 D % non-stabalized scheme operator 12 D % non-stabilized scheme operator
12 A, B, C, E % Symbolic coefficient matrices 13 A, B, C, E % Symbolic coefficient matrices
13 Aevaluated,Bevaluated,Cevaluated, Eevaluated 14 Aevaluated,Bevaluated,Cevaluated, Eevaluated
14 15
15 H % Discrete norm 16 H % Discrete norm
16 Hx, Hy, Hz % Norms in the x, y and z directions 17 Hx, Hy, Hz % Norms in the x, y and z directions
17 Hxi,Hyi, Hzi % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir. 18 Hxi,Hyi, Hzi % Kroneckerd norms. 1'*Hx*v corresponds to integration in the x dir.
18 I_x,I_y, I_z, I_N 19 I_x,I_y, I_z, I_N
19 e_w, e_e, e_s, e_n, e_b, e_t 20 e_w, e_e, e_s, e_n, e_b, e_t
20 params % Parameters for the coeficient matrice 21 params % Parameters for the coefficient matrices
21 end 22 end
22 23
23 24
24 methods 25 methods
25 % Solving Hyperbolic systems on the form u_t=-Au_x-Bu_y-Cu_z-Eu 26 % Solving Hyperbolic systems on the form u_t=-Au_x-Bu_y-Cu_z-Eu
26 function obj = Hypsyst3d(m, lim, order, A, B,C, E, params,operator) 27 function obj = Hypsyst3d(m, lim, order, A, B, C, E, params, operator)
27 default_arg('E', []) 28 default_arg('E', [])
28 xlim = lim{1}; 29 xlim = lim{1};
29 ylim = lim{2}; 30 ylim = lim{2};
30 zlim = lim{3}; 31 zlim = lim{3};
31 32
148 otherwise 149 otherwise
149 error('Opperator not supported'); 150 error('Opperator not supported');
150 end 151 end
151 end 152 end
152 153
153 % Closure functions return the opertors applied to the own doamin to close the boundary 154 % Closure functions return the operators applied to the own domain to close the boundary
154 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. 155 % Penalty functions return the operators to force the solution. In the case of an interface it returns the operator applied to the other doamin.
155 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. 156 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
156 % type is a string specifying the type of boundary condition if there are several. 157 % type is a string specifying the type of boundary condition if there are several.
157 % data is a function returning the data that should be applied at the boundary. 158 % data is a function returning the data that should be applied at the boundary.
158 function [closure, penalty] = boundary_condition(obj,boundary,type,L) 159 function [closure, penalty] = boundary_condition(obj,boundary,type,L)
159 default_arg('type','char'); 160 default_arg('type','char');
167 error('No such boundary condition') 168 error('No such boundary condition')
168 end 169 end
169 end 170 end
170 171
171 function [closure, penalty] = interface(obj, boundary, neighbour_scheme, neighbour_boundary, type) 172 function [closure, penalty] = interface(obj, boundary, neighbour_scheme, neighbour_boundary, type)
173 error('Not implemented');
174 end
175
176 % TODO: Implement! This function should potentially replace boundary_matrices.
177 % Returns the boundary operator op for the boundary specified by the string boundary.
178 % op -- string or a cell array of strings
179 % boundary -- string
180 function varargout = getBoundaryOperator(obj, op, boundary)
181 error('Not implemented');
182 end
183
184 % TODO: Implement!
185 % Returns square boundary quadrature matrix, of dimension
186 % corresponding to the number of boundary points
187 %
188 % boundary -- string
189 function H = getBoundaryQuadrature(obj, boundary)
172 error('Not implemented'); 190 error('Not implemented');
173 end 191 end
174 192
175 function N = size(obj) 193 function N = size(obj)
176 N = obj.m; 194 N = obj.m;
247 BM.side = length(obj.Xz); 265 BM.side = length(obj.Xz);
248 end 266 end
249 BM.pos = signVec(1); BM.zeroval=signVec(2); BM.neg=signVec(3); 267 BM.pos = signVec(1); BM.zeroval=signVec(2); BM.neg=signVec(3);
250 end 268 end
251 269
252 % Characteristic bouyndary consitions 270 % Characteristic boundary conditions
253 function [closure, penalty]=boundary_condition_char(obj,BM) 271 function [closure, penalty]=boundary_condition_char(obj,BM)
254 side = BM.side; 272 side = BM.side;
255 pos = BM.pos; 273 pos = BM.pos;
256 neg = BM.neg; 274 neg = BM.neg;
257 zeroval=BM.zeroval; 275 zeroval=BM.zeroval;
333 % Function that diagonalizes a symbolic matrix A as A=V*D*Vi 351 % Function that diagonalizes a symbolic matrix A as A=V*D*Vi
334 % D is a diagonal matrix with the eigenvalues on A on the diagonal sorted by their sign 352 % D is a diagonal matrix with the eigenvalues on A on the diagonal sorted by their sign
335 % [d+ ] 353 % [d+ ]
336 % D = [ d0 ] 354 % D = [ d0 ]
337 % [ d-] 355 % [ d-]
338 % signVec is a vector specifying the number of possitive, zero and negative eigenvalues of D 356 % signVec is a vector specifying the number of positive, zero and negative eigenvalues of D
339 function [V,Vi, D,signVec]=matrixDiag(obj,mat,x,y,z) 357 function [V,Vi, D,signVec]=matrixDiag(obj,mat,x,y,z)
340 params = obj.params; 358 params = obj.params;
341 syms xs ys zs 359 syms xs ys zs
342 [V, D] = eig(mat(params,xs,ys,zs)); 360 [V, D] = eig(mat(params,xs,ys,zs));
343 Vi=inv(V); 361 Vi=inv(V);