Mercurial > repos > public > sbplib
annotate +grid/boundaryOptimizedTest.m @ 1336:0666629aa183 feature/D2_boundary_opt
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 13 May 2022 13:26:16 +0200 |
parents | 0ffb5bfa65e4 |
children |
rev | line source |
---|---|
1297
e53b1e25970a
Change +sbp/+util/ to +sbp/+grid and change function names to camel case
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1289
diff
changeset
|
1 function tests = boundaryOptimizedTest() |
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
|
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) |
1297
e53b1e25970a
Change +sbp/+util/ to +sbp/+grid and change function names to camel case
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1289
diff
changeset
|
22 testCase.verifyError(@()grid.boundaryOptimized(in{i}{:}),'grid:boundaryOptimized:InvalidParameter',sprintf('in(%d) = %s',i,toString(in{i}))); |
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
|
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) |
1297
e53b1e25970a
Change +sbp/+util/ to +sbp/+grid and change function names to camel case
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1289
diff
changeset
|
32 testCase.verifyError(@()grid.boundaryOptimized(in{i}{:}),'grid:boundaryOptimized:InvalidOption',sprintf('in(%d) = %s',i,toString(in{i}))); |
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
|
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) |
1297
e53b1e25970a
Change +sbp/+util/ to +sbp/+grid and change function names to camel case
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1289
diff
changeset
|
46 testCase.verifyError(@()grid.boundaryOptimized(in{i}{:}),'grid:boundaryOptimized:NonMatchingParameters',sprintf('in(%d) = %s',i,toString(in{i}))); |
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
|
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 |
1298
0ffb5bfa65e4
Improve comments
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1297
diff
changeset
|
53 % grid spacing is calculated according to Mattsson et al 2018. |
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
|
54 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
|
55 |
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 %% 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
|
57 % 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
|
58 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
|
59 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
|
60 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
|
61 |
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 % 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
|
63 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
|
64 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
|
65 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
|
66 |
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 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
|
68 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
|
69 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
|
70 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
|
71 |
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 % 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
|
73 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
|
74 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
|
75 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
|
76 |
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 %% 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
|
78 % 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
|
79 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
|
80 |
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 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
|
82 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
|
83 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
|
84 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
|
85 |
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 % 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
|
87 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
|
88 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
|
89 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
|
90 |
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 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
|
92 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
|
93 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
|
94 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
|
95 |
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 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
|
97 {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
|
98 {[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
|
99 }; |
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 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
|
102 {[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
|
103 {[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
|
104 }; |
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 for i = 1:length(in) |
1297
e53b1e25970a
Change +sbp/+util/ to +sbp/+grid and change function names to camel case
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1289
diff
changeset
|
107 g = grid.boundaryOptimized(in{i}{:}); |
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
|
108 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
|
109 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
|
110 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
|
111 end |