comparison +scheme/Utux2d.m @ 1100:27aaf8646a80 feature/timesteppers

Merge with default
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 09 Apr 2019 21:48:30 +0200
parents 84200bbae101
children 433c89bf19e0
comparison
equal deleted inserted replaced
1099:d4fe089b2c4a 1100:27aaf8646a80
10 % Can either be a constant vector or a cell array of function handles. 10 % Can either be a constant vector or a cell array of function handles.
11 11
12 H % Discrete norm 12 H % Discrete norm
13 H_x, H_y % Norms in the x and y directions 13 H_x, H_y % Norms in the x and y directions
14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms 14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms
15 H_w, H_e, H_s, H_n % Boundary quadratures
15 16
16 % Derivatives 17 % Derivatives
17 Dx, Dy 18 Dx, Dy
18 19
19 % Boundary operators 20 % Boundary operators
57 Hx = ops_x.H; 58 Hx = ops_x.H;
58 Hy = ops_y.H; 59 Hy = ops_y.H;
59 Hxi = ops_x.HI; 60 Hxi = ops_x.HI;
60 Hyi = ops_y.HI; 61 Hyi = ops_y.HI;
61 62
63 obj.H_w = Hy;
64 obj.H_e = Hy;
65 obj.H_s = Hx;
66 obj.H_n = Hx;
62 obj.H_x = Hx; 67 obj.H_x = Hx;
63 obj.H_y = Hy; 68 obj.H_y = Hy;
64 obj.H = kron(Hx,Hy); 69 obj.H = kron(Hx,Hy);
65 obj.Hi = kron(Hxi,Hyi); 70 obj.Hi = kron(Hxi,Hyi);
66 obj.Hx = kron(Hx,Iy); 71 obj.Hx = kron(Hx,Iy);
137 142
138 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type) 143 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type)
139 couplingType = type.couplingType; 144 couplingType = type.couplingType;
140 145
141 % Get neighbour boundary operator 146 % Get neighbour boundary operator
142 switch neighbour_boundary 147 e_neighbour = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary);
143 case {'e','E','east','East'}
144 e_neighbour = neighbour_scheme.e_e;
145 case {'w','W','west','West'}
146 e_neighbour = neighbour_scheme.e_w;
147 case {'n','N','north','North'}
148 e_neighbour = neighbour_scheme.e_n;
149 case {'s','S','south','South'}
150 e_neighbour = neighbour_scheme.e_s;
151 end
152 148
153 switch couplingType 149 switch couplingType
154 150
155 % Upwind coupling (energy dissipation) 151 % Upwind coupling (energy dissipation)
156 case 'upwind' 152 case 'upwind'
195 interpOpSet = type.interpOpSet; 191 interpOpSet = type.interpOpSet;
196 couplingType = type.couplingType; 192 couplingType = type.couplingType;
197 interpolationDamping = type.interpolationDamping; 193 interpolationDamping = type.interpolationDamping;
198 194
199 % Get neighbour boundary operator 195 % Get neighbour boundary operator
200 switch neighbour_boundary 196 e_neighbour = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary);
201 case {'e','E','east','East'}
202 e_neighbour = neighbour_scheme.e_e;
203 case {'w','W','west','West'}
204 e_neighbour = neighbour_scheme.e_w;
205 case {'n','N','north','North'}
206 e_neighbour = neighbour_scheme.e_n;
207 case {'s','S','south','South'}
208 e_neighbour = neighbour_scheme.e_s;
209 end
210 197
211 switch couplingType 198 switch couplingType
212 199
213 % Upwind coupling (energy dissipation) 200 % Upwind coupling (energy dissipation)
214 case 'upwind' 201 case 'upwind'
288 end 275 end
289 276
290 277
291 end 278 end
292 279
280 % Returns the boundary operator op for the boundary specified by the string boundary.
281 % op -- string
282 % boundary -- string
283 function o = getBoundaryOperator(obj, op, boundary)
284 assertIsMember(op, {'e'})
285 assertIsMember(boundary, {'w', 'e', 's', 'n'})
286
287 o = obj.([op, '_', boundary]);
288 end
289
290 % Returns square boundary quadrature matrix, of dimension
291 % corresponding to the number of boundary points
292 %
293 % boundary -- string
294 function H_b = getBoundaryQuadrature(obj, boundary)
295 assertIsMember(boundary, {'w', 'e', 's', 'n'})
296
297 H_b = obj.(['H_', boundary]);
298 end
299
293 function N = size(obj) 300 function N = size(obj)
294 N = obj.m; 301 N = obj.m;
295 end 302 end
296 303
297 end 304 end
298
299 methods(Static)
300 % Calculates the matrices needed for the inteface coupling between boundary bound_u of scheme schm_u
301 % and bound_v of scheme schm_v.
302 % [uu, uv, vv, vu] = inteface_coupling(A,'r',B,'l')
303 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v)
304 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v);
305 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u);
306 end
307 end
308 end 305 end