Mercurial > repos > public > sbplib
comparison +multiblock/DefCurvilinear.m @ 1329:7df63b17e078 feature/D2_boundary_opt
Add support for boundary optimized grids in DefCurvilinear, and add boundaryOptimizedCurvilinear for constructing a curvilinear grid with boundary optimized grid point placement.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 14 Feb 2022 14:55:29 +0100 |
parents | e7a6744499fa |
children | 60c875c18de3 |
comparison
equal
deleted
inserted
replaced
1328:3a286d2d1939 | 1329:7df63b17e078 |
---|---|
35 end | 35 end |
36 | 36 |
37 obj.boundaryGroups = boundaryGroups; | 37 obj.boundaryGroups = boundaryGroups; |
38 end | 38 end |
39 | 39 |
40 function g = getGrid(obj, varargin) | 40 % Returns a multiblock.Grid given some parameters |
41 ms = obj.getGridSizes(varargin{:}); | 41 % ms: cell array of [mx, my] vectors |
42 % Currently defaults to an equidistant curvilinear grid if varargin is empty. | |
43 % If varargin is non-empty, the first argument should supply the grid type, followed by | |
44 % additional arguments required to construct the grid. | |
45 % Grid types: | |
46 % 'equidist' - equidistant curvilinear grid | |
47 % Additional argumets: none | |
48 % 'boundaryopt' - boundary optimized grid based on boundary | |
49 % optimized SBP operators | |
50 % Additional arguments: order, stencil option | |
51 function g = getGrid(obj, ms, varargin) | |
52 % If a scalar is passed, defer to getGridSizes implemented by subclass | |
53 % TODO: This forces the interface of subclasses. | |
54 % Should ms be included in varargin? Figure out bow to do it properly | |
55 if length(ms) == 1 | |
56 ms = obj.getGridSizes(ms); | |
57 end | |
42 | 58 |
43 grids = cell(1, obj.nBlocks); | 59 if isempty(varargin) || strcmp(varargin{1},'equidist') |
44 for i = 1:obj.nBlocks | 60 gridgenerator = @(blockMap,m) grid.equidistantCurvilinear(blockMap, m); |
45 grids{i} = grid.equidistantCurvilinear(obj.blockMaps{i}.S, ms{i}); | 61 elseif strcmp(varargin{1},'boundaryopt') |
46 end | 62 order = varargin{2}; |
63 stenciloption = varargin{3}; | |
64 gridgenerator = @(blockMap,m) grid.boundaryOptimizedCurvilinear(blockMap,m,{0,1},{0,1},... | |
65 order,stenciloption); | |
66 else | |
67 error('No grid type supplied!'); | |
68 end | |
69 grids = cell(1, obj.nBlocks); | |
70 for i = 1:obj.nBlocks | |
71 grids{i} = gridgenerator(obj.blockMaps{i}.S, ms{i}); | |
72 end | |
47 | 73 |
48 g = multiblock.Grid(grids, obj.connections, obj.boundaryGroups); | 74 g = multiblock.Grid(grids, obj.connections, obj.boundaryGroups); |
49 end | 75 end |
50 | 76 |
51 function h = show(obj, label, gridLines, varargin) | 77 function h = show(obj, label, gridLines, varargin) |