Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/boundaryops/boundary_restriction_test.jl @ 1282:11b08b242e48 refactor/grids
Make equdistant_grid return an EquidistantGrid for the 1d Case
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 27 Feb 2023 15:39:13 +0100 |
parents | 1cc45207817e |
children | 43aaf710463e |
comparison
equal
deleted
inserted
replaced
1281:1cc45207817e | 1282:11b08b242e48 |
---|---|
12 g_1D = equidistant_grid(11, 0.0, 1.0) | 12 g_1D = equidistant_grid(11, 0.0, 1.0) |
13 g_2D = equidistant_grid((11,15), (0.0, 0.0), (1.0,1.0)) | 13 g_2D = equidistant_grid((11,15), (0.0, 0.0), (1.0,1.0)) |
14 | 14 |
15 @testset "boundary_restriction" begin | 15 @testset "boundary_restriction" begin |
16 @testset "1D" begin | 16 @testset "1D" begin |
17 e_l = boundary_restriction(g_1D,stencil_set,CartesianBoundary{1,Lower}()) | 17 e_l = boundary_restriction(g_1D,stencil_set,Lower()) |
18 @test e_l == BoundaryOperator(g_1D.grids[1],Stencil{Float64}(e_closure),Lower()) | 18 @test e_l == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),Lower()) |
19 @test e_l isa BoundaryOperator{T,Lower} where T | 19 @test e_l isa BoundaryOperator{T,Lower} where T |
20 @test e_l isa LazyTensor{T,0,1} where T | 20 @test e_l isa LazyTensor{T,0,1} where T |
21 | 21 |
22 e_r = boundary_restriction(g_1D,stencil_set,CartesianBoundary{1,Upper}()) | 22 e_r = boundary_restriction(g_1D,stencil_set,Upper()) |
23 @test e_r == BoundaryOperator(g_1D.grids[1],Stencil{Float64}(e_closure),Upper()) | 23 @test e_r == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),Upper()) |
24 @test e_r isa BoundaryOperator{T,Upper} where T | 24 @test e_r isa BoundaryOperator{T,Upper} where T |
25 @test e_r isa LazyTensor{T,0,1} where T | 25 @test e_r isa LazyTensor{T,0,1} where T |
26 end | 26 end |
27 | 27 |
28 @testset "2D" begin | 28 @testset "2D" begin |
33 end | 33 end |
34 | 34 |
35 @testset "Application" begin | 35 @testset "Application" begin |
36 @testset "1D" begin | 36 @testset "1D" begin |
37 e_l, e_r = boundary_restriction.(Ref(g_1D), Ref(stencil_set), boundary_identifiers(g_1D)) | 37 e_l, e_r = boundary_restriction.(Ref(g_1D), Ref(stencil_set), boundary_identifiers(g_1D)) |
38 v = eval_on(g_1D,x->1+x[1]^2) # TBD: We don't want an SVector here right? (For 1D) | 38 v = eval_on(g_1D,x->1+x^2) |
39 u = fill(3.124) | 39 u = fill(3.124) |
40 | 40 |
41 @test (e_l*v)[] == v[1] | 41 @test (e_l*v)[] == v[1] |
42 @test (e_r*v)[] == v[end] | 42 @test (e_r*v)[] == v[end] |
43 @test (e_r*v)[1] == v[end] | 43 @test (e_r*v)[1] == v[end] |