Mercurial > repos > public > sbplib
annotate +grid/boundaryoptimizedTest.m @ 1296:2853b655c172 feature/boundary_optimized_grids
Fix typos in comments
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 07 Jul 2020 16:00:24 +0200 |
parents | 2fd2e2337b77 |
children |
rev | line source |
---|---|
1289
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 function tests = boundaryoptimizedTest() |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
2 tests = functiontests(localfunctions); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
3 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
4 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
5 function testErrorInvalidParam(testCase) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
6 in = { |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
7 %Invalid order |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
8 {[10 10],{0,1},{0,2},3}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
9 %Invalid grid size |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
10 {5, {0,1}, 4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
11 {[10 5],{0,1},{0,2},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
12 {[10 5],{0,1},{0,2},6,'M'}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
13 %Invalid limits |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
14 {10,{1},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
15 {[10,10],{0,1},{1},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
16 {[10,10],{1},{1,0},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
17 {10,{1,0},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
18 {[10, 5],{1,0},{0,-1},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
19 }; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
20 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
21 for i = 1:length(in) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
22 testCase.verifyError(@()grid.boundaryoptimized(in{i}{:}),'grid:boundaryoptimized:InvalidParameter',sprintf('in(%d) = %s',i,toString(in{i}))); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
23 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
24 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
25 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
26 function testErrorInvalidOption(testCase) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
27 in = { |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
28 {[8 8],{0,1},{0,2},4,'acrurate'}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
29 }; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
30 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
31 for i = 1:length(in) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
32 testCase.verifyError(@()grid.boundaryoptimized(in{i}{:}),'grid:boundaryoptimized:InvalidOption',sprintf('in(%d) = %s',i,toString(in{i}))); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
33 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
34 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
35 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
36 function testErrorNonMatchingParam(testCase) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
37 in = { |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
38 {[],{1},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
39 {[],{0,1},{0,1},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
40 {[5,5],{0,1},{0,1},{0,1},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
41 {[5,5,4],{0,1},{0,1},4,'accurate'} |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
42 {[5,5,4],{0,1},{0,1},{0,1},4,4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
43 }; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
44 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
45 for i = 1:length(in) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
46 testCase.verifyError(@()grid.boundaryoptimized(in{i}{:}),'grid:boundaryoptimized:NonMatchingParameters',sprintf('in(%d) = %s',i,toString(in{i}))); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
47 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
48 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
49 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
50 % Tests that the expected grid points are obtained for a boundary optimized grid with a 4th order |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
51 % accurate stencil and 8th order minimal stencil. |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
52 % The boundary grid point distance weights are taken from the D1Nonequidistant operators and |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
53 % grid spacing is calculated according to Mattsson et al 2018. The test uses minimal number of grid |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
54 % points required by the operators. |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
55 function testCompiles(testCase) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
56 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
57 %% 1D 4th order accurate stencil |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
58 % Boundary weights, number of non-equidistantly spaced points for 4th order accurate stencil |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
59 bw = [0.0000000000000e+00 6.8764546205559e-01 1.8022115125776e+00]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
60 n = length(bw)-1; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
61 xi_n = bw(end); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
62 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
63 % Grid points in x-direction. |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
64 Lx = 1; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
65 mx = 8; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
66 hx_4 = Lx/(2*xi_n+(mx-2*n-1)); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
67 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
68 bp_l = hx_4*bw; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
69 bp_r = Lx-flip(hx_4*bw); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
70 interior = [hx_4*(xi_n+1) hx_4*(xi_n+2)]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
71 x_4 = [bp_l interior bp_r]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
72 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
73 % Boundary weights, number of non-equidistantly spaced points for 8th order minimal stencil |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
74 bw = [0.0000000000000e+00, 4.9439570885261e-01, 1.4051531374839e+00]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
75 n = length(bw)-1; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
76 xi_n = bw(end); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
77 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
78 %% 2D 8th order minimal stencil |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
79 % Grid points in x-direction. |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
80 hx_8 = Lx/(2*xi_n+(mx-2*n-1)); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
81 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
82 bp_l = hx_8*bw; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
83 bp_r = Lx-flip(hx_8*bw); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
84 interior = [hx_8*(xi_n+1) hx_8*(xi_n+2)]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
85 x_8 = [bp_l interior bp_r]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
86 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
87 % Grid points in y-direction. |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
88 Ly = 2; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
89 my = 9; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
90 hy = Ly/(2*xi_n+(my-2*n-1)); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
91 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
92 bp_l = hy*bw; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
93 bp_r = Ly-flip(hy*bw); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
94 interior = [hy*(xi_n+1) hy*(xi_n+2) hy*(xi_n+3)]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
95 y = [bp_l interior bp_r]; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
96 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
97 in = { |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
98 {mx, {0,Lx},4}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
99 {[mx, my],{0,Lx},{0,Ly},8,'M'}, |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
100 }; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
101 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
102 out = { |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
103 {[x_4'],hx_4} |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
104 {[kr(x_8',ones(size(y'))),kr(ones(size(x_8')),y')],[hx_8, hy]} |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
105 }; |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
106 |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
107 for i = 1:length(in) |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
108 g = grid.boundaryoptimized(in{i}{:}); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
109 testCase.verifyEqual(g.points(),out{i}{1},'AbsTol', 1e-14, 'RelTol', 1e-14); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
110 testCase.verifyEqual(g.scaling(),out{i}{2},'AbsTol', 1e-14, 'RelTol', 1e-14); |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
111 end |
2fd2e2337b77
Add utility function for constructing a (possibly multidimensional) grid based on the grid points used by the boundary optimized SBP operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
112 end |