comparison test/SbpOperators/volumeops/derivatives/first_derivative_test.jl @ 1018:5ec49dd2c7c4 feature/stencil_set_type

Reintroduce read_stencil_set
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 22 Mar 2022 09:57:28 +0100
parents b6238afd3bb0
children 7fc8df5157a7
comparison
equal deleted inserted replaced
991:37fd8c1cadb2 1018:5ec49dd2c7c4
20 x^k/factorial(k) 20 x^k/factorial(k)
21 end 21 end
22 22
23 @testset "first_derivative" begin 23 @testset "first_derivative" begin
24 @testset "Constructors" begin 24 @testset "Constructors" begin
25 stencil_set = StencilSet(sbp_operators_path()*"standard_diagonal.toml"; order=2) 25 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=2)
26 26
27 g₁ = EquidistantGrid(11, 0., 1.) 27 g₁ = EquidistantGrid(11, 0., 1.)
28 g₂ = EquidistantGrid((11,14), (0.,1.), (1.,3.)) 28 g₂ = EquidistantGrid((11,14), (0.,1.), (1.,3.))
29 29
30 @test first_derivative(g₁, stencil_set, 1) isa TensorMapping{Float64,1,1} 30 @test first_derivative(g₁, stencil_set, 1) isa TensorMapping{Float64,1,1}
42 42
43 @testset "Accuracy conditions" begin 43 @testset "Accuracy conditions" begin
44 N = 20 44 N = 20
45 g = EquidistantGrid(N, 0//1,2//1) 45 g = EquidistantGrid(N, 0//1,2//1)
46 @testset for order ∈ [2,4] 46 @testset for order ∈ [2,4]
47 stencil_set = StencilSet(sbp_operators_path()*"standard_diagonal.toml"; order) 47 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order)
48 D₁ = first_derivative(g, stencil_set, 1) 48 D₁ = first_derivative(g, stencil_set, 1)
49 49
50 @testset "boundary x^$k" for k ∈ 0:order÷2 50 @testset "boundary x^$k" for k ∈ 0:order÷2
51 v = evalOn(g, x->monomial(x,k)) 51 v = evalOn(g, x->monomial(x,k))
52 52
72 72
73 @testset "Accuracy on function" begin 73 @testset "Accuracy on function" begin
74 g = EquidistantGrid(30, 0.,1.) 74 g = EquidistantGrid(30, 0.,1.)
75 v = evalOn(g, x->exp(x)) 75 v = evalOn(g, x->exp(x))
76 @testset for (order, tol) ∈ [(2, 6e-3),(4, 2e-4)] 76 @testset for (order, tol) ∈ [(2, 6e-3),(4, 2e-4)]
77 stencil_set = StencilSet(sbp_operators_path()*"standard_diagonal.toml"; order) 77 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order)
78 D₁ = first_derivative(g, stencil_set, 1) 78 D₁ = first_derivative(g, stencil_set, 1)
79 79
80 @test D₁*v ≈ v rtol=tol 80 @test D₁*v ≈ v rtol=tol
81 end 81 end
82 end 82 end