Mercurial > repos > public > sbplib
comparison +scheme/Utux2d.m @ 1062:e512714fb890 feature/laplace_curvilinear_test
Merge with feature/getBoundaryOp
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Mon, 14 Jan 2019 18:14:44 -0800 |
parents | 78db023a7fe3 |
children | 8d73fcdb07a5 |
comparison
equal
deleted
inserted
replaced
988:a72038b1f709 | 1062:e512714fb890 |
---|---|
137 | 137 |
138 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type) | 138 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
139 couplingType = type.couplingType; | 139 couplingType = type.couplingType; |
140 | 140 |
141 % Get neighbour boundary operator | 141 % Get neighbour boundary operator |
142 switch neighbour_boundary | 142 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 | 143 |
153 switch couplingType | 144 switch couplingType |
154 | 145 |
155 % Upwind coupling (energy dissipation) | 146 % Upwind coupling (energy dissipation) |
156 case 'upwind' | 147 case 'upwind' |
195 interpOpSet = type.interpOpSet; | 186 interpOpSet = type.interpOpSet; |
196 couplingType = type.couplingType; | 187 couplingType = type.couplingType; |
197 interpolationDamping = type.interpolationDamping; | 188 interpolationDamping = type.interpolationDamping; |
198 | 189 |
199 % Get neighbour boundary operator | 190 % Get neighbour boundary operator |
200 switch neighbour_boundary | 191 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 | 192 |
211 switch couplingType | 193 switch couplingType |
212 | 194 |
213 % Upwind coupling (energy dissipation) | 195 % Upwind coupling (energy dissipation) |
214 case 'upwind' | 196 case 'upwind' |
288 end | 270 end |
289 | 271 |
290 | 272 |
291 end | 273 end |
292 | 274 |
275 % Returns the boundary operator op for the boundary specified by the string boundary. | |
276 % op -- string or a cell array of strings | |
277 % boundary -- string | |
278 function varargout = getBoundaryOperator(obj, op, boundary) | |
279 | |
280 if ~iscell(op) | |
281 op = {op}; | |
282 end | |
283 | |
284 for i = 1:numel(op) | |
285 switch op{i} | |
286 case 'e' | |
287 switch boundary | |
288 case 'w' | |
289 e = obj.e_w; | |
290 case 'e' | |
291 e = obj.e_e; | |
292 case 's' | |
293 e = obj.e_s; | |
294 case 'n' | |
295 e = obj.e_n; | |
296 otherwise | |
297 error('No such boundary: boundary = %s',boundary); | |
298 end | |
299 varargout{i} = e; | |
300 end | |
301 end | |
302 | |
303 end | |
304 | |
305 % Returns square boundary quadrature matrix, of dimension | |
306 % corresponding to the number of boundary points | |
307 % | |
308 % boundary -- string | |
309 function H_b = getBoundaryQuadrature(obj, boundary) | |
310 | |
311 switch boundary | |
312 case 'w' | |
313 H_b = obj.H_y; | |
314 case 'e' | |
315 H_b = obj.H_y; | |
316 case 's' | |
317 H_b = obj.H_x; | |
318 case 'n' | |
319 H_b = obj.H_x; | |
320 otherwise | |
321 error('No such boundary: boundary = %s',boundary); | |
322 end | |
323 end | |
324 | |
293 function N = size(obj) | 325 function N = size(obj) |
294 N = obj.m; | 326 N = obj.m; |
295 end | 327 end |
296 | 328 |
297 end | 329 end |