Mercurial > repos > public > sbplib
comparison +scheme/LaplaceCurvilinear.m @ 928:1c61d8fa9903 feature/utux2D
Replace opts by type everywhere
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Mon, 03 Dec 2018 15:01:24 -0800 |
parents | 4291731570bb |
children | 1bf200417957 |
comparison
equal
deleted
inserted
replaced
927:4291731570bb | 928:1c61d8fa9903 |
---|---|
271 otherwise | 271 otherwise |
272 error('No such boundary condition: type = %s',type); | 272 error('No such boundary condition: type = %s',type); |
273 end | 273 end |
274 end | 274 end |
275 | 275 |
276 % opts Struct that specifies the interface coupling. | 276 % type Struct that specifies the interface coupling. |
277 % Fields: | 277 % Fields: |
278 % -- tuning: penalty strength, defaults to 1.2 | 278 % -- tuning: penalty strength, defaults to 1.2 |
279 % -- interpolation: struct of interpolation operators (empty for conforming grids) | 279 % -- interpolation: struct of interpolation operators (empty for conforming grids) |
280 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,opts) | 280 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
281 | 281 |
282 defaultType.tuning = 1.2; | 282 defaultType.tuning = 1.2; |
283 defaultType.interpolation = 'none'; | 283 defaultType.interpolation = 'none'; |
284 default_struct('opts', defaultType); | 284 default_struct('type', defaultType); |
285 | 285 |
286 switch opts.interpolation | 286 switch type.interpolation |
287 case {'none', ''} | 287 case {'none', ''} |
288 [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary); | 288 [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary); |
289 case {'op','OP'} | 289 case {'op','OP'} |
290 [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,opts); | 290 [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type); |
291 otherwise | 291 otherwise |
292 error('Unknown type of interpolation: %s ', type.interpolation); | 292 error('Unknown type of interpolation: %s ', type.interpolation); |
293 end | 293 end |
294 end | 294 end |
295 | 295 |
296 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,opts) | 296 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
297 | 297 |
298 default_arg('opts', struct); | 298 default_arg('type', struct); |
299 default_field(opts, 'tuning', 1.2); | 299 default_field(type, 'tuning', 1.2); |
300 tuning = opts.tuning; | 300 tuning = type.tuning; |
301 | 301 |
302 % u denotes the solution in the own domain | 302 % u denotes the solution in the own domain |
303 % v denotes the solution in the neighbour domain | 303 % v denotes the solution in the neighbour domain |
304 [e_u, d_u, gamm_u, H_b_u, I_u] = obj.get_boundary_ops(boundary); | 304 [e_u, d_u, gamm_u, H_b_u, I_u] = obj.get_boundary_ops(boundary); |
305 [e_v, d_v, gamm_v, H_b_v, I_v] = neighbour_scheme.get_boundary_ops(neighbour_boundary); | 305 [e_v, d_v, gamm_v, H_b_v, I_v] = neighbour_scheme.get_boundary_ops(neighbour_boundary); |
324 | 324 |
325 closure = obj.a*obj.Hi*( tau*e_u' + sig*d_u'); | 325 closure = obj.a*obj.Hi*( tau*e_u' + sig*d_u'); |
326 penalty = obj.a*obj.Hi*(-tau*e_v' + sig*d_v'); | 326 penalty = obj.a*obj.Hi*(-tau*e_v' + sig*d_v'); |
327 end | 327 end |
328 | 328 |
329 function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,opts) | 329 function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
330 | 330 |
331 % TODO: Make this work for curvilinear grids | 331 % TODO: Make this work for curvilinear grids |
332 warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.'); | 332 warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.'); |
333 | 333 |
334 % User can request special interpolation operators by specifying type.interpOpSet | 334 % User can request special interpolation operators by specifying type.interpOpSet |
335 default_field(opts, 'interpOpSet', @sbp.InterpOpsOP); | 335 default_field(type, 'interpOpSet', @sbp.InterpOpsOP); |
336 interpOpSet = opts.interpOpSet; | 336 interpOpSet = type.interpOpSet; |
337 tuning = opts.tuning; | 337 tuning = type.tuning; |
338 | 338 |
339 | 339 |
340 % u denotes the solution in the own domain | 340 % u denotes the solution in the own domain |
341 % v denotes the solution in the neighbour domain | 341 % v denotes the solution in the neighbour domain |
342 [e_u, d_u, gamm_u, H_b_u, I_u, ~, X_u] = obj.get_boundary_ops(boundary); | 342 [e_u, d_u, gamm_u, H_b_u, I_u, ~, X_u] = obj.get_boundary_ops(boundary); |